powerpc backend (2.95.2) not responding to USER_LABEL_PREFIX
Jonathan Walton
jonboy@gordian.com
Thu Apr 13 17:08:00 GMT 2000
We changed the USER_LABEL_PREFIX on the powerpc(rs6000) config of
gcc-2.95.2, and discovered that it had no effect.
I have a set of patches that make it work for us, but this
USER_LABEL_PREFIX settability in the rs6000 tree is a total mess, and I'm
pretty sure that my changes are incomplete, and will possibly break someone
else.
Unfortunately, I don't understand what's going on with the
RS6000_OUTPUT_BASENAME() hack in those .h files, and that seems to be a
large source of the troubles, since that does stuff which [seemingly
purposefully] defeats the desired logic in assemble_name().
[In addition, there are many places where the macros manually insert "." as
a prefix instead of calling the assemble_name() function to put the proper
prefix in, and I can't tell which of those are right vs wrong. I had to
change a couple of them to get things working.
> grep '\.\"' config/rs6000/*.h
seems to flag most/all the lines I'm scared of.
I have no test files, because the builds of libgcc1 and libgcc2 were my
tests.
We configured with the following:
../src/configure --with-gcc-version-trigger=/mnt/gordian/src/ppc-tools/src/gcc/version.c --host=i686-pc-linux-gnu --target=powerpc-eabi --prefix=/usr/local/ppc-tools-000413 -v --nfp --norecursion
The patches I've applied to get it [seemingly] working for us are as below.
In theory, the patch to ASM_OUTPUT_LABELREF() should have been all that was
needed, but ASM_DECLARE_FUNCTION_NAME was written without using
assemble_name() [I believe my fix for those two are universal].
But unfortunately because of the mess from RS6000_OUTPUT_BASENAME, I also
had to change ASM_OUTPUT_LABEL, ASM_GLOBALIZE_LABEL [and I fear those fixes
might not play happy with other powerpc builds]. Plus I think there may be
some similar problems in other powerpc files I don't touch, such as
netware.h.
Anyone who understands all the RS6000_OUTPUT_BASENAME() stuff care to look
at this?
Jonathan
*** pregordian/sysv4.h Thu Apr 13 15:29:37 2000
--- ./sysv4.h Thu Apr 13 14:53:38 2000
*************** extern int rs6000_pic_labelno;
*** 629,635 ****
do { \
char *orig_name; \
char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
! STRIP_NAME_ENCODING (orig_name, NAME); \
\
if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag)) \
{ \
--- 629,635 ----
do { \
char *orig_name; \
char *init_ptr = (TARGET_64BIT) ? ".quad" : ".long"; \
! orig_name = (NAME); \
\
if (TARGET_RELOCATABLE && (get_pool_size () != 0 || profile_flag)) \
{ \
*************** extern int rs6000_pic_labelno;
*** 645,651 ****
fprintf (FILE, "%s\n", buf_ptr); \
} \
\
! fprintf (FILE, "\t%s\t %s,", TYPE_ASM_OP, orig_name); \
fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
putc ('\n', FILE); \
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
--- 645,653 ----
fprintf (FILE, "%s\n", buf_ptr); \
} \
\
! fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \
! assemble_name (FILE, orig_name); \
! fprintf (FILE, ","); \
fprintf (FILE, TYPE_OPERAND_FMT, "function"); \
putc ('\n', FILE); \
ASM_DECLARE_RESULT (FILE, DECL_RESULT (DECL)); \
*************** extern int rs6000_pic_labelno;
*** 657,674 ****
while (*desc_name == '.') \
desc_name++; \
\
! if (TREE_PUBLIC (DECL)) \
! fprintf (FILE, "\t.globl %s\n", desc_name); \
\
fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
! fprintf (FILE, "%s:\n", desc_name); \
! fprintf (FILE, "\t%s %s\n", init_ptr, orig_name); \
fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
if (DEFAULT_ABI == ABI_AIX) \
fprintf (FILE, "\t%s 0\n", init_ptr); \
fprintf (FILE, "\t.previous\n"); \
} \
! fprintf (FILE, "%s:\n", orig_name); \
} while (0)
/* How to renumber registers for dbx and gdb. */
--- 659,682 ----
while (*desc_name == '.') \
desc_name++; \
\
! if (TREE_PUBLIC (DECL)) { \
! fprintf (FILE, "\t.globl "); \
! assemble_name (FILE, desc_name); \
! fprintf (FILE, "\n"); \
! } \
\
fprintf (FILE, "%s\n", MINIMAL_TOC_SECTION_ASM_OP); \
! assemble_name (FILE, desc_name); \
! fprintf (FILE, ":\n\t%s ", init_ptr); \
! assemble_name (FILE, orig_name); \
! fprintf (FILE, "\n"); \
fprintf (FILE, "\t%s _GLOBAL_OFFSET_TABLE_\n", init_ptr); \
if (DEFAULT_ABI == ABI_AIX) \
fprintf (FILE, "\t%s 0\n", init_ptr); \
fprintf (FILE, "\t.previous\n"); \
} \
! assemble_name (FILE, orig_name); \
! fprintf (FILE, ":\n"); \
} while (0)
/* How to renumber registers for dbx and gdb. */
*************** do { \
*** 844,856 ****
/* This is how to output a reference to a user-level label named NAME.
`assemble_name' uses this. */
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
do { \
char *_name = NAME; \
while (*_name == '*' || *_name == '@') \
_name++; \
! fputs (_name, FILE); \
} while (0)
/*
--- 852,866 ----
/* This is how to output a reference to a user-level label named NAME.
`assemble_name' uses this. */
+ /* gordian mod -- modified based on 68k-land. seems we want to obey
+ USER_LABEL_PREFIX, which means asm_fprintf(). */
#undef ASM_OUTPUT_LABELREF
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
do { \
char *_name = NAME; \
while (*_name == '*' || *_name == '@') \
_name++; \
! asm_fprintf (FILE, "%0U%s", _name); \
} while (0)
/*
*** pregordian/rs6000.h Thu Apr 13 15:29:33 2000
--- ./rs6000.h Thu Apr 13 15:30:27 2000
*************** extern char rs6000_reg_names[][8]; /* re
*** 2964,2983 ****
such as the label on a static function or variable NAME. */
#define ASM_OUTPUT_LABEL(FILE,NAME) \
! do { RS6000_OUTPUT_BASENAME (FILE, NAME); fputs (":\n", FILE); } while (0)
/* This is how to output a command to make the user-level label named NAME
defined for reference from other files. */
#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
do { fputs ("\t.globl ", FILE); \
! RS6000_OUTPUT_BASENAME (FILE, NAME); fputs ("\n", FILE);} while (0)
/* This is how to output a reference to a user-level label named NAME.
`assemble_name' uses this. */
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
! fputs (NAME, FILE)
/* This is how to output an internal numbered label where
PREFIX is the class of label and NUM is the number within the class. */
--- 2963,2984 ----
such as the label on a static function or variable NAME. */
#define ASM_OUTPUT_LABEL(FILE,NAME) \
! do { assemble_name (FILE, NAME); fputs (":\n", FILE); } while (0)
/* This is how to output a command to make the user-level label named NAME
defined for reference from other files. */
#define ASM_GLOBALIZE_LABEL(FILE,NAME) \
do { fputs ("\t.globl ", FILE); \
! assemble_name (FILE, NAME); fputs ("\n", FILE);} while (0)
/* This is how to output a reference to a user-level label named NAME.
`assemble_name' uses this. */
+ /* gordian mod -- stolen from 68k-land. seems we want to obey
+ USER_LABEL_PREFIX, which means asm_fprintf() magic needed. */
#define ASM_OUTPUT_LABELREF(FILE,NAME) \
! asm_fprintf (FILE, "%0U%s", NAME)
/* This is how to output an internal numbered label where
PREFIX is the class of label and NUM is the number within the class. */
More information about the Gcc-bugs
mailing list