[LLVMdev] Appending linkage and DGE

Talin viridia at gmail.com
Thu Dec 3 14:00:47 PST 2009


Sorry if this question is a repeat, I never got an answer the last time I
asked :)

How does appending linkage interact with dead global elimination? From what
I understand, appending linkage arrays are stitched together by the linker.
Dead global elimination usually happens after linking, so if any of those
arrays are "live", then any globals that they point to will be live as well.
My conclusion, therefore, is that any global that is marked as having
appending linkage can never be considered dead, unless all same-named
globals are also dead.

So for example, if I were to use appending linkage to generate a list of
module initialization functions (one per module), then would this cause
every module to be included in the final binary, regardless of whether it
was used or not?

Suppose I wanted it to work the other way - that appending linkage would
only stitch together the globals that survived dead global elimination. Is
there some way I could get the linker to behave this way?

-- 
-- Talin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20091203/0b66cf52/attachment.html>


More information about the llvm-dev mailing list