[PATCH] D49653: [LLD] [COFF] Handle comdat sections without leader symbols
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 26 13:15:13 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL338064: [COFF] Handle comdat sections without leader symbols (authored by mstorsjo, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D49653?vs=156972&id=157558#toc
Repository:
rL LLVM
https://reviews.llvm.org/D49653
Files:
lld/trunk/COFF/InputFiles.cpp
lld/trunk/test/COFF/pending-comdat.s
Index: lld/trunk/test/COFF/pending-comdat.s
===================================================================
--- lld/trunk/test/COFF/pending-comdat.s
+++ lld/trunk/test/COFF/pending-comdat.s
@@ -0,0 +1,21 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -triple=x86_64-windows-gnu %s -filetype=obj -o %t.obj
+
+# RUN: not lld-link -lldmingw -out:%t.exe -entry:main -subsystem:console %t.obj 2>&1 | FileCheck %s
+
+# CHECK: error: undefined symbol: other
+
+# Check that the comdat section without a symbol isn't left pending once we iterate symbols
+# to print source of the undefined symbol.
+
+ .text
+ .globl main
+main:
+ call other
+ ret
+
+ .section .data$pending,"w"
+ .linkonce discard
+.Llocal:
+ .byte 0
Index: lld/trunk/COFF/InputFiles.cpp
===================================================================
--- lld/trunk/COFF/InputFiles.cpp
+++ lld/trunk/COFF/InputFiles.cpp
@@ -281,6 +281,13 @@
if (auto *Def = Sym.getSectionDefinition())
if (Def->Selection == IMAGE_COMDAT_SELECT_ASSOCIATIVE)
readAssociativeDefinition(Sym, Def);
+ if (SparseChunks[Sym.getSectionNumber()] == PendingComdat) {
+ StringRef Name;
+ COFFObj->getSymbolName(Sym, Name);
+ log("comdat section " + Name +
+ " without leader and unassociated, discarding");
+ continue;
+ }
Symbols[I] = createRegular(Sym);
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49653.157558.patch
Type: text/x-patch
Size: 1355 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180726/22bab786/attachment.bin>
More information about the llvm-commits
mailing list