Adding custom sections to default linker script

Jonas Maebe jonas.maebe@elis.ugent.be
Sun Aug 30 16:40:00 GMT 2015


On 30/08/15 15:21, Erik Christiansen wrote:
> For more powerful augmentation like yours, the "INSERT" command seems
> called for, and it does appear to need "-T", according to "info ld".
> Ld's complaint serves as confirmation, I'd hazard.

That command does indeed seem to do exactly what we need! Too bad it's
only supported in 2.19 and later. We've decided to add a command line
option to the compiler that allows users to target older versions of
binutils if necessary.

> Admittedly, I have not tried such obscurity, preferring one integral
> script, for better documentation. (And fewer surprises) My bent has long
> been to take a copy of the default linker script;
> 
> $ ld --verbose | gawk -- '/^===/ { show = 1 - show ; next } \
>   { if (show) print }' > link.res
> 
> edit it to satisfaction, then use -T. Result: No sassy remarks from ld.

Doing that inside the compiler itself is a little less trivial though,
especially in a future-proof way :)

Thanks for the suggestion!


Jonas



More information about the Binutils mailing list