[PATCH, i386]: Define TARGET_CAN_SPLIT_STACK only when HAVE_GAS_CFI_PERSONALITY_DIRECTIVE is set

Uros Bizjak ubizjak@gmail.com
Fri Feb 8 14:28:00 GMT 2013


Hello!

Attached patch fixes several go testcase failures on CentOS 5.9 with
ancient (GNU ld version 2.17.50.0.6-20.el5_8.3 20061020) binutils.
These do not have CFI personality directive, so -fsplit-stack should
not be used there.

The compiler detects this situation through
TARGET_SUPPORTS_SPLIT_STACK target hook, but the go driver
nevertheless emits -fsplit-stack option, depending solely on the
definition of TARGET_CAN_SPLIT_STACK. Forcing -fsplit-stack from the
driver triggers the error from the above target hook.

To fix this situation, attached patch declares TARGET_CAN_SPLIT_STACK
only in case HAVE_GAS_CFI_PERSONALITY is set (please note that it
should be *set*, not only *defined*).

2013-02-08  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/gnu-user.h (TARGET_CAN_SPLIT_STACK): Define only
	when HAVE_GAS_CFI_PERSONALITY_DIRECTIVE is set.
	* config/i386/gnu-user64.h (TARGET_CAN_SPLIT_STACK): Ditto.

Patch was bootstrapped and regression tested on x86_64-pc-linux-gnu
{,-m32} on Fedora17 (GNU ld version 2.22.52.0.1-10.fc17 20120131) and
CentOS 5.9 (GNU ld version 2.17.50.0.6-20.el5_8.3 20061020), where it
fixes many go testsuite failures.

Ian, although this is purely x86 patch, can you please approve it from
go perspective (go is the only user of TARGET_CAN_SPLIT_STACK)?

Uros.
-------------- next part --------------
Index: config/i386/gnu-user64.h
===================================================================
--- config/i386/gnu-user64.h	(revision 195875)
+++ config/i386/gnu-user64.h	(working copy)
@@ -85,8 +85,10 @@
 #define TARGET_THREAD_SSP_OFFSET \
   (TARGET_64BIT ? (TARGET_X32 ? 0x18 : 0x28) : 0x14)
 
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+#define TARGET_CAN_SPLIT_STACK
+#endif
 /* We steal the last transactional memory word.  */
-#define TARGET_CAN_SPLIT_STACK
 #define TARGET_THREAD_SPLIT_STACK_OFFSET \
   (TARGET_64BIT ? (TARGET_X32 ? 0x40 : 0x70) : 0x30)
 #endif
Index: config/i386/gnu-user.h
===================================================================
--- config/i386/gnu-user.h	(revision 195875)
+++ config/i386/gnu-user.h	(working copy)
@@ -154,7 +154,9 @@
 /* i386 glibc provides __stack_chk_guard in %gs:0x14.  */
 #define TARGET_THREAD_SSP_OFFSET	0x14
 
+#if HAVE_GAS_CFI_PERSONALITY_DIRECTIVE
+#define TARGET_CAN_SPLIT_STACK
+#endif
 /* We steal the last transactional memory word.  */
-#define TARGET_CAN_SPLIT_STACK
 #define TARGET_THREAD_SPLIT_STACK_OFFSET 0x30
 #endif


More information about the Gcc-patches mailing list