[PATCH] D133201: [LLD][COFF] Fix Bug, occurring if Symbol has no name
Jan Ole Hüser via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 5 04:01:51 PDT 2022
j0le updated this revision to Diff 457928.
j0le retitled this revision from "[LLD][COFF] Fix Bug, occouring if Symbol has no name" to "[LLD][COFF] Fix Bug, occurring if Symbol has no name".
j0le edited the summary of this revision.
j0le added a comment.
Update patch:
- Revert changes, which were made to Symbol::getName() and Symbol::computeName()
- Add assertion to ctor of class Symbol
- Add "-map" to command line of lld-link in test for ARM64
I can confirm, that the bug also occurs for ARM64
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133201/new/
https://reviews.llvm.org/D133201
Files:
lld/COFF/Symbols.h
lld/COFF/Writer.cpp
lld/test/COFF/arm-thumb-thunks.s
lld/test/COFF/arm64-thunks.s
Index: lld/test/COFF/arm64-thunks.s
===================================================================
--- lld/test/COFF/arm64-thunks.s
+++ lld/test/COFF/arm64-thunks.s
@@ -1,6 +1,6 @@
// REQUIRES: aarch64
// RUN: llvm-mc -filetype=obj -triple=aarch64-windows %s -o %t.obj
-// RUN: lld-link -entry:main -subsystem:console %t.obj -out:%t.exe -verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
+// RUN: lld-link -entry:main -subsystem:console %t.obj -out:%t.exe -map -verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
// RUN: llvm-objdump -d %t.exe | FileCheck --check-prefix=DISASM %s
// VERBOSE: Added 2 thunks with margin {{.*}} in 1 passes
Index: lld/test/COFF/arm-thumb-thunks.s
===================================================================
--- lld/test/COFF/arm-thumb-thunks.s
+++ lld/test/COFF/arm-thumb-thunks.s
@@ -1,6 +1,6 @@
// REQUIRES: arm
// RUN: llvm-mc -filetype=obj -triple=thumbv7-windows %s -o %t.obj
-// RUN: lld-link -entry:main -subsystem:console %t.obj -out:%t.exe -verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
+// RUN: lld-link -entry:main -subsystem:console %t.obj -out:%t.exe -map -verbose 2>&1 | FileCheck -check-prefix=VERBOSE %s
// RUN: llvm-objdump -d %t.exe --start-address=0x401000 --stop-address=0x401022 | FileCheck --check-prefix=MAIN %s
// RUN: llvm-objdump -d %t.exe --start-address=0x501022 --stop-address=0x501032 | FileCheck --check-prefix=FUNC1 %s
// RUN: llvm-objdump -d %t.exe --start-address=0x601032 | FileCheck --check-prefix=FUNC2 %s
Index: lld/COFF/Writer.cpp
===================================================================
--- lld/COFF/Writer.cpp
+++ lld/COFF/Writer.cpp
@@ -396,7 +396,7 @@
default:
llvm_unreachable("Unexpected architecture");
}
- Defined *d = make<DefinedSynthetic>("", c);
+ Defined *d = make<DefinedSynthetic>("range_extension_thunk", c);
lastThunk = d;
return {d, true};
}
Index: lld/COFF/Symbols.h
===================================================================
--- lld/COFF/Symbols.h
+++ lld/COFF/Symbols.h
@@ -106,7 +106,10 @@
: symbolKind(k), isExternal(true), isCOMDAT(false),
writtenToSymtab(false), pendingArchiveLoad(false), isGCRoot(false),
isRuntimePseudoReloc(false), deferUndefined(false), canInline(true),
- nameSize(n.size()), nameData(n.empty() ? nullptr : n.data()) {}
+ nameSize(n.size()), nameData(n.empty() ? nullptr : n.data()) {
+ assert((!n.empty() || k <= LastDefinedCOFFKind) &&
+ "If the name is empty, the Symbol must be a DefinedCOFF.");
+ }
const unsigned symbolKind : 8;
unsigned isExternal : 1;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133201.457928.patch
Type: text/x-patch
Size: 2606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220905/9582440b/attachment.bin>
More information about the llvm-commits
mailing list