This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: RFC: Support link with mixed IR/non-IR objects
On Thu, 10 May 2012, Tristan Gingold wrote:
> On May 10, 2012, at 1:47 AM, Andi Kleen wrote:
> > On Wed, May 09, 2012 at 03:05:58PM +0200, Tristan Gingold wrote:
> >> On May 8, 2012, at 10:05 PM, Andi Kleen wrote:
> >>>> Even so, I think I'd lean towards the use of archives.
> >>> ar archives don't work. The linux kernel requires unreferenced objects to
> >>> be included in the build (e.g. for EXPORT_SYMBOL and initcalls)
> >> Many linkers (but not GNU ld) have options to link all archive members. Not difficult to implement.
> >
> > We cannot force all the Linux users to update their binutils.
> > So would need a solution that works with old binutils.
> >
> > Do you have one?
>
> This one might be a possible one, as it is already implemented
> in binutils (--whole-archive as Ian told)
Yeah, or they could just keep using ld -r and the current
limitations regarding gcc and linker options. As a
drop-in-replacement (except for dropping restrictive gcc and
linker options necessary for "ld -r") it's just different
make-variable contents.
But, it needs to be combined with using thin archives for adding
an archive to an archive with a single command. Thin archives
go back "only" a few years, 2.19 according to binutils/NEWS
(2009). How old is the oldest gcc release supported by the
kernel?
Also, I'm not sure using (thin) archives preserves a link order.
Unknown if that's important for objects other than for each
target's head.S.
(Mine and Cary's suggestions with new ar and/or linker features
would avoid linking in unused stuff, but that'd be new and
different and apparently unappreciated as being obsolete. :)
And BTW, an ld -r replacement could be implemented already with
a shell-script wrapper for really-old binutils: --whole-archive
was there in 2.7, definitely older than the oldest supported
gcc. It'd probably take just an afternoon (famous last words).
brgds, H-P