http://sourceware.org/bugzilla/show_bug.cgi?id=14149
Bug #: 14149 Summary: The _end symbol is not properly aligned Product: binutils Version: 2.22 Status: NEW Severity: normal Priority: P2 Component: gold AssignedTo: i...@airs.com ReportedBy: j...@freebsd.org CC: ccout...@google.com Classification: Unclassified I have reproduced this with the gold linker from both 2.21 and 2.22. I have reproduced this using GCC versions 4.5.3, 4.6.4, and 4.7.0 on both FreeBSD 8.2-STABLE and 9.0-STABLE. To reproduce, compile the following test program and link with gold: #include <stdio.h> #include <new> void foo() { char *c = new(std::nothrow) char[10]; delete c; } int main() { printf("Hello world\n"); } Use objdump -T to obtain the offset of '_end': a.out: file format elf64-x86-64-freebsd DYNAMIC SYMBOL TABLE: 0000000000401ac8 g DO .bss 0000000000000008 Base environ 0000000000401a80 g DO .data 0000000000000008 Base __progname 0000000000000000 DF *UND* 0000000000000000 GLIBCXX_3.4 _ZnamRKSt9nothrow_t 0000000000000000 DF *UND* 0000000000000000 GLIBCXX_3.4 _ZdlPv 0000000000000000 DF *UND* 0000000000000000 FBSD_1.0 atexit 0000000000000000 DF *UND* 0000000000000000 FBSD_1.0 exit 0000000000000000 DF *UND* 0000000000000000 FBSD_1.0 _init_tls 0000000000000000 w D *UND* 0000000000000000 _Jv_RegisterClasses 0000000000401ad0 g DO .bss 0000000000000001 GLIBCXX_3.4 _ZSt7nothrow 0000000000000000 DF *UND* 0000000000000000 FBSD_1.0 puts 0000000000401ad1 g D *ABS* 0000000000000000 Base _end Note that _end has a mis-aligned address. This causes jemalloc (the malloc in FreeBSD's libc) to corrupt it's internal RB trees as it assumes the start of the heap is aligned on at least an even address. Using ld.bfd results in _end being aligned on an 8-byte boundary. The linker scripts for ld.bfd for FreeBSD explicitly pad _end to an 8 byte boundary, so I assume it is a bug for the gold linker to not do this. The bug appears to be triggered by std::nothrow pulling in a reference to a 1 byte symbol at the end of the BSS. -- Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org https://lists.gnu.org/mailman/listinfo/bug-binutils