After upgrading from gcc-4.1.2-15 to gcc-4.1.2-16, the additional command line option --build-id is passed to ld via collect2 which may let ld crash with segmentation fault.
How to reproduce - Unpack the attached archive - Run ./crash-it.sh If the --build-id option is omitted, the output is built - Run ./build-it.sh
Created attachment 1963 [details] self-contained testcase
ld crashes at line 1065/1066 of emultempl/elf32.em t->after_write_object_contents = &gld${EMULATION_NAME}_write_build_id_section; since t becomes NULL and cannot be dereferenced. After applying the attached patch, ld no longer crashes. This is only to harden ld against this situation - the underlying mechanism that allows t to become NULL is not cured.
Created attachment 1964 [details] Patch to prevent NULL pointer to be dereferenced
All observations have been made on a Fedora 8 system, latest development packages installed. Current versions: binutils-2.17.50.0.17-7 gcc-4.1.2-17
http://sourceware.org/ml/binutils-cvs/2007-08/msg00103.html