In a recent build for hppa64-hp-hpux11.11, the build failed in stage2
due to a warning about the
format used in the ASM_GENERATE_INTERNAL_LABEL macro. This got me
looking at the implementation
in elfos.h. I also realized that there was no good reason to limit the
number of labels to 9999 and
to prefix the label numbers with zeros.
The attached patch revises the label generation on hppa-hpux to use the
same technique as used in
config/elfos.h.
Tested on hppa2.0w-hp-hpux11.11, hppa64-hp-hpux11.11 and
hppa-unknown-linux-gnu with no
observed regressions.
Committed to trunk.
Dave
--
John David Anglin dave.ang...@bell.net
2018-03-06 John David Anglin <dang...@gcc.gnu.org>
* config/pa/pa.h (ASM_GENERATE_INTERNAL_LABEL): Revise to use
sprint_ul.
(ASM_OUTPUT_ADDR_VEC_ELT): Revise for above change.
(ASM_OUTPUT_ADDR_DIFF_ELT): Likewise.
* config/pa/pa64-hpux.h (ASM_GENERATE_INTERNAL_LABEL): Revise as above.
Index: config/pa/pa.h
===================================================================
--- config/pa/pa.h (revision 258210)
+++ config/pa/pa.h (working copy)
@@ -1114,9 +1114,19 @@
PREFIX is the class of label and NUM is the number within the class.
This is suitable for output with `assemble_name'. */
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL,PREFIX,NUM) \
- sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
+ do \
+ { \
+ char *__p; \
+ (LABEL)[0] = '*'; \
+ (LABEL)[1] = (PREFIX)[0]; \
+ (LABEL)[2] = '$'; \
+ __p = stpcpy (&(LABEL)[3], &(PREFIX)[1]); \
+ sprint_ul (__p, (unsigned long) (NUM)); \
+ } \
+ while (0)
+
/* Output the definition of a compiler-generated label named NAME. */
#define ASM_OUTPUT_INTERNAL_LABEL(FILE,NAME) \
@@ -1154,7 +1164,7 @@
/* This is how to output an element of a case-vector that is absolute. */
#define ASM_OUTPUT_ADDR_VEC_ELT(FILE, VALUE) \
- fprintf (FILE, "\t.word L$%04d\n", VALUE)
+ fprintf (FILE, "\t.word L$%d\n", VALUE)
/* This is how to output an element of a case-vector that is relative.
Since we always place jump tables in the text section, the difference
@@ -1161,7 +1171,7 @@
is absolute and requires no relocation. */
#define ASM_OUTPUT_ADDR_DIFF_ELT(FILE, BODY, VALUE, REL) \
- fprintf (FILE, "\t.word L$%04d-L$%04d\n", VALUE, REL)
+ fprintf (FILE, "\t.word L$%d-L$%d\n", VALUE, REL)
/* This is how to output an absolute case-vector. */
Index: config/pa/pa64-hpux.h
===================================================================
--- config/pa/pa64-hpux.h (revision 258210)
+++ config/pa/pa64-hpux.h (working copy)
@@ -245,9 +245,19 @@
/* We need to use the HP style for internal labels. */
#undef ASM_GENERATE_INTERNAL_LABEL
-#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
- sprintf (LABEL, "*%c$%s%04ld", (PREFIX)[0], (PREFIX) + 1, (long)(NUM))
+#define ASM_GENERATE_INTERNAL_LABEL(LABEL, PREFIX, NUM) \
+ do \
+ { \
+ char *__p; \
+ (LABEL)[0] = '*'; \
+ (LABEL)[1] = (PREFIX)[0]; \
+ (LABEL)[2] = '$'; \
+ __p = stpcpy (&(LABEL)[3], &(PREFIX)[1]); \
+ sprint_ul (__p, (unsigned long) (NUM)); \
+ } \
+ while (0)
+
#else /* USING_ELFOS_H */
/* We are not using GAS. */