This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[trunk][RFA] Add __i686.get_pc_thunk.bx to libgcc i386 morestack.S


After I submitted
http://gcc.gnu.org/ml/gcc-patches/2011-04/msg02422.html, Rong Xu noted
that the resulting sources, if configured --with-pic, would not
actually build properly due to missing __i686.get_pc_thunk.bx (due to
my renaming that to __x86...).

While that issue was exposed by my change, in that configuration, in
summary my change exposed a latent issue in morestack.S.
(Callers of __i686.get_pc_thunk.bx (etc.) are also supposed to define
those functions -- because who knows whether the other objects they're
linked against will provide them.)

So, I've added the __i686.get_pc_thunk.bx function (as generated by
current GCC) to libgcc/config/i386/morestack.S.  (I also added __ELF__
#ifdefs and a .size directive for the function, following the apparent
conventions in the file.)


bootstrapped (C only) on Ubuntu Lucid x86-64, and ran -m32/-m64 tests
for compilers configured as normal, and also --with-pic.
No regressions before/after.


Ian, OK for trunk?


chris
----
[libgcc/ChangeLog]
2011-05-03  Chris Demetriou  <cgd@google.com>

        * libgcc/config/i386/morestack.S (__i686.get_pc_thunk.bx): New.
[libgcc/ChangeLog]
2011-05-03  Chris Demetriou  <cgd@google.com>

	* libgcc/config/i386/morestack.S (__i686.get_pc_thunk.bx): New.

Index: libgcc/config/i386/morestack.S
===================================================================
--- libgcc/config/i386/morestack.S	(revision 173287)
+++ libgcc/config/i386/morestack.S	(working copy)
@@ -449,6 +449,24 @@
 	.size	__morestack, . - __morestack
 #endif
 
+#if !defined(__x86_64__) && defined(__PIC__)
+# Output the thunk to get PC into bx, since we use it above.
+# (__i686 was already undef'd above; don't need to worry about it here.)
+	.section	.text.__i686.get_pc_thunk.bx,"axG",@progbits,__i686.get_pc_thunk.bx,comdat
+	.globl	__i686.get_pc_thunk.bx
+	.hidden	__i686.get_pc_thunk.bx
+#ifdef __ELF__
+	.type	__i686.get_pc_thunk.bx, @function
+#endif
+__i686.get_pc_thunk.bx:
+	.cfi_startproc
+	movl	(%esp), %ebx
+	ret
+	.cfi_endproc
+#ifdef __ELF__
+	.size	__i686.get_pc_thunk.bx, . - __i686.get_pc_thunk.bx
+#endif
+#endif
 
 # The exception table.  This tells the personality routine to execute
 # the exception handler.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]