We currently generate

__i686.get_pc_thunk.bx:
        movl    (%esp), %ebx
        ret
in PIC binaries. This can cause problems if the assembly output ends up
in a .S file which is then compiled again: __i686 is a predefined macro
and expands to "1". This happens in glibc when compiling csu/crti.S,
which is generated from initfini.c; presumably this worked before
Richard removed the !TARGET_DEEP_BRANCH_PREDICTION code.
A simple way of fixing it would be to change the name of the thunk, as
below. Of course, libc also has copies of this code, so worst case we'd
end up with two of the thunks, which doesn't seem like a massive problem.

Tested on i686-linux (with a few failures which I can attribute to a
different patch in the tree).


Bernd
        * config/i386/i386.c (get_pc_thunk_name): Change prefix to
        "__i686_get_pc_thunk.".

Index: config/i386/i386.c
===================================================================
--- config/i386/i386.c  (revision 178030)
+++ config/i386/i386.c  (working copy)
@@ -8339,7 +8339,7 @@ get_pc_thunk_name (char name[32], unsign
   gcc_assert (!TARGET_64BIT);
 
   if (USE_HIDDEN_LINKONCE)
-    sprintf (name, "__i686.get_pc_thunk.%s", reg_names[regno]);
+    sprintf (name, "__i686_get_pc_thunk.%s", reg_names[regno]);
   else
     ASM_GENERATE_INTERNAL_LABEL (name, "LPR", regno);
 }

Reply via email to