[LLVMdev] [lld] adding deadStrip() to undefined Atoms
Nick Kledzik
kledzik at apple.com
Tue Aug 27 14:43:51 PDT 2013
On Aug 27, 2013, at 11:35 AM, Shankar Easwaran <shankare at codeaurora.org> wrote:
> On 8/27/2013 12:45 AM, Nick Kledzik wrote:
>> On Aug 26, 2013, at 10:20 PM, Shankar Easwaran wrote:
>>> Can we add deadStrip() to undefinedAtoms as well ?
>>>
>>> This will enable to choose whether we want to set the property deadStripNormal or deadStripNever on them.
>>>
>>> Also I think it will be cleaner for atoms to be added to deadStripRoot set using a single API.
>> Can you give more more background on this? When would you want and undef that causes the whatever defined atom replaces it to be never dead stripped?
> We have these options
>
> a) -entry <symbolname>
> b) -init <symbolname>
> c) -fini <symbolname>
>
> The atoms created for this shouldnot be dead stripped, as there is an explicit reference from the command line.
Those should be added to LinkingContext’s initialUndefinedSymbols. Then we should change Resolver::deadStripOptimize() to add all initial undefines (along with deadStripRoots) to the dead strip roots. InitialUndefines are atom names that need to have an implementation, that means they should not be dead stripped. With that change in place, this half of your issue is solved.
>
> The other options such as
>
> a) --defsym newsymbol = oldsymbol + 100
> b) --wrap newsymbol
>
> have the other effect that if there is no reference to the symbols newsymbol, and __wrap_newsymbol, the atoms are removed.
Off hand, I’m not sure how to support —wrap in general. I can see having the command line object create an alias atom (scope=linkageunit) which is named newsymbol and references __wrap_newsymbol. But I don’t know how to model uses of __real_newsymbol. But there is nothing to dead strip here. Alias are zero size and making it scopeLinkageUnit means it won’t escape. So, I don’t see anything deadStrip wise that needs to handling here.
>
> Also rather than having the symbols seperately considered in the Driver, on whether we want to add to the deadStripRoot set or not, we can just use the attributes on the atom to place
> them in the deadStripRoot set / not.
>
> On the similiar lines, I think it should become an atom property itself (having absoluteAtoms also have this property set) ?
Like aliases, AbsoluteAtoms have no size, so I don’t see what dead stripping them would gain.
-Nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130827/166b5414/attachment.html>
More information about the llvm-dev
mailing list