[PATCH] D105210: [lld-macho] Ignore debug symbols for now.
Vy Nguyen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 1 14:45:27 PDT 2021
oontvoo updated this revision to Diff 356017.
oontvoo added a comment.
updated diff
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105210/new/
https://reviews.llvm.org/D105210
Files:
lld/MachO/InputFiles.cpp
lld/MachO/UnwindInfoSection.cpp
lld/test/MachO/Inputs/bug_50812.o
lld/test/MachO/bug_50812.s
Index: lld/test/MachO/bug_50812.s
===================================================================
--- /dev/null
+++ lld/test/MachO/bug_50812.s
@@ -0,0 +1,5 @@
+# REQUIRES: x86
+## FIXME: This test currently uses lld/test/MachO/input/bug_50812.o, which is produced with `ld -r`
+## Replace that once lld supports `-r`
+
+# %lld -lSystem -platform_version macos 11.3 11.0 -arch x86_64 %S/Inputs/bug_50812.o
Index: lld/MachO/UnwindInfoSection.cpp
===================================================================
--- lld/MachO/UnwindInfoSection.cpp
+++ lld/MachO/UnwindInfoSection.cpp
@@ -151,10 +151,17 @@
continue;
Reloc &rFunc = isec->relocs[++i];
- assert(r.offset ==
- rFunc.offset + offsetof(CompactUnwindEntry<Ptr>, personality));
- auto *referentIsec =
- cast<ConcatInputSection>(rFunc.referent.get<InputSection *>());
+ InputSection *rFuncIsec = nullptr;
+ if (rFunc.referent.is<Symbol *>()) {
+ assert(rFunc.referent.get<Symbol *>()->kind() ==
+ Symbol::Kind::DefinedKind);
+ rFuncIsec = cast<Defined>(rFunc.referent.get<Symbol *>())->isec;
+ } else {
+ assert(r.offset ==
+ rFunc.offset + offsetof(CompactUnwindEntry<Ptr>, personality));
+ rFuncIsec = rFunc.referent.get<InputSection *>();
+ }
+ auto *referentIsec = cast<ConcatInputSection>(rFuncIsec);
referentIsec->hasPersonality = true;
if (auto *s = r.referent.dyn_cast<Symbol *>()) {
@@ -234,7 +241,6 @@
uint64_t referentVA = UINT64_MAX; // Tombstone value
if (auto *referentSym = r.referent.dyn_cast<Symbol *>()) {
if (!isa<Undefined>(referentSym)) {
- assert(referentSym->isInGot());
if (auto *defined = dyn_cast<Defined>(referentSym))
checkTextSegment(defined->isec);
// At this point in the link, we may not yet know the final address of
Index: lld/MachO/InputFiles.cpp
===================================================================
--- lld/MachO/InputFiles.cpp
+++ lld/MachO/InputFiles.cpp
@@ -581,6 +581,12 @@
symbols.resize(nList.size());
for (uint32_t i = 0; i < nList.size(); ++i) {
const NList &sym = nList[i];
+
+ // Ignore debug symbols for now.
+ // FIXME: may need special handling.
+ if (sym.n_type & N_STAB)
+ continue;
+
StringRef name = strtab + sym.n_strx;
if ((sym.n_type & N_TYPE) == N_SECT) {
SubsectionMap &subsecMap = subsections[sym.n_sect - 1];
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105210.356017.patch
Type: text/x-patch
Size: 2471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210701/5ca2fe09/attachment.bin>
More information about the llvm-commits
mailing list