From 874a07447a882ce3de66a718c9f945767ae06dd1 Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Thu, 2 Mar 1995 01:07:59 +0000 Subject: [PATCH] Move -mrelocatable word before function prologue. From-SVN: r9105 --- gcc/config/rs6000/rs6000.c | 35 ++++++++++++++++++++++++----------- gcc/config/rs6000/sysv4.h | 17 +++++++++++++++++ 2 files changed, 41 insertions(+), 11 deletions(-) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 678f21f9954..d726f82c828 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -63,6 +63,12 @@ static int common_mode_defined; rtx rs6000_compare_op0, rs6000_compare_op1; int rs6000_compare_fp_p; + +#ifdef USING_SVR4_H +/* Label number of label created for -mrelocatable, to call to so we can + get the address of the GOT section */ +int rs6000_pic_labelno; +#endif /* Override command line options. Mostly we process the processor type and sometimes adjust other TARGET_ options. */ @@ -1588,6 +1594,7 @@ output_prolog (file, size) int first_fp_reg = first_fp_reg_to_save (); int basic_size = rs6000_sa_size (); int total_size = (basic_size + size + current_function_outgoing_args_size); + char buf[256]; /* Round size to multiple of 8 bytes. */ total_size = (total_size + 7) & ~7; @@ -1701,24 +1708,30 @@ output_prolog (file, size) #ifdef USING_SVR4_H if (TARGET_RELOCATABLE) { - static int labelno = 0; - - ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", labelno); + ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); fprintf (file, "\tbl "); assemble_name (file, buf); fprintf (file, "\n"); - ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); - fprintf (file, (TARGET_POWERPC64) ? "\t.quad " : "\t.long "); - assemble_name (file, buf); - fprintf (file, "-.\n"); - - ASM_OUTPUT_INTERNAL_LABEL (file, "LCF", labelno); + ASM_OUTPUT_INTERNAL_LABEL (file, "LCF", rs6000_pic_labelno); fprintf (file, "\tmflr 30\n"); - asm_fprintf (file, (TARGET_POWERPC64) ? "\tld 0,0(30)\n" : "\t{l|lwz} 0,0(30)\n"); + if (TARGET_POWERPC64) + fprintf (file, "\tld 0,"); + else if (TARGET_NEW_MNEMONICS) + fprintf (file, "\tlwz 0,"); + else + fprintf (file, "\tl 0,"); + + fprintf (file, "("); + ASM_GENERATE_INTERNAL_LABEL (buf, "LCL", rs6000_pic_labelno); + assemble_name (file, buf); + fprintf (file, "-"); + ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); + assemble_name (file, buf); + fprintf (file, ")(30)\n"); asm_fprintf (file, "\t{cax|add} 30,0,30\n"); - labelno++; + rs6000_pic_labelno++; } else #endif /* USING_SVR4_H */ diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index e2ff344b911..378a2089207 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -188,10 +188,27 @@ toc_section () \ function's return value. We allow for that here. */ extern void svr4_traceback (); +extern int rs6000_pic_labelno; #undef ASM_DECLARE_FUNCTION_NAME #define ASM_DECLARE_FUNCTION_NAME(FILE, NAME, DECL) \ do { \ + if (TARGET_RELOCATABLE && get_pool_size () != 0) \ + { \ + char buf[256]; \ + \ + ASM_OUTPUT_INTERNAL_LABEL (FILE, "LCL", rs6000_pic_labelno); \ + \ + ASM_GENERATE_INTERNAL_LABEL (buf, "LCTOC", 1); \ + fprintf (FILE, (TARGET_POWERPC64) ? "\t.quad " : "\t.long "); \ + assemble_name (FILE, buf); \ + putc ('-', FILE); \ + \ + ASM_GENERATE_INTERNAL_LABEL (buf, "LCF", rs6000_pic_labelno); \ + assemble_name (FILE, buf); \ + putc ('\n', FILE); \ + } \ + \ fprintf (FILE, "\t%s\t ", TYPE_ASM_OP); \ assemble_name (FILE, NAME); \ putc (',', FILE); \ -- 2.30.2