svn commit: r244600 - head/contrib/binutils/bfd
Dimitry Andric
dim at FreeBSD.org
Sat Dec 22 20:46:47 UTC 2012
Author: dim
Date: Sat Dec 22 20:46:46 2012
New Revision: 244600
URL: http://svnweb.freebsd.org/changeset/base/244600
Log:
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
Modified:
head/contrib/binutils/bfd/elflink.c
Modified: head/contrib/binutils/bfd/elflink.c
==============================================================================
--- head/contrib/binutils/bfd/elflink.c Sat Dec 22 20:35:45 2012 (r244599)
+++ head/contrib/binutils/bfd/elflink.c Sat Dec 22 20:46:46 2012 (r244600)
@@ -10584,6 +10584,7 @@ elf_gc_sweep (bfd *abfd, struct bfd_link
{
/* 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;
More information about the svn-src-head
mailing list