PATCH Re: bad interaction between PIC and linkonce sections on linux/ia86

scott snyder
Mon Apr 3 11:16:00 GMT 2000

hi -

Here's a patch for the problem with generating PIC code for i686 machines
i reported in:

I took Martin's suggestion
( )
and fixed it by forcing the PIC label (LPR0) to go into the text section.
This also required adding code in varasm.c to switch back to the
proper section after calling ASM_OUTPUT_FUNCTION_PREFIX.  (I didn't
see any good way to put the section resoration inside

I've verified that the compiler bootstraps on an i686 with this change,
and that the number of failures in the testsuite does not change.


2000-04-02  scott snyder  <>

	* varasm.c (assemble_start_function): Allow
	ASM_OUTPUT_FUNCTION_PREFIX to change the assembler section
	* config/i386/i386.c (asm_output_function_prefix): Force the PIC
	label used with TARGET_DEEP_BRANCH_PREDICTION into the text

Index: varasm.c
RCS file: /cvs/gcc/egcs/gcc/varasm.c,v
retrieving revision 1.110
diff -u -p -r1.110 varasm.c
--- varasm.c	2000/03/25 18:34:05	1.110
+++ varasm.c	2000/04/03 17:58:17
@@ -1039,7 +1039,12 @@ assemble_start_function (decl, fnname)
-  ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname);
+  {
+    enum in_section saved_in_section = in_section;
+    ASM_OUTPUT_FUNCTION_PREFIX (asm_out_file, fnname);
+    if (in_section != saved_in_section)
+      function_section (decl);
+  }
Index: config/i386/i386.c
RCS file: /cvs/gcc/egcs/gcc/config/i386/i386.c,v
retrieving revision 1.151
diff -u -p -r1.151 i386.c
--- i386.c	2000/03/30 13:46:05	1.151
+++ i386.c	2000/04/03 17:58:44
@@ -1604,6 +1604,10 @@ asm_output_function_prefix (file, name)
       if (!pic_label_output)
+          /* Make sure that this doesn't get into a linkonce section
+             being used for template instantiation. */
+          text_section ();
 	  /* This used to call ASM_DECLARE_FUNCTION_NAME() but since it's an
 	     internal (non-global) label that's being emitted, it didn't make
 	     sense to have .type information for local labels.   This caused

More information about the Gcc-patches mailing list