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]

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


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:


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