PATCH: Properly mark 64-bit .eh_frame section on x86 as type unwind

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Mon Mar 15 18:59:00 GMT 2010


Unfortunately, this patch

	http://gcc.gnu.org/ml/gcc-patches/2010-02/msg00991.html

hasn't seen any review.  To be extra safe, I've deciced to implement an
autoconf test for the @unwind section type, so platforms without that
aren't broken.

Ok for mainline and the 4.4 branch now?

	Rainer

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


2010-02-14  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	libffi:
	* configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test.
	* configure: Regenerate.
	* fficonfig.h.in: Regenerate.
	* libffi/src/x86/unix64.S (.eh_frame)
	[HAVE_AS_X86_64_UNWIND_SECTION_TYPE]: Use @unwind section type.

diff -r 62c8cfd59254 -r 1f8115706897 libffi/configure.ac
--- a/libffi/configure.ac	Mon Mar 15 19:47:38 2010 +0100
+++ b/libffi/configure.ac	Mon Mar 15 19:47:38 2010 +0100
@@ -284,6 +284,21 @@
      ;;
 esac
 
+if test x$TARGET = xX86_64; then
+    AC_CACHE_CHECK([assembler supports unwind section type],
+	libffi_cv_as_x86_64_unwind_section_type, [
+	libffi_cv_as_x86_64_unwind_section_type=yes
+	echo '.section .eh_frame,"a",@unwind' > conftest.s
+	if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then
+	    libffi_cv_as_x86_64_unwind_section_type=no
+	fi
+	])
+    if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then
+	AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1,
+		  [Define if your assembler supports unwind section type.])
+    fi
+fi
+
 AC_CACHE_CHECK([whether .eh_frame section should be read-only],
     libffi_cv_ro_eh_frame, [
 	libffi_cv_ro_eh_frame=no
diff -r 62c8cfd59254 -r 1f8115706897 libffi/src/x86/unix64.S
--- a/libffi/src/x86/unix64.S	Mon Mar 15 19:47:38 2010 +0100
+++ b/libffi/src/x86/unix64.S	Mon Mar 15 19:47:38 2010 +0100
@@ -324,7 +324,11 @@
 .LUW9:
 	.size	ffi_closure_unix64,.-ffi_closure_unix64
 
+#ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE
+	.section	.eh_frame,"a",@unwind
+#else
 	.section	.eh_frame,"a",@progbits
+#endif
 .Lframe1:
 	.long	.LECIE1-.LSCIE1		/* CIE Length */
 .LSCIE1:



More information about the Gcc-patches mailing list