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: RFC: Support link with mixed IR/non-IR objects


> Linux can't use "ar" as it is, because it (and gold and gld,
> when passed an .a) doesn't make sure to include objects with the
> kernel flavor of cdtors in the final image, and you can't
> combine several .a into a new .a just by calling "ar".

With thin archives, you *can* combine several archives into one.

A while back, I suggested a solution for forcing the linker to pull
members from an archive library, by modifying the linker(s) to
recognize a special fake symbol (say, ".FORCE") in the archive symbol
table and always link the corresponding object. ar could add a
".FORCE" entry to the archive symbol table for any object that
contains some kind of trigger, like a .note section or a
.gnu_force_link section.

I made this suggestion as part of a counter-proposal to HJ's original
proposal for embedding an object file within a section. My proposal
was to put the result of running ld -r on the non-IR objects into one
archive member, and the result of running ld -r on the IR objects into
a second member (or, alternatively, just put each IR object in a
separate member).

   http://gcc.gnu.org/ml/gcc/2010-12/msg00232.html

I'd also like to make GCC's __attribute ((used)) attribute create a
special section in the .o file that identifies each variable or
function tagged as used. That could be used to trigger the force-link
from an archive, and can also be used by the linker to prevent garbage
collection.

Is there any support for this idea?

-cary


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