[hjl@gnu-6 ld]$ cat /export/gnu/import/git/binutils/ld/testsuite/ld-elf/tdata3s s .globl main .globl start .globl _start .globl __start .text main: start: _start: __start: .byte 0 .section .tdata,"awT",%progbits .type tdata,%object .size tdata,1 tdata: .byte 17 .section .tbss,"awT",%nobits .p2align 10 .type tbss, %object .size tbss, 1024 tbss: .zero 1024 [hjl@gnu-6 ld]$ /export/build/gnu/binutils/build-x86_64-linux/ld/../gas/as-new -o tmpdir/tdata3.o /export/gnu/import/git/binutils/ld/testsuite/ld-elf/tdata3.s [hjl@gnu-6 ld]$ ld.gold -o tmpdir/tdata3 -z relro tmpdir/tdata3.o ld.gold: internal error in set_offset, at /net/gnu-6/export/linux/src/binutils/binutils/gold/output.cc:4567 [hjl@gnu-6 ld]$
*** Bug 15449 has been marked as a duplicate of this bug. ***
The master branch has been updated by Cary Coutant <ccoutant@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=bccffdfdf268a84533131d6e4d6208f9873892ee commit bccffdfdf268a84533131d6e4d6208f9873892ee Author: Cary Coutant <ccoutant@gmail.com> Date: Sat Mar 21 22:30:44 2015 -0700 Fix internal error with -z relro when .tbss is last relro section. When calculating the padding necessary to align the end of the relro segment to a page boundary, gold erroneously ignores the .tdata section when checking to see if there are any relro sections (so if .tdata is the only relro section, we fail to align the segment properly), and erroneously pads the cumulative size of the segment based on the alignment of .tbss. If there are no relro sections following .tbss, it then fails to note the padding needed at the end of .tdata. This patch fixes both problems. is_first_section_relro() will return true when it sees a .tdata section, and we do not align the cumulative size until after checking for the .tbss section. gold/ PR gold/14217 * output.cc (Output_segment::is_first_section_relro): Don't ignore .tdata section. (Output_segment::set_section_addresses): Don't align size of relro segment for .tbss.
Fixed on trunk.