diff options
author | dim <dim@FreeBSD.org> | 2012-12-22 20:46:46 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-22 20:46:46 +0000 |
commit | bd7fa04386684b39c7cda73d48e935ae94177f13 (patch) | |
tree | 0aa7c53f6d0be4611100a81fb09cd025be7ff9a3 | |
parent | de145fce99c455d8d88617c0033a9e632285a4be (diff) | |
download | FreeBSD-src-bd7fa04386684b39c7cda73d48e935ae94177f13.zip FreeBSD-src-bd7fa04386684b39c7cda73d48e935ae94177f13.tar.gz |
Fix a bug in ld --gc-sections: it strips out .note sections, while it
should never do so. This can cause global constructors and destructors
to not be executed at run-time, resulting in crashes and other strange
behaviour.
Reported by: rene
MFC after: 1 week
-rw-r--r-- | contrib/binutils/bfd/elflink.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/contrib/binutils/bfd/elflink.c b/contrib/binutils/bfd/elflink.c index 331ae4f..44973fe 100644 --- a/contrib/binutils/bfd/elflink.c +++ b/contrib/binutils/bfd/elflink.c @@ -10584,6 +10584,7 @@ elf_gc_sweep (bfd *abfd, struct bfd_link_info *info) { /* Keep debug and special sections. */ if ((o->flags & (SEC_DEBUGGING | SEC_LINKER_CREATED)) != 0 + || elf_section_data (o)->this_hdr.sh_type == SHT_NOTE || (o->flags & (SEC_ALLOC | SEC_LOAD | SEC_RELOC)) == 0) o->gc_mark = 1; |