mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-06 12:09:26 +08:00
6057dc97e4
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.
13 lines
292 B
Plaintext
13 lines
292 B
Plaintext
SECTIONS
|
|
{
|
|
PROVIDE (__executable_start = SEGMENT_START ("text-segment", 0x10000000));
|
|
.text : { *(.text) }
|
|
.data : { *(.data) }
|
|
.bss : { *(.bss) }
|
|
.loader : { *(.loader) }
|
|
.symtab : { *(.symtab) }
|
|
.strtab : { *(.strtab) }
|
|
.shstrtab : { *(.shstrtab) }
|
|
/DISCARD/ : { *(*) }
|
|
}
|