[Bug ld/13287] New: g++ -Wl,--as-needed -flto doesn't work with the BFD linker, but with gold

2011-10-12 Thread doko at debian dot org
http://sourceware.org/bugzilla/show_bug.cgi?id=13287

 Bug #: 13287
   Summary: g++ -Wl,--as-needed -flto doesn't work with the BFD
linker, but with gold
   Product: binutils
   Version: 2.22
Status: NEW
  Severity: normal
  Priority: P2
 Component: ld
AssignedTo: unassig...@sourceware.org
ReportedBy: d...@debian.org
Classification: Unclassified


seen with the 2.22 branch (and the fix for pr13250 applied), works with gold,
gcc is 4.6 from the branch.


$ cat foo.cc 
int main() {}

$ g++ -B/usr/lib/gold-ld/ -Wl,--as-needed -flto foo.cc
ok

$ $ gcc -Wl,--as-needed -flto foo.cc
ok

$ $ g++ -Wl,--as-needed -flto foo.cc
/lib/i386-linux-gnu/libc.so.6: undefined reference to `_dl_argv@GLIBC_PRIVATE'
/lib/i386-linux-gnu/libc.so.6: undefined reference to
`__libc_stack_end@GLIBC_2.1'
/lib/i386-linux-gnu/libc.so.6: undefined reference to
`__libc_enable_secure@GLIBC_PRIVATE'
/lib/i386-linux-gnu/libc.so.6: undefined reference to
`_rtld_global@GLIBC_PRIVATE'
/lib/i386-linux-gnu/libc.so.6: undefined reference to
`___tls_get_addr@GLIBC_2.3'
/lib/i386-linux-gnu/libc.so.6: undefined reference to
`_rtld_global_ro@GLIBC_PRIVATE'
collect2: ld returned 1 exit status

-- 
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.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/13290] New: gold crashes when relinking a truncated object

2011-10-12 Thread zub at linux dot fjfi.cvut.cz
http://sourceware.org/bugzilla/show_bug.cgi?id=13290

 Bug #: 13290
   Summary: gold crashes when relinking a truncated object
   Product: binutils
   Version: 2.23 (HEAD)
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
AssignedTo: i...@airs.com
ReportedBy: z...@linux.fjfi.cvut.cz
CC: ccout...@google.com
Classification: Unclassified
  Host: x86_64-linux-gnu
Target: x86_64-linux-gnu


Created attachment 5981
  -- http://sourceware.org/bugzilla/attachment.cgi?id=5981
Archive with the particular objects used to reproduce this.

Trying to relink a truncated object (removed last byte) with gold results in
crash:

$ ld.gold -r -o test.o elfsection.cc.o elfstrtab.cc-corrupted.o
ld.gold: error: elfstrtab.cc-corrupted.o: section name section has wrong type:
1686719741
Segmentation fault

Here is what I see with gdb:

Program received signal SIGSEGV, Segmentation fault.

#0  0x7711e89b in memchr () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x77125b8a in memmem () from /lib/x86_64-linux-gnu/libc.so.6
#2  0x005173ff in gold::Sized_relobj_file64, false::do_read_symbols
(this=0x958820, sd=0x958b00) at object.cc:611
#3  0x0057aef2 in read_symbols (sd=0x958b00, this=0x958820) at
object.h:563
#4  gold::Read_symbols::do_read_symbols (this=0x8e39d0,
workqueue=0x7fffe110) at readsyms.cc:399
#5  0x0057b1d9 in gold::Read_symbols::run (this=0x8e39d0,
workqueue=0x7fffe110) at readsyms.cc:165
#6  0x005c84b5 in gold::Workqueue::find_and_run_task
(this=0x7fffe110, thread_number=0) at workqueue.cc:319
#7  0x005c87fa in gold::Workqueue::process (this=0x7fffe110,
thread_number=0) at workqueue.cc:495
#8  0x00406a31 in main (argc=6, argv=0x7fffe338) at main.cc:248


With ld.bfd I get the expected:
$ ld.bfd -r -o test.o elfsection.cc.o elfstrtab.cc-corrupted.o
elfstrtab.cc-corrupted.o: file not recognized: File truncated


The underlying cause might be the same as for bug #13288, but as the
manifestation is quite different, I'm creating a separate issue for this.

Note that the crash also happens when instead of relinking, the whole set of
the compiled objects is linked together to produce the application executable
(if needed, the sources I used to reproduce this issue are available at
git://zub.lamer.la/elf-dynpatch).

-- 
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.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/13288] gold silently accepts truncated ELF input

2011-10-12 Thread ccoutant at google dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=13288

Cary Coutant ccoutant at google dot com changed:

   What|Removed |Added

 Status|NEW |ASSIGNED
 AssignedTo|ian at airs dot com |ccoutant at google dot com

--- Comment #2 from Cary Coutant ccoutant at google dot com 2011-10-12 
23:32:58 UTC ---
Patch posted for review:

http://sourceware.org/ml/binutils/2011-10/msg00093.html

-- 
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.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils