Adding custom sections to default linker script
Erik Christiansen
dvalin@internode.on.net
Mon Aug 31 09:51:00 GMT 2015
On 30.08.15 18:40, Jonas Maebe wrote:
> On 30/08/15 15:21, Erik Christiansen wrote:
> > 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 :)
Ah, I missed the "custom compiler" context. In that case, maybe just
tweak the internal linker scripts? They're generated from
<eachtarget>.sc in the source, e.g. binutils-2.23/ld/scripttempl/ .
Tweaking templates causes your customisations to be not only fully
integral to the toolchain, for the specified targets, but also more
customisable than a generic INSERT. (And very easy)
Erik
More information about the Binutils
mailing list