This is the mail archive of the
mailing list for the binutils project.
Re: ld --section-start prevents merging sections
On Fri, Nov 13, 2009 at 7:16 PM, Papalagi Pakeha
> On Sat, Nov 14, 2009 at 9:12 AM, Michael Hennebry
> <email@example.com> wrote:
>> On Fri, 13 Nov 2009, Papalagi Pakeha wrote:
>>> I put some functions of my program into a separate text section called
>>> .cryptext and I want to have this section start at a fixed address. To
>>> achieve that I should probably be using
>>> gcc -Wl,--section-start=.cryptext=0x12345678
>>> That works all right as long as .cryptext is only defined in a single
>>> object file. When there are functions in multiple object files placed
>>> in .cryptext then without -Wl,--section-start all the .cryptext
>>> sections are merged into a single one in the final binary, that's what
>>> I want. However with ?-Wl,--section-start created .cryptext,
>>> .cryptext.1, .cryptext.2, etc and only the first one is placed at the
>>> specified address.
>> The problem isn't --section-start .
>> The problem is that .cryptext is an orphan section,
>> i.e. one not mentioned in the linker script.
>> For whatever reason, the linker does that with orphan sections.
> But then .. how come the sections are properly merged when not using
> --section-start ?
It may be related to: