[lld] r230732 - PECOFF: Do not add layout-after edges.

Rui Ueyama ruiu at google.com
Thu Feb 26 21:20:23 PST 2015


Huh, that's true. I remembered something was still using layout-after but I
misunderstood that that was removed. Rolling this back now. Thank you for
pointing that out.

On Thu, Feb 26, 2015 at 9:12 PM, Shankar Easwaran <shankare at codeaurora.org>
wrote:

> I thought there was a use of layout-after/layout-before edges to compute
> section size for handling COMDAT's w.r.t PECOFF.
>
> If layout-after references are deleted, how does getSectionSize() work ?
>
> Shankar Easwaran
>
>
> On 2/26/2015 11:05 PM, Rui Ueyama wrote:
>
>> Author: ruiu
>> Date: Thu Feb 26 23:05:38 2015
>> New Revision: 230732
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=230732&view=rev
>> Log:
>> PECOFF: Do not add layout-after edges.
>>
>> Previously we needed to create atoms as a doubly-linked link, but it's
>> no longer needed. Also we don't use layout-after edges in PE/COFF.
>> Creating such edges is just waste.
>>
>> Modified:
>>      lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
>>      lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
>>
>> Modified: lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h
>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/
>> ReaderWriter/PECOFF/Atoms.h?rev=230732&r1=230731&r2=230732&view=diff
>> ============================================================
>> ==================
>> --- lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h (original)
>> +++ lld/trunk/lib/ReaderWriter/PECOFF/Atoms.h Thu Feb 26 23:05:38 2015
>> @@ -351,27 +351,16 @@ void addLayoutEdge(T *a, U *b, uint32_t
>>     a->addReference(std::unique_ptr<COFFReference>(ref));
>>   }
>>   -template <typename T, typename U> void connectWithLayoutEdge(T *a, U
>> *b) {
>> -  addLayoutEdge(a, b, lld::Reference::kindLayoutAfter);
>> -  addLayoutEdge(b, a, lld::Reference::kindLayoutBefore);
>> -}
>> -
>> -/// Connect atoms with layout-{before,after} edges. It usually serves two
>> -/// purposes.
>> -///
>> -///   - To prevent atoms from being GC'ed (aka dead-stripped) if there
>> is a
>> -///     reference to one of the atoms. In that case we want to emit all
>> the
>> -///     atoms appeared in the same section, because the referenced
>> "live" atom
>> -///     may reference other atoms in the same section. If we don't add
>> layout
>> -///     edges between atoms, unreferenced atoms in the same section
>> would be
>> -///     GC'ed.
>> -///   - To preserve the order of atmos. We want to emit the atoms in the
>> -///     same order as they appeared in the input object file.
>> +/// Connect atoms with layout-before edges. It prevents atoms from
>> +/// being GC'ed (aka dead-stripped) if there is a reference to one of
>> +/// the atoms in the same layout-before chain. In such case we want to
>> +/// emit all the atoms appeared in the same chain, because the "live"
>> +/// atom may reference other atoms in the same chain.
>>   template <typename T> void connectAtomsWithLayoutEdge(std::vector<T *>
>> &atoms) {
>>     if (atoms.size() < 2)
>>       return;
>>     for (auto it = atoms.begin(), e = atoms.end(); it + 1 != e; ++it)
>> -    connectWithLayoutEdge(*it, *(it + 1));
>> +    addLayoutEdge(*(it + 1), *it, lld::Reference::kindLayoutBefore);
>>   }
>>     } // namespace pecoff
>>
>> Modified: lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp
>> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/
>> ReaderWriter/PECOFF/ReaderCOFF.cpp?rev=230732&r1=
>> 230731&r2=230732&view=diff
>> ============================================================
>> ==================
>> --- lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp (original)
>> +++ lld/trunk/lib/ReaderWriter/PECOFF/ReaderCOFF.cpp Thu Feb 26 23:05:38
>> 2015
>> @@ -756,7 +756,7 @@ std::error_code FileCOFF::AtomizeDefined
>>       if (atoms.size() > 0)
>>         atoms[0]->setAlignment(getAlignment(section));
>>   -    // Connect atoms with layout-before/layout-after edges.
>> +    // Connect atoms with layout-before edges.
>>       connectAtomsWithLayoutEdge(atoms);
>>         for (COFFDefinedFileAtom *atom : atoms) {
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>>
>>
>
> --
> Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted
> by the Linux Foundation
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150226/ade75195/attachment.html>


More information about the llvm-commits mailing list