[PATCH] D133201: [LLD][COFF] Fix Bug, occurring if Symbol has no name
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 6 23:35:09 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG4e5a59a3839f: [LLD][COFF] Fix writing a map file when range extension thunks are inserted (authored by j0le, committed by mstorsjo).
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.458366.patch
Type: text/x-patch
Size: 2606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220907/37b08938/attachment.bin>
More information about the llvm-commits
mailing list