]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gdb/testsuite/ChangeLog
execl-update-breakpoints.exp: Move whole segment instead of .text section
authorAndreas Arnez <arnez@linux.vnet.ibm.com>
Tue, 2 Dec 2014 15:35:47 +0000 (16:35 +0100)
committerAndreas Krebbel <krebbel@linux.vnet.ibm.com>
Tue, 2 Dec 2014 15:35:47 +0000 (16:35 +0100)
commitfdb09caf2386b09272df3cac6ec65be724ace3b9
treee98ceea7fd335ceb1fdaaeb93e740d9a874df150
parent538baf8b7e6d17a490f126f8565638469da70204
execl-update-breakpoints.exp: Move whole segment instead of .text section

The test case builds two copies of the program, one with the compile
option "ldflags=-Wl,-Ttext=0x1000000" and the other with the address
changed to 0x2000000.  However, when linking with ld.bfd, the
resulting executables crash early in ld.so on S390 and i386.

Analysis of the crash: The default linker script establishes a certain
order of loadable sections, and the option "-Ttext" effectively splits
these into an "unaffected" lot (everything before .text) and an
"affected" lot.  The affected lot is placed at the given address,
whereas the unaffected lot stays at its default address.  The
unaffected lot starts at an aligned address plus Elf header sizes,
which is good if it is the first LOAD segment (like on AMD64).  But if
the affected lot comes first instead (like on S390 and i386), the PHDR
doesn't fit there and is placed *outside* any LOAD segments.  Then the
PHDR is not mapped when the loader gets control, and the loader runs
into a segmentation fault while trying to access it.

Since we are lucky about the order of segments on AMD64, the test
succeeds there, but the resulting binaries are unusually large -- 2.1M
each, with lots of padding within.

When replacing '-Ttext' by '-Ttext-segment', the linker moves all
segments consistently, the binaries have normal sizes, and the test
case succeeds on all mentioned platforms.

Since old versions of the gold linker don't support '-Ttext-segment',
the patch also adds logic for falling back to '-Ttext'.

gdb/testsuite/ChangeLog:

* gdb.base/execl-update-breakpoints.exp: Specify the link address
with '-Ttext-segment' instead of '-Ttext'.  Fall back to '-Ttext'
if the linker doesn't understand this.
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.base/execl-update-breakpoints.exp