public inbox for java-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Properly mark 64-bit .eh_frame section on x86 as type unwind
@ 2010-02-24 14:10 Rainer Orth
  2010-03-15 18:55 ` Rainer Orth
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Orth @ 2010-02-24 14:10 UTC (permalink / raw)
  To: gcc-patches; +Cc: Anthony Green, java-patches

Several 64-bit libffi tests were failing on Solaris 11/x86:

Running target unix/-m64
FAIL: libffi.special/unwindtest.cc execution test
FAIL: libffi.special/unwindtest_ffi_call.cc execution test

Ultimately, the problem turned out to be due to libffi.so (and, as a
consequence, libgcj.so) having two .eh_frame sections:

$ elfdump -c -N.eh_frame libffi.so

Section Header[2]:  sh_name: .eh_frame
    sh_addr:      0x250               sh_flags:   [ SHF_ALLOC ]
    sh_size:      0x834               sh_type:    [ SHT_AMD64_UNWIND ]
    sh_offset:    0x250               sh_entsize: 0
    sh_link:      0                   sh_info:    0
    sh_addralign: 0x8               

Section Header[19]:  sh_name: .eh_frame
    sh_addr:      0x6d18              sh_flags:   [ SHF_ALLOC ]
    sh_size:      0x70                sh_type:    [ SHT_PROGBITS ]
    sh_offset:    0x6d18              sh_entsize: 0
    sh_link:      0                   sh_info:    0
    sh_addralign: 0x8               

This happens because the Sun ld doesn't merge sections with different
flags or types, and the .eh_frame section in src/x86/unix64.S is marked
@progbits instead of the correct @unwind.

Changing this caused the testcases above to pass, as well as several
libjava testcases that were affected, too.

The patch is trivial and works with both Sun as and gas 2.19, but I'd
first like to get confirmation that it works on the other x86_64
platforms (amd64-*-freebsd*, amd64-*-openbsd*, x86_64-*-darwin*,
x86_64-*-cygwin*, x86_64-*-mingw*), too, without needing some autoconf
test.  I'm not sure which of those uses gas (which should work) and
which doesn't (probably darwin).

Ok for mainline?

	Rainer

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


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

	* src/x86/unix64.S (.eh_frame): Mark as @unwind.

diff -r 8ef90ce89af5 -r 489f27ea21f7 libffi/src/x86/unix64.S
--- a/libffi/src/x86/unix64.S	Mon Feb 15 00:08:49 2010 +0100
+++ b/libffi/src/x86/unix64.S	Mon Feb 15 09:04:35 2010 +0100
@@ -324,7 +324,7 @@
 .LUW9:
 	.size	ffi_closure_unix64,.-ffi_closure_unix64
 
-	.section	.eh_frame,"a",@progbits
+	.section	.eh_frame,"a",@unwind
 .Lframe1:
 	.long	.LECIE1-.LSCIE1		/* CIE Length */
 .LSCIE1:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Properly mark 64-bit .eh_frame section on x86 as type unwind
  2010-02-24 14:10 PATCH: Properly mark 64-bit .eh_frame section on x86 as type unwind Rainer Orth
@ 2010-03-15 18:55 ` Rainer Orth
  2010-03-15 19:03   ` Anthony Green
  0 siblings, 1 reply; 3+ messages in thread
From: Rainer Orth @ 2010-03-15 18:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: Anthony Green, java-patches

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:

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Properly mark 64-bit .eh_frame section on x86 as type  unwind
  2010-03-15 18:55 ` Rainer Orth
@ 2010-03-15 19:03   ` Anthony Green
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony Green @ 2010-03-15 19:03 UTC (permalink / raw)
  To: Rainer Orth; +Cc: gcc-patches, java-patches

On 03/15/2010 02:55 PM, Rainer Orth wrote:
> 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
>
>   

Yes, thanks.

AG

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-03-15 19:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-24 14:10 PATCH: Properly mark 64-bit .eh_frame section on x86 as type unwind Rainer Orth
2010-03-15 18:55 ` Rainer Orth
2010-03-15 19:03   ` Anthony Green

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).