I have been using a command similar to the following to print ld's default linker script. When using binutils 2.19.51.20090805 in the current version of Ubuntu karmic, the linker script gets truncated and gcc prints a warning about a segmentation fault (which does not cause gcc to return a non-zero exit code). $ gcc -static -nostartfiles -nostdlib /usr/lib/libc.a -Wl,-z,noexecstack -Wl,--verbose collect2: ld terminated with signal 11 [Segmentation fault] GNU ld (GNU Binutils for Ubuntu) 2.19.51.20090805 Supported emulations: elf_x86_64 elf_i386 i386linux elf_l1om using internal linker script: ================================================== ... Note that this has to be run in a writable current working directory to reproduce the problem, because it tries to write an "a.out" file. The segfault can be reproduced with this more minimal invocation of ld: $ ld --build-id /usr/lib/libc.a Segmentation fault $ dpkg -s binutils | grep Version Version: 2.19.51.20090805-1ubuntu1
Created attachment 4148 [details] Do not seg-fault creating a build-id section when there are no input files.
Hi Mark, Please could you try out the uploaded patch and let me know if it works for you. Cheers Nick
Yes, that patch works for me. Thanks.
Subject: Bug 10555 CVSROOT: /cvs/src Module name: src Changes by: nickc@sourceware.org 2009-08-26 13:08:07 Modified files: ld : ChangeLog ld/emultempl : elf32.em Log message: PR ld/10555 * emultempl/elf32.em (_after_open): Do not create a .note.gnu-build-id section if there are no input files. Patches: http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/ld/ChangeLog.diff?cvsroot=src&r1=1.2029&r2=1.2030 http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/ld/emultempl/elf32.em.diff?cvsroot=src&r1=1.198&r2=1.199
Hi Mark, Great - I have checked the patch in. Cheers Nick ld/ChangeLog PR ld/10555 * emultempl/elf32.em (_after_open): Do not create a .note.gnu-build-id section if there are no input files.