diff mbox series

[committed] hppa: Update handling of internal labels on hppa-hpux

Message ID d68128ee-6f93-9acd-5b7a-ab961a153266@bell.net
State New
Headers show
Series [committed] hppa: Update handling of internal labels on hppa-hpux | expand

Commit Message

John David Anglin March 7, 2018, 12:59 a.m. UTC
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
diff mbox series

Patch

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.  */