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: Sun, 30 Aug 2015 23:21:31 +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>
- Reply-to: dvalin at internode dot on dot net
On 29.08.15 16:03, Jonas Maebe wrote:
> This generates the warning "./link.res contains output sections; did you
> forget -T?". I did not "forget" -T, because I don't want to replace the
> entire linker script, I just want to augment it.
There is yet a chance that you did. ;-)
In describing augmentation, "info ld" says: "This feature permits the
linker to link against a file which appears to be an object or an
archive, but actually merely defines some symbol values, or uses `INPUT'
or `GROUP' to load other objects. ... with the extra commands placed
after the main script;" These limitations are at odds with your
attempted usage, it would appear.
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.
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.
Erik