bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/13947] Strip applied twice corrupts binaries compiled with --emi


From: binutils-bugs at qult dot net
Subject: [Bug ld/13947] Strip applied twice corrupts binaries compiled with --emit-relocs
Date: Wed, 11 Apr 2012 11:40:52 +0000

http://sourceware.org/bugzilla/show_bug.cgi?id=13947

--- Comment #6 from Ignacy Gawędzki <binutils-bugs at qult dot net> 2012-04-11 
11:40:52 UTC ---
(In reply to comment #5)
> (In reply to comment #4)
> > (In reply to comment #3)
> > > Created attachment 6333 [details]
> > > A patch
> > 
> > I just tried this patch and it doesn't seem to fix anything.  I rebuilt all 
> > of
> > binutils after applying it, rebuild a binary with --emit-relocs using ld 
> > from
> > the newly rebuilt binutils and then used the new strip binary.
> 
> strip is OK.  It is a linker bug.  You need to use the new linker to
> create the executable.

As I said, I tried to link with the ld from the newly rebuilt binutils.  To
this end, I first created the object file using gcc -c and then looked at the
output of gcc -Wl,--emit-relocs -v to know what arguments it passes to
collect2.  I used the same arguments with the freshly built ld-new binary in
the ld/ subdirectory (just changed the path to the object file) to produce the
executable.

Now I can apply strip once and twice, but the third time it fails with:

BFD: stTayZcg: section `.ctors' can't be allocated in segment 3
LOAD: .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
BFD: stTayZcg: section `.dtors' can't be allocated in segment 3
LOAD: .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
BFD: stTayZcg: section `.jcr' can't be allocated in segment 3
LOAD: .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
BFD: stTayZcg: section `.dynamic' can't be allocated in segment 3
LOAD: .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
BFD: stTayZcg: section `.got' can't be allocated in segment 3
LOAD: .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
BFD: stTayZcg: section `.got.plt' can't be allocated in segment 3
LOAD: .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
BFD: stTayZcg: section `.data' can't be allocated in segment 3
LOAD: .ctors .dtors .jcr .dynamic .got .got.plt .data .bss
BFD: stTayZcg: section `.bss' can't be allocated in segment 3
LOAD: .ctors .dtors .jcr .dynamic .got .got.plt .data .bss

and the generated binary segfaults.

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]