Patchwork PATCH COMMITTED: Fix -fsplit-stack build with old binutils

login
register
mail settings
Submitter Ian Taylor
Date Sept. 28, 2010, 12:07 a.m.
Message ID <mcrfwwuvih7.fsf@google.com>
Download mbox | patch
Permalink /patch/65929/
State New
Headers show

Comments

Ian Taylor - Sept. 28, 2010, 12:07 a.m.
http://gcc.gnu.org/ml/gcc-regression/2010-09/msg00356.html shows a build
failure with the -fsplit-stack patches:

/home/regress/tbox/svn-gcc/libgcc/config/i386/morestack.S
/home/regress/tbox/svn-gcc/libgcc/config/i386/morestack.S: Assembler messages:
/home/regress/tbox/svn-gcc/libgcc/config/i386/morestack.S:138: Error: unknown pseudo-op: `.cfi_personality'
/home/regress/tbox/svn-gcc/libgcc/config/i386/morestack.S:139: Error: unknown pseudo-op: `.cfi_lsda'
make[3]: *** [morestack_s.o] Error 1

gas picked up support for .cfi_personality 2006-11-03, which was in the
binutils 2.18 release.

This patch changes gcc to only support -fsplit-stack if the .cfi
pseudo-ops are available in the assembler.  Another approach would be to
spell out the information in morestack.S, but that does not seem to me
like a useful way to spend time considering how long the GNU binutils
have supported the pseudo-ops.

Bootstrapped and tested on x86_64-unknown-linux-gnu.  Committed to
mainline.

Ian


gcc/ChangeLog:

2010-09-27  Ian Lance Taylor  <iant@google.com>

	* config/i386/i386.c (ix86_supports_split_stack): -fsplit-stack
	requires assembler support for CFI directives.

libgcc/ChangeLog:

2010-09-27  Ian Lance Taylor  <iant@google.com>

	* configure.ac: Test whether assembler supports CFI directives.
	* config.host: Only add t-stack and i386/t-stack-i386 to
	tmake_file if libgcc_cv_cfi is "yes".
	* configure: Rebuild.

Patch

Index: libgcc/config.host
===================================================================
--- libgcc/config.host	(revision 164669)
+++ libgcc/config.host	(working copy)
@@ -602,7 +602,10 @@  case ${host} in
 i[34567]86-*-linux* | x86_64-*-linux* | \
   i[34567]86-*-kfreebsd*-gnu | i[34567]86-*-knetbsd*-gnu | \
   i[34567]86-*-gnu*)
-	tmake_file="${tmake_file} t-tls t-stack i386/t-stack-i386"
+	tmake_file="${tmake_file} t-tls"
+	if test "$libgcc_cv_cfi" = "yes"; then
+		tmake_file="{$tmake_file} t-stack i386/t-stack-i386"
+	fi
 	;;
 esac
 
Index: libgcc/configure.ac
===================================================================
--- libgcc/configure.ac	(revision 164669)
+++ libgcc/configure.ac	(working copy)
@@ -135,6 +135,12 @@  AC_CACHE_CHECK([whether fixed-point is s
 fixed_point=$libgcc_cv_fixed_point
 AC_SUBST(fixed_point)
 
+# Check for assembler CFI support.
+AC_CACHE_CHECK([whether assembler supports CFI directives], [libgcc_cv_cfi],
+	       [AC_COMPILE_IFELSE([int i = __GCC_HAVE_DWARF2_CFI_ASM;],
+				  [libgcc_cv_cfi=yes],
+				  [libgcc_cv_cfi=no])])
+
 # Check 32bit or 64bit for x86.
 case ${host} in
 i?86*-*-* | x86_64*-*-*)
Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 164669)
+++ gcc/config/i386/i386.c	(working copy)
@@ -8415,6 +8415,14 @@  ix86_supports_split_stack (bool report A
   if (report)
     error ("%<-fsplit-stack%> currently only supported on GNU/Linux");
   ret = false;
+#else
+  if (!dwarf2out_do_cfi_asm ())
+    {
+      if (report)
+	error ("%<-fsplit-stack%> requires "
+	       "assembler support for CFI directives");
+      ret = false;
+    }
 #endif
 
   return ret;