Replacing linux' "ld -r" use (was: RFC: Support link with mixed IR/non-IR objects)
Wed May 9 00:48:00 GMT 2012
On Tue, 8 May 2012, Hans-Peter Nilsson wrote:
> > > An alternative that I was thinking of and which doesn't require
> > > "ar" changes, is to add a new linker option and linker-script
> > > option to force sections matching a pattern specified by the
> > > mechanism into the linked object, even if they're only found in
> > > a static .a archive, similar to what happens with -u for
> > > symbols. Â Say, (in the script) /INCLUDE/ similar to /DISCARD/,
> > > just the opposite. :) Â Maybe --include-section=GLOB for the
> > > command-line option. Â Of course, KEEP() is implied. Â I'm not
> > > sure existing linker versions emits errors when it's found, so
> > > maybe tweak the implied syntax so that they do; we don't want
> > > current linkers to silently ignore it.
JFTR (I don't plan to add any of this right now and I'd prefer
buy-in from a global maintainer before that happens): inthe
linker script it can't be like /DISCARD/ because those included
sections need to be placed like other (non-discarded) sections.
Better make the syntax like KEEP(), but perhaps named INCLUDE()
or even better INCLUDEALL(). This even has the benefit of
making previous versions exit with a syntax error (well at least
the current sources, just checked by editing ld-elf/dynamic1.ld).
More information about the Binutils