[PATCH] Dead strip atoms with deadStripAlways attribute even if dead strip is not enabled.

Rui Ueyama ruiu at google.com
Thu Aug 1 20:52:56 PDT 2013


On Thu, Aug 1, 2013 at 8:37 PM, Shankar Kalpathi Easwaran <
shankarke at gmail.com> wrote:

>
>
> ================
> Comment at: lib/Core/Resolver.cpp:298-307
> @@ -298,2 +297,12 @@
> +    }
> +  } else {
> +    // If dead strip is disabled, all atoms except deadStripAlways are
> +    // considered to be live.
> +    for (const Atom *atom : _atoms) {
> +      if (const DefinedAtom *defAtom = dyn_cast<DefinedAtom>(atom))
> +        if (defAtom->deadStrip() == DefinedAtom::deadStripAlways)
> +          continue;
> +      _deadStripRoots.insert(atom);
> +    }
>    }
>
> ----------------
> I dontn know why you would have a object file that will contain symbols to
> set it to deadStripAlways. If this is a seperate input file thats being
> considered through an option, that option should be checked for before
> calling this part of code.
>

I don't understand the second sentence. Can you elaborate a bit?

The use case I expected is for Windows. In Windows, the symbol __BaseImage
is a linker-generated symbol. That contains 4-byte address, but no object
file defines it. The linker is expected to create it internally and use it
if there's a reference to the symbol. We don't want include the symbol
value to the executable, but do it only when the symbol is actually used. I
thought that the dead stripping naturally fit for that purpose.

Doing this by default, and iterating over all the atoms is going to slow
> down the linking time especially for larger links.
>

That may be convincing. Then I guess my question is, what is
deadStripAlways for?


>
>
>
> http://llvm-reviews.chandlerc.com/D1267
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130801/aee28207/attachment.html>


More information about the llvm-commits mailing list