Bug 33100 - [4.3/4.4 regression] on bootstrap getting section .eh_frame: bad cie version 0: offset 0x0
Summary: [4.3/4.4 regression] on bootstrap getting section .eh_frame: bad cie version ...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: bootstrap (show other bugs)
Version: 4.3.0
: P5 normal
Target Milestone: 4.3.3
Assignee: Rainer Orth
URL:
Keywords:
: 36330 36356 36496 (view as bug list)
Depends on:
Blocks:
 
Reported: 2007-08-17 20:58 UTC by Brett Albertson
Modified: 2011-07-18 17:45 UTC (History)
9 users (show)

See Also:
Host: i386-pc-solaris2.11
Target: i386-pc-solaris2.11
Build: i386-pc-solaris2.11
Known to work:
Known to fail:
Last reconfirmed: 2008-11-06 15:44:47


Attachments
crtend.s without -fno-asynchronous-unwind-tables (761 bytes, text/plain)
2007-09-11 12:46 UTC, Rainer Orth
Details
crtend.s with -fno-asynchronous-unwind-tables (482 bytes, text/plain)
2007-09-11 12:47 UTC, Rainer Orth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brett Albertson 2007-08-17 20:58:45 UTC
I now get this during bootstrap on Solaris x86 using the native linker (/usr/ccs/bin/ld):

ld: fatal: unwind table: file /u01/var/tmp/gcc_trunk_svn/gcc_20070817/./gcc/amd64/crtend.o: section .eh_frame: bad cie version 0: offset 0x0

collect2: ld returned 1 exit status
gmake[5]: *** [libgcc_s.so] Error 1
gmake[5]: Leaving directory `/u01/var/tmp/gcc_trunk_svn/gcc_20070817/i386-pc-solaris2.11/amd64/libgcc'

Let me know if you need more information.  It seems to occur when linking the 64bit libgcc.

Brett Albertson
Comment 1 Rainer Orth 2007-09-04 18:10:16 UTC
Confirmed on i386-pc-solaris2.10.  This is a mainline regression.  A reghunt revealed that this patch

2007-08-06  H.J. Lu  <hongjiu.lu@intel.com>
	    Daniel Jacobowitz  <dan@codesourcery.com>

	PR target/31868
	* config.gcc (x86_64-*-freebsd*): Add i386/t-crtstuff to
	tmake_file.
	(x86_64-*-netbsd*): Likewise.
	(x86_64-*-linux*): Likewise.
	(x86_64-*-kfreebsd*-gnu): Likewise.
	(x86_64-*-knetbsd*-gnu): Likewise.
	(i[34567]86-*-solaris2.1[0-9]*): Likewise.

is the culprit: running elfdump on the amd64 crtend.o before and after the patch, I find (before):

Unwind Section: .eh_frame
CIE: [0x00000000]
 length: 0x00 cieid: 0
 version: 0  augstring: `'
 codealign: 0x0  dataalign: 0  retaddr: 0

vs. (after):

Unwind Section: .eh_frame
 FDE: [0x00000000]
    length: 0x00  cieptr: 0x18
    initloc: 0x00000000  addrrange: 0x0000
   Auxiliary vals:
CIE: [0x00000004]
 length: 0x18 cieid: 0
 version: 1  augstring: `zR'
 codealign: 0x1  dataalign: -8  retaddr: 16

So the linker seems to be right to complain about this.

  Rainer
Comment 2 H.J. Lu 2007-09-06 03:21:27 UTC
As indicated in

http://gcc.gnu.org/ml/gcc-patches/2007-08/msg00512.html

there is at least one person has bootstrapped gcc successfully on
i386-pc-solaris2.10.
Comment 3 Brett Albertson 2007-09-06 13:03:43 UTC
(In reply to comment #2)

Something changed and it is now working for me, but this did exist on mainline for at least some period of time.  Rainer, are you still seeing this behavior?

Brett

Comment 4 Rainer Orth 2007-09-06 13:25:28 UTC
Subject: Re:  [4.3 regression] on bootstrap getting section .eh_frame: bad cie version 0: offset 0x0

brett dot albertson at stratech dot com writes:

> Something changed and it is now working for me, but this did exist on mainline
> for at least some period of time.  Rainer, are you still seeing this behavior?

I haven't tried a newer tree (> 20070903) yet.  A difference might be that
Art uses GNU ld (he doesn't state so, though) while Brett and I use Sun ld.

	Rainer
Comment 5 H.J. Lu 2007-09-06 17:47:32 UTC
It could be caused by bugs in assembler/linker on Solaris.
Comment 6 Rainer Orth 2007-09-10 14:41:07 UTC
Subject: Re:  [4.3 regression] on bootstrap getting section .eh_frame: bad cie version 0: offset 0x0

hjl at lucon dot org writes:

> It could be caused by bugs in assembler/linker on Solaris.

The assembler in question is gas 2.15, and the linker check seems to be
completely deliberate.  The error is issued by libld, whose source can be
browsed at opensolaris.org:

http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/sgs/libld/common/unwind.amd.c

around line 396.  The old crtend.o had CIE version 1 as expected, the new
one has version 0.

	Rainer
Comment 7 H.J. Lu 2007-09-11 12:24:02 UTC
Binutils 2.15 is very old. Can you try binutils 2.18?
Comment 8 Rainer Orth 2007-09-11 12:46:24 UTC
Created attachment 14188 [details]
crtend.s without -fno-asynchronous-unwind-tables
Comment 9 Rainer Orth 2007-09-11 12:47:22 UTC
Created attachment 14189 [details]
crtend.s with -fno-asynchronous-unwind-tables
Comment 10 Rainer Orth 2007-09-11 12:48:12 UTC
Subject: Re:  [4.3 regression] on bootstrap getting section .eh_frame: bad cie version 0: offset 0x0

hjl at lucon dot org writes:

> Binutils 2.15 is very old. Can you try binutils 2.18?

It doesn't make a difference: although the object files are not completely
identical, the problematic .eh_frame section stays the same.

I've uploaded the output with -save-temps before and after adding
-fno-asynchronous-unwind-tables.  The after version contains the empty
.eh_frame section with cie version 0 which causes ld to complain.

	Rainer
Comment 11 H.J. Lu 2007-09-11 13:43:41 UTC
.eh_frame section in the new crtend.S only has 4 byte:

  [ 7] .eh_frame         X86_64_UNWIND    0000000000000000  000000b8
       0000000000000004  0000000000000000   A       0     0     4

which is the zero terminator:

bash-3.2$ readelf -wf crtend.o 
The section .eh_frame contains:

00000000 ZERO terminator

bash-3.2$

Sun linker doesn't properly handle ZERO terminator in .eh_frame. It looks
like a Sun linker bug to me.

BTW, did your elfdump report

vs. (after):

Unwind Section: .eh_frame
 FDE: [0x00000000]
    length: 0x00  cieptr: 0x18
    initloc: 0x00000000  addrrange: 0x0000
   Auxiliary vals:
CIE: [0x00000004]
 length: 0x18 cieid: 0
 version: 1  augstring: `zR'
 codealign: 0x1  dataalign: -8  retaddr: 16

It doesn't look like .eh_frame in the new crtend.o at all. That may be
a bug in your elfdump.

Comment 12 Jesus Cea 2008-03-14 21:27:42 UTC
Bug hit trying to compile GCC 4.3.0 using SUN ld. If I use the gnu ld (2.18), compiler builds fine, but then I have problems with tools like gdb and such, specially with shared libraries. So, no luck.

Post a link to this bug to OpenSolaris linking mailing list.
Comment 13 Joseph S. Myers 2008-03-15 00:41:49 UTC
Update milestone after 4.3.0 release.
Comment 14 Daniel Davies 2008-05-22 03:14:51 UTC
Bug also hit when installing 4.2.4.
Comment 15 littlestar 2008-05-29 02:30:07 UTC
i386-pc-solaris2.10 has the same problem.
Comment 16 Richard Biener 2008-06-06 14:57:53 UTC
4.3.1 is being released, adjusting target milestone.
Comment 17 The Written Word 2008-06-09 16:23:23 UTC
This bug is fixed in opensolaris:  http://bugs.opensolaris.org/bugdatabase/view_bug.do?bug_id=6685125
Fixed in revision 6388: http://cvs.opensolaris.org/source/search?q=&defs=&refs=&path=&hist=6388&project=%2Fonnv

We have filed case #65952072 with Sun to get this backported to Solaris 10.
Comment 18 H.J. Lu 2008-06-11 14:41:25 UTC
*** Bug 36496 has been marked as a duplicate of this bug. ***
Comment 19 littlestar 2008-07-18 03:37:46 UTC
ping...

gcc 4.2.3 works well, gcc 4.2.4/4.3.0/4.3.1 works failed.

i386-pc-solaris2.10
gas 2.18 + sun ld 
Comment 20 Joseph S. Myers 2008-08-27 22:02:37 UTC
4.3.2 is released, changing milestones to 4.3.3.
Comment 21 Rainer Orth 2008-10-08 17:20:12 UTC
Subject: Re:  [4.3/4.4 regression] on bootstrap getting section .eh_frame: bad cie version 0: offset 0x0

FTR: I've long been using this patch as a workaround until the neccessary
Sun ld patch is available:

Index: gcc/config.gcc
===================================================================
--- gcc/config.gcc	(revision 140759)
+++ gcc/config.gcc	(working copy)
@@ -1205,7 +1205,10 @@ i[34567]86-*-solaris2*)
 	*-*-solaris2.1[0-9]*)
 		tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h"
 		tm_defines="${tm_defines} TARGET_BI_ARCH=1"
-		tmake_file="$tmake_file i386/t-crtstuff i386/t-sol2-10"
+		tmake_file="$tmake_file i386/t-sol2-10"
+		if test x$gnu_ld = xyes; then
+			tmake_file="$tmake_file i386/t-crtstuff"
+		fi
 		need_64bit_hwint=yes
 		case X"${with_cpu}" in
 		Xgeneric|Xcore2|Xnocona|Xx86-64|Xamdfam10|Xbarcelona|Xk8|Xopteron|Xathlon64|Xathlon-fx)
Comment 22 Eric Botcazou 2008-10-08 17:22:58 UTC
> FTR: I've long been using this patch as a workaround until the neccessary
> Sun ld patch is available:

Ah, this is helpful, thanks.
Comment 23 littlestar 2008-10-09 07:16:30 UTC
to Rainer Orth.
when apply your patch on gcc 4.3.2 release, cause PR37777.
Comment 24 littlestar 2008-10-09 11:00:51 UTC
works ok on gcc 4.3.2

--- config.gcc.4.3.2.old    Thu Oct  9 18:51:26 2008
+++ config.gcc.4.3.2.new    Thu Oct  9 18:51:26 2008
@@ -1289,7 +1289,7 @@
        *-*-solaris2.1[0-9]*)
                tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h"
                tm_defines="${tm_defines} TARGET_BI_ARCH=1"
-               tmake_file="$tmake_file i386/t-crtstuff i386/t-sol2-10"
+               tmake_file="$tmake_file i386/t-sol2-10"
                need_64bit_hwint=yes
                # FIXME: -m64 for i[34567]86-*-* should be allowed just
                # like -m32 for x86_64-*-*.
Comment 25 Eric Botcazou 2008-10-09 11:22:47 UTC
> to Rainer Orth.
> when apply your patch on gcc 4.3.2 release, cause PR37777.

Are you really sure?  Please retry and close the PR otherwise.
Comment 26 Eric Botcazou 2008-10-09 17:35:08 UTC
> We have filed case #65952072 with Sun to get this backported to Solaris 10.

Do you have any news about this?
Comment 27 littlestar 2008-10-10 00:42:32 UTC
works well on gcc 4.3.2 + patch.
I don't build libgcc_s.so.
gas 2.18 + gmp 4.2.4 + mpfr 2.3.2.

Configured with: ../src/configure --prefix=/opt/gcc-4.3.2 --with-gmp=/opt/gcc-4.3.2 --with-mpfr=/opt/gcc-4.3.2 --with-as=/usr/local/bin/as --with-gnu-as --with-ld=/usr/ccs/bin/ld --without-gnu-ld --enable-languages=c,c++ --disable-shared --disable-nls --with-cpu=generic --build=i386-pc-solaris2.10

--- config.gcc.4.3.2.old    Thu Oct  9 18:51:26 2008
+++ config.gcc.4.3.2.new    Thu Oct  9 18:51:26 2008
@@ -1289,7 +1289,7 @@
        *-*-solaris2.1[0-9]*)
                tm_file="${tm_file} i386/x86-64.h i386/sol2-10.h"
                tm_defines="${tm_defines} TARGET_BI_ARCH=1"
-               tmake_file="$tmake_file i386/t-crtstuff i386/t-sol2-10"
+               tmake_file="$tmake_file i386/t-sol2-10"
                need_64bit_hwint=yes
                # FIXME: -m64 for i[34567]86-*-* should be allowed just
                # like -m32 for x86_64-*-*.
Comment 28 Eric Botcazou 2008-10-10 05:14:54 UTC
> works well on gcc 4.3.2 + patch.

Thanks but this patch is not suitable for the branch, only Rainer's is.  And
you didn't say whether you can reproduce PR 37777 so I'm closing it.
Comment 29 Rainer Orth 2008-10-10 14:41:19 UTC
Subject: Re:  [4.3/4.4 regression] on bootstrap getting section .eh_frame: bad cie version 0: offset 0x0

I've just formally submitted my patch

	http://gcc.gnu.org/ml/gcc-patches/2008-10/msg00441.html

with some suggestions how a complete fix would look like if necessary.

	Rainer
Comment 30 Rainer Orth 2008-11-06 15:43:28 UTC
Subject: Bug 33100

Author: ro
Date: Thu Nov  6 15:41:52 2008
New Revision: 141647

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=141647
Log:
	PR bootstrap/33100
	* config.gcc (i[34567]86-*-solaris2*): Include i386/t-crtstuff
	only with GNU ld.

Modified:
    branches/gcc-4_2-branch/gcc/ChangeLog
    branches/gcc-4_2-branch/gcc/config.gcc

Comment 31 Rainer Orth 2008-11-06 15:45:12 UTC
Subject: Re:  [4.3/4.4 regression] on bootstrap getting section .eh_frame: bad cie version 0: offset 0x0

Fixed for 4.2.5.
Comment 32 Rainer Orth 2008-11-20 17:11:26 UTC
Subject: Bug 33100

Author: ro
Date: Thu Nov 20 17:09:53 2008
New Revision: 142049

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142049
Log:
	gcc:
	PR bootstrap/33100
	* config.gcc (i[34567]86-*-solaris2*): Don't include
	i386/t-crtstuff here.
	Move extra_parts, i386/t-sol2 in tmake_file to libgcc/config.host.
	* config/i386/t-sol2: Move to libgcc/config/i386.
	
	libgcc:
	PR bootstrap/33100
	* configure.ac (i?86-*-solaris2.1[0-9]*): Only include
	i386/t-crtstuff if linker supports ZERO terminator unwind entries.
	* configure: Regenerate.
	* config.host (i[34567]86-*-solaris2*): Move i386/t-sol2 in
	tmake_file here from gcc/config.gcc.
	Move extra_parts here from gcc/config.gcc.
	* config/i386/t-sol2: Move here from gcc/config/i386.
	Use gcc_srcdir instead of srcdir.

Added:
    branches/gcc-4_3-branch/libgcc/config/i386/t-sol2
      - copied, changed from r142012, branches/gcc-4_3-branch/gcc/config/i386/t-sol2
Removed:
    branches/gcc-4_3-branch/gcc/config/i386/t-sol2
Modified:
    branches/gcc-4_3-branch/gcc/ChangeLog
    branches/gcc-4_3-branch/gcc/config.gcc
    branches/gcc-4_3-branch/libgcc/ChangeLog
    branches/gcc-4_3-branch/libgcc/config.host
    branches/gcc-4_3-branch/libgcc/configure
    branches/gcc-4_3-branch/libgcc/configure.ac

Comment 33 Rainer Orth 2008-11-20 17:14:33 UTC
Subject: Bug 33100

Author: ro
Date: Thu Nov 20 17:13:01 2008
New Revision: 142050

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142050
Log:
	gcc:
	PR bootstrap/33100
	* config.gcc (i[34567]86-*-solaris2*): Don't include
	i386/t-crtstuff here.
	Move extra_parts, i386/t-sol2 in tmake_file to libgcc/config.host.
	* config/i386/t-sol2: Move to libgcc/config/i386.
	
	libgcc:
	PR bootstrap/33100
	* configure.ac (i?86-*-solaris2.1[0-9]*): Only include
	i386/t-crtstuff if linker supports ZERO terminator unwind entries.
	* configure: Regenerate.
	* config.host (i[34567]86-*-solaris2*): Move i386/t-sol2 in
	tmake_file here from gcc/config.gcc.
	Move extra_parts here from gcc/config.gcc.
	* config/i386/t-sol2: Move here from gcc/config/i386.
	Use gcc_srcdir instead of srcdir.

Added:
    trunk/libgcc/config/i386/t-sol2
      - copied, changed from r142008, trunk/gcc/config/i386/t-sol2
Removed:
    trunk/gcc/config/i386/t-sol2
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/config.gcc
    trunk/libgcc/ChangeLog
    trunk/libgcc/config.host
    trunk/libgcc/configure
    trunk/libgcc/configure.ac

Comment 34 Rainer Orth 2008-11-20 17:14:49 UTC
Subject: Re:  [4.3/4.4 regression] on bootstrap getting section .eh_frame: bad cie version 0: offset 0x0

Fixed for 4.3.3, 4.4.0:

	http://gcc.gnu.org/ml/gcc-patches/2008-11/msg00990.html
Comment 35 Rainer Orth 2008-11-20 17:33:46 UTC
Fixed for all active release branches.
Comment 36 The Written Word 2009-02-11 19:03:42 UTC
(In reply to comment #26)
> > We have filed case #65952072 with Sun to get this backported to Solaris 10.
> 
> Do you have any news about this?

Sun just released patch 139574-03 for SPARC and 139575-03 for x86. We've built gcc-4.2.4 with the x86 patch and it resolved the issue for us.
Comment 37 Rainer Orth 2011-07-18 17:38:13 UTC
*** Bug 36356 has been marked as a duplicate of this bug. ***
Comment 38 Rainer Orth 2011-07-18 17:45:29 UTC
*** Bug 36330 has been marked as a duplicate of this bug. ***