KEEP sections without writing a complete linker script?

Dave Korn dave.korn.cygwin@gmail.com
Fri Jun 18 13:52:00 GMT 2010


On 18/06/2010 08:56, Tristan Gingold wrote:
> On Jun 17, 2010, at 7:54 PM, Lars Noschinski wrote:

>> But after re-reading the documentation, if found that the INSERT command
>> does exactly what I want:
>>
>> Using the script
>>
>> | SECTIONS
>> | {
>> |   .bootcall_trampoline :
>> |   {
>> |     KEEP(*(.bootcall_trampoline))
>> |   }
>> | }
>> | INSERT AFTER .text
>>
>> I may call the linker with "-T myscript.ld" and everything works as
>> expected.
> 
> Right, this seems indeed to be the best method.

  You guys are making my head hurt!  How is that supposed to work, when -T
"replaces `ld''s default linker script (rather than adding to it)"?  What is
there to INSERT AFTER if you use -T?

  As far as I understand you don't want to use any option at all.  Just pass
the name of the script fragment on the command-line (regardless whether passed
via gcc or invoking ld directly) and it gets appended to the default script.

    cheers,
      DaveK



More information about the Binutils mailing list