This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Adding custom sections to default linker script
- From: Erik Christiansen <dvalin at internode dot on dot net>
- To: binutils at sourceware dot org
- Date: Mon, 31 Aug 2015 19:51:44 +1000
- Subject: Re: Adding custom sections to default linker script
- Authentication-results: sourceware.org; auth=none
- References: <55E1BBA7 dot 7080202 at elis dot ugent dot be> <20150830132130 dot GA3518 at ratatosk> <55E33208 dot 8030602 at elis dot ugent dot be>
- Reply-to: dvalin at internode dot on dot net
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