diff options
author | Maciej W. Rozycki <macro@mips.com> | 2018-09-14 20:22:56 +0100 |
---|---|---|
committer | Maciej W. Rozycki <macro@linux-mips.org> | 2018-09-14 20:22:56 +0100 |
commit | 6057dc97e4df5ca9692ddd948798eaa543c74cc7 (patch) | |
tree | 4ac5b59f61ba9a6cb89a0aca6b5a344e24de2550 /ld/testsuite/ld-scripts/script.exp | |
parent | a000f8817b32eadd4aeadf9185634350a59e6649 (diff) | |
download | binutils-gdb-6057dc97e4df5ca9692ddd948798eaa543c74cc7.tar.gz |
LD: Always make a SEGMENT_START expression section-relative
Fix an issue with the SEGMENT_START builtin function where its result is
absolute when taken from the default supplied, and section-relative when
taken from a `-T' command-line override. This is against documentation,
inconsistent and unexpected, and with PIE executables gives an incorrect
result with the `__executable_start' symbol.
Make the result of SEGMENT_START always section-relative then.
ld/
* ldexp.c (fold_binary): Always make the result of SEGMENT_START
section-relative.
* testsuite/ld-scripts/segment-start.d: New test.
* testsuite/ld-scripts/segment-start.ld: New test linker script.
* testsuite/ld-scripts/segment-start.s: New test source.
* testsuite/ld-scripts/script.exp: Run the new test.
Diffstat (limited to 'ld/testsuite/ld-scripts/script.exp')
-rw-r--r-- | ld/testsuite/ld-scripts/script.exp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ld/testsuite/ld-scripts/script.exp b/ld/testsuite/ld-scripts/script.exp index 4b781d4d386..6663633627f 100644 --- a/ld/testsuite/ld-scripts/script.exp +++ b/ld/testsuite/ld-scripts/script.exp @@ -231,3 +231,7 @@ foreach test_script $test_script_list { run_dump_test "align-with-input" run_dump_test "pr20302" + +run_dump_test "segment-start" {{name (default)}} +run_dump_test "segment-start" {{name (overridden)} \ + {ld -Ttext-segment=0x10000000}} |