This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Adding custom sections to default linker script


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]