<div dir="ltr">I just noticed that Bindings/Go/go.test was failing, but with this change it's fixed now. Thanks!</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 11, 2016 at 1:36 PM, 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: Fri Nov 11 15:36:25 2016<br>
New Revision: 286635<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=286635&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project?rev=286635&view=rev</a><br>
Log:<br>
Avoid a crash with -r and .comment.<br>
<br>
We would create a MergeInputSection for the synthetic .comment and<br>
crash trying to add it to a regular output section.<br>
<br>
With this we just don't add the synthetic section with -r. That is<br>
consistent with gold that doesn't create .note.gnu.gold-version with<br>
-r.<br>
<br>
Added:<br>
lld/trunk/test/ELF/<wbr>relocatable-comment.s<br>
Modified:<br>
lld/trunk/ELF/Writer.cpp<br>
lld/trunk/test/ELF/<wbr>relocatable-bss.s<br>
lld/trunk/test/ELF/<wbr>relocatable.s<br>
<br>
Modified: lld/trunk/ELF/Writer.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=286635&r1=286634&r2=286635&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/ELF/Writer.<wbr>cpp?rev=286635&r1=286634&r2=<wbr>286635&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/Writer.cpp (original)<br>
+++ lld/trunk/ELF/Writer.cpp Fri Nov 11 15:36:25 2016<br>
@@ -267,7 +267,8 @@ template <class ELFT> void Writer<ELFT>:<br>
Out<ELFT>::VerDef = make<VersionDefinitionSection<<wbr>ELFT>>();<br>
<br>
// Initialize linker generated sections<br>
- Symtab<ELFT>::X->Sections.<wbr>push_back(<wbr>createCommentSection<ELFT>());<br>
+ if (!Config->Relocatable)<br>
+ Symtab<ELFT>::X->Sections.<wbr>push_back(<wbr>createCommentSection<ELFT>());<br>
<br>
if (Config->BuildId == BuildIdKind::Fast)<br>
In<ELFT>::BuildId = make<BuildIdFastHash<ELFT>>();<br>
<br>
Modified: lld/trunk/test/ELF/<wbr>relocatable-bss.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocatable-bss.s?rev=286635&r1=286634&r2=286635&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>relocatable-bss.s?rev=286635&<wbr>r1=286634&r2=286635&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/<wbr>relocatable-bss.s (original)<br>
+++ lld/trunk/test/ELF/<wbr>relocatable-bss.s Fri Nov 11 15:36:25 2016<br>
@@ -20,7 +20,7 @@<br>
# CHECK-NEXT: Version:<br>
# CHECK-NEXT: Entry:<br>
# CHECK-NEXT: ProgramHeaderOffset:<br>
-# CHECK-NEXT: SectionHeaderOffset: 0xB8<br>
+# CHECK-NEXT: SectionHeaderOffset: 0xA8<br>
# CHECK-NEXT: Flags [<br>
# CHECK-NEXT: ]<br>
# CHECK-NEXT: HeaderSize:<br>
<br>
Added: lld/trunk/test/ELF/<wbr>relocatable-comment.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocatable-comment.s?rev=286635&view=auto" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>relocatable-comment.s?rev=<wbr>286635&view=auto</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/<wbr>relocatable-comment.s (added)<br>
+++ lld/trunk/test/ELF/<wbr>relocatable-comment.s Fri Nov 11 15:36:25 2016<br>
@@ -0,0 +1,27 @@<br>
+# REQUIRES: x86<br>
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t1.o<br>
+# RUN: ld.lld -r %t1.o -o %t<br>
+# RUN: llvm-readobj -s -section-data %t | FileCheck %s<br>
+<br>
+# CHECK: Name: .comment<br>
+# CHECK-NEXT: Type: SHT_PROGBITS<br>
+# CHECK-NEXT: Flags [<br>
+# CHECK-NEXT: SHF_MERGE<br>
+# CHECK-NEXT: SHF_STRINGS<br>
+# CHECK-NEXT: ]<br>
+# CHECK-NEXT: Address:<br>
+# CHECK-NEXT: Offset:<br>
+# CHECK-NEXT: Size: 7<br>
+# CHECK-NEXT: Link:<br>
+# CHECK-NEXT: Info:<br>
+# CHECK-NEXT: AddressAlignment: 1<br>
+# CHECK-NEXT: EntrySize: 1<br>
+# CHECK-NEXT: SectionData (<br>
+# CHECK-NEXT: 0000: 666F6F62 617200 |foobar.|<br>
+# CHECK-NEXT: )<br>
+<br>
+<br>
+# We used to crash creating a merge and non merge .comment sections.<br>
+<br>
+ .section .comment,"MS",@progbits,1<br>
+ .asciz "foobar"<br>
<br>
Modified: lld/trunk/test/ELF/<wbr>relocatable.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/relocatable.s?rev=286635&r1=286634&r2=286635&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-<wbr>project/lld/trunk/test/ELF/<wbr>relocatable.s?rev=286635&r1=<wbr>286634&r2=286635&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/<wbr>relocatable.s (original)<br>
+++ lld/trunk/test/ELF/<wbr>relocatable.s Fri Nov 11 15:36:25 2016<br>
@@ -30,15 +30,15 @@<br>
# CHECK-NEXT: Version: 1<br>
# CHECK-NEXT: Entry: 0x0<br>
# CHECK-NEXT: ProgramHeaderOffset: 0x0<br>
-# CHECK-NEXT: SectionHeaderOffset: 0x2D0<br>
+# CHECK-NEXT: SectionHeaderOffset: 0x2C0<br>
# CHECK-NEXT: Flags [<br>
# CHECK-NEXT: ]<br>
# CHECK-NEXT: HeaderSize: 64<br>
# CHECK-NEXT: ProgramHeaderEntrySize: 0<br>
# CHECK-NEXT: ProgramHeaderCount: 0<br>
# CHECK-NEXT: SectionHeaderEntrySize: 64<br>
-# CHECK-NEXT: SectionHeaderCount: 8<br>
-# CHECK-NEXT: StringTableSectionIndex: 6<br>
+# CHECK-NEXT: SectionHeaderCount: 7<br>
+# CHECK-NEXT: StringTableSectionIndex: 5<br>
# CHECK-NEXT: }<br>
<br>
# CHECK: Relocations [<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>