This is the mail archive of the
mailing list for the binutils project.
Re: Replacing linux' "ld -r" use (was: RFC: Support link with mixed IR/non-IR objects)
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).