SEGMENT_START and -Ttext-segment
Ryan Mansfield
rmansfield@qnx.com
Tue Jun 4 21:03:00 GMT 2013
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
More information about the Binutils
mailing list