Bug 4923 - ld exits with segmentation fault after upgrading from gcc-4.1.2-15 to gcc-4.1.2-16
Summary: ld exits with segmentation fault after upgrading from gcc-4.1.2-15 to gcc-4.1...
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.17
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-08-14 18:04 UTC by Carsten Emde
Modified: 2007-08-15 06:06 UTC (History)
1 user (show)

See Also:
Host: i386-redhat-linux
Target: i386-redhat-linux
Build: i386-redhat-linux
Last reconfirmed: 2007-08-15 01:34:20


Attachments
self-contained testcase (1.62 KB, application/octet-stream)
2007-08-14 18:17 UTC, Carsten Emde
Details
Patch to prevent NULL pointer to be dereferenced (382 bytes, patch)
2007-08-14 18:21 UTC, Carsten Emde
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carsten Emde 2007-08-14 18:04:26 UTC
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.
Comment 1 Carsten Emde 2007-08-14 18:15:48 UTC
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
Comment 2 Carsten Emde 2007-08-14 18:17:37 UTC
Created attachment 1963 [details]
self-contained testcase
Comment 3 Carsten Emde 2007-08-14 18:20:16 UTC
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.
Comment 4 Carsten Emde 2007-08-14 18:21:46 UTC
Created attachment 1964 [details]
Patch to prevent NULL pointer to be dereferenced
Comment 5 Carsten Emde 2007-08-14 19:45:54 UTC
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