[lld] dbbc8d8 - [lld/mac] Don't crash on absolute symbols in unwind info generation
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 23 11:25:43 PDT 2021
Author: Nico Weber
Date: 2021-06-23T14:25:34-04:00
New Revision: dbbc8d8333f29cf4ad6f4793da1adf71bbfdac69
URL: https://github.com/llvm/llvm-project/commit/dbbc8d8333f29cf4ad6f4793da1adf71bbfdac69
DIFF: https://github.com/llvm/llvm-project/commit/dbbc8d8333f29cf4ad6f4793da1adf71bbfdac69.diff
LOG: [lld/mac] Don't crash on absolute symbols in unwind info generation
Fixes a regression from d6565a2dbcbe and PR50820.
Added:
Modified:
lld/MachO/UnwindInfoSection.cpp
lld/test/MachO/compact-unwind.s
Removed:
################################################################################
diff --git a/lld/MachO/UnwindInfoSection.cpp b/lld/MachO/UnwindInfoSection.cpp
index 13be8565e861d..e1e8d30937135 100644
--- a/lld/MachO/UnwindInfoSection.cpp
+++ b/lld/MachO/UnwindInfoSection.cpp
@@ -297,7 +297,9 @@ static void addEntriesForFunctionsWithoutUnwindInfo(
// Add explicit "has no unwind info" entries for all global and local symbols
// without unwind info.
auto markNoUnwindInfo = [&cuVector, &hasUnwindInfo](const Defined *d) {
- if (d->isLive() && isCodeSection(d->isec)) {
+ // FIXME: The d->isec null check might be incorrect for symbols
+ // from LTO files.
+ if (d->isLive() && d->isec && isCodeSection(d->isec)) {
Ptr ptr = d->getVA();
if (!hasUnwindInfo.count(ptr))
cuVector.push_back({ptr, 0, 0, 0, 0});
diff --git a/lld/test/MachO/compact-unwind.s b/lld/test/MachO/compact-unwind.s
index 72aeaf85ffcba..075bb326fd55e 100644
--- a/lld/test/MachO/compact-unwind.s
+++ b/lld/test/MachO/compact-unwind.s
@@ -110,6 +110,9 @@ _main:
_quux:
ret
+.globl _abs
+_abs = 4
+
.p2align 2
_baz:
.cfi_startproc
More information about the llvm-commits
mailing list