diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2012-12-22 20:46:46 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2012-12-22 20:46:46 +0000 |
commit | 64ea2f800e53d25242d8fb1bfcbcbc249c6303ec (patch) | |
tree | 0aa7c53f6d0be4611100a81fb09cd025be7ff9a3 | |
parent | d1ff5f1ee2d0222c80f14a813efb8c71ee25bef4 (diff) | |
download | src-64ea2f800e53d25242d8fb1bfcbcbc249c6303ec.tar.gz src-64ea2f800e53d25242d8fb1bfcbcbc249c6303ec.zip |
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
Notes
Notes:
svn path=/head/; revision=244600
-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 331ae4fcf625..44973febfa83 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; |