<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 5, 2016 at 10:02 AM, Rafael Espindola via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rafael<br>
Date: Wed Oct 5 12:02:09 2016<br>
New Revision: 283340<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=283340&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=283340&view=rev</a><br>
Log:<br>
Simplify setting the Live bit in SectionPiece. NFC.<br>
<br>
Modified:<br>
lld/trunk/ELF/InputSection.cpp<br>
lld/trunk/ELF/InputSection.h<br>
<br>
Modified: lld/trunk/ELF/InputSection.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=283340&r1=283339&r2=283340&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>InputSection.cpp?rev=283340&<wbr>r1=283339&r2=283340&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputSection.cpp (original)<br>
+++ lld/trunk/ELF/InputSection.cpp Wed Oct 5 12:02:09 2016<br>
@@ -533,12 +533,13 @@ std::vector<SectionPiece><br>
MergeInputSection<ELFT>::<wbr>splitStrings(ArrayRef<uint8_t> Data, size_t EntSize) {<br>
std::vector<SectionPiece> V;<br>
size_t Off = 0;<br>
+ bool IsAlloca = this->getSectionHdr()->sh_<wbr>flags & SHF_ALLOC;<br>
while (!Data.empty()) {<br>
size_t End = findNull(Data, EntSize);<br>
if (End == StringRef::npos)<br>
fatal(getName(this) + ": string is not null terminated");<br>
size_t Size = End + EntSize;<br>
- V.emplace_back(Off, Data.slice(0, Size));<br>
+ V.emplace_back(Off, Data.slice(0, Size), !IsAlloca);<br>
Data = Data.slice(Size);<br>
Off += Size;<br>
}<br>
@@ -573,16 +574,9 @@ template <class ELFT> void MergeInputSec<br>
else<br>
this->Pieces = splitNonStrings(Data, EntSize);<br>
<br>
- if (Config->GcSections) {<br>
- if (this->getSectionHdr()->sh_<wbr>flags & SHF_ALLOC) {<br>
- for (uintX_t Off : LiveOffsets)<br>
- this->getSectionPiece(Off)-><wbr>Live = true;<br>
- return;<br>
- }<br>
-<br>
- for (SectionPiece &Piece : this->Pieces)<br>
- Piece.Live = true;<br>
- }<br>
+ if (Config->GcSections && this->getSectionHdr()->sh_<wbr>flags & SHF_ALLOC)<br></blockquote><div><br></div><div>nit: add () around &.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+ for (uintX_t Off : LiveOffsets)<br>
+ this->getSectionPiece(Off)-><wbr>Live = true;<br>
}<br>
<br>
template <class ELFT><br>
<br>
Modified: lld/trunk/ELF/InputSection.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=283340&r1=283339&r2=283340&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/<wbr>InputSection.h?rev=283340&r1=<wbr>283339&r2=283340&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputSection.h (original)<br>
+++ lld/trunk/ELF/InputSection.h Wed Oct 5 12:02:09 2016<br>
@@ -122,9 +122,9 @@ template <class ELFT> InputSectionBase<E<br>
<br>
// SectionPiece represents a piece of splittable section contents.<br>
struct SectionPiece {<br>
- SectionPiece(size_t Off, ArrayRef<uint8_t> Data)<br>
+ SectionPiece(size_t Off, ArrayRef<uint8_t> Data, bool Live = false)<br>
: InputOff(Off), Data((const uint8_t *)Data.data()), Size(Data.size()),<br>
- Live(!Config->GcSections) {}<br>
+ Live(Live || !Config->GcSections) {}<br>
<br>
ArrayRef<uint8_t> data() { return {Data, Size}; }<br>
size_t size() const { return Size; }<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div></div>