]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Move -mrelocatable word before function prologue.
authorMichael Meissner <meissner@gcc.gnu.org>
Thu, 2 Mar 1995 01:07:59 +0000 (01:07 +0000)
committerMichael Meissner <meissner@gcc.gnu.org>
Thu, 2 Mar 1995 01:07:59 +0000 (01:07 +0000)
From-SVN: r9105

gcc/config/rs6000/rs6000.c
gcc/config/rs6000/sysv4.h

index 678f21f9954068ce37ac4945d7f86da8ccb82645..d726f82c828ab90ee44f119b02254a593edd7cb7 100644 (file)
@@ -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
 \f
 /* 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 */
index e2ff344b91141c462acaa170533f101bcecedcd7..378a20892079cb3764e1aa48d1c6decc1262a9e7 100644 (file)
@@ -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);                                                  \