Link order a pain, positional argument --start-group problematic
Nick Clifton
nickc@redhat.com
Fri Jan 8 09:35:00 GMT 2016
Hi R Diez,
> I personally find disturbing that a duplicate symbol may or may not be
> detected depending on the link order, which can be pretty hard to
> control in complex or even automatically-generated makefiles.
Unfortunately this behaviour is now firmly established in modern
linkers, and it is unlikely to change.
> As a work-around, I suggest adding alternative command-line arguments
> that are not position dependent. I guess in most situations a global
> flag like --whole-archive-all would provide a simpler, more intuitive
> and more reliable experience.
Well this is certainly possible, although you probably want to call the
option something like --group-all. --whole-archive-all implies that all
of the contents of every library listed on the command line should be
included in the executable, even if some of those library functions are
not used. That would lead to a lot of file bloat.
So the next problem is persuading someone to implement this feature.
You can have a go yourself - we would be more than happy to provide you
with advice and hints if you this way. Alternatively you could pay
someone to implement it. There are several companies out there that do
this kind of work. Or you could try badgering the mailing lists until
someone gives in and has a go.
There are also other linkers that you could try, or whose communities
you could ask. The LLVM project has a linker for example, and they
might be interested in implementing this feature.
Cheers
Nick
More information about the Binutils
mailing list