This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
SEGMENT_START and -Ttext-segment
- From: Ryan Mansfield <rmansfield at qnx dot com>
- To: <binutils at sourceware dot org>
- Date: Tue, 4 Jun 2013 17:03:06 -0400
- Subject: SEGMENT_START and -Ttext-segment
Is it the intended behaviour that -Ttext-segment must precede the linker
script option for it to override the default of SEGMENT_START specified
in the linker script? Dumping the default linker script, and changing
the options order shows that order does matter, but the docs say it's
override by the -T option. "If an explicit value has been given for this
segment (with a command-line `-T' option) that value will be returned;
otherwise the value will be default. "
e.g.
$ grep SEGMENT_START t.link
PROVIDE (__executable_start = SEGMENT_START("text-segment",
0x400000)); . = SEGMENT_START("text-segment", 0x400000) + SIZEOF_HEADERS;
$ ld hw.o -Tt.link -Ttext-segment=0x0000000000800000
$ readelf -l a.out | grep LOAD
LOAD 0x0000000000000000 0x0000000000400000 0x0000000000400000
LOAD 0x0000000000000240 0x0000000000600240 0x0000000000600240
$ ld hw.o -Ttext-segment=0x0000000000800000 -Tt.link
$ readelf -l a.out | grep LOAD
LOAD 0x0000000000000000 0x0000000000800000 0x0000000000800000
LOAD 0x0000000000000240 0x0000000000a00240 0x0000000000a00240
Regards,
Ryan Mansfield