[PATCH] D18095: Add __attribute__((linkonce_odr_linkage))

John McCall via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 22 13:36:37 PDT 2016

rjmccall added a comment.

You could also get this effect by somehow making the definitions linkonce_odr when they're linked in from the library.  Or you could simply use the classic static-archive technique of putting each symbol in its own object file and linking against the whole thing as a static archive (.a), which only pulls in object files that provide symbols that are used.

Regardless, linkonce won't get the effect you want, because (1) linkonce definitions can be dropped at any time when they're not used, so they won't be emitted in the library if they're not used there, and (2) the overriding definitions will be strong.


More information about the cfe-commits mailing list