From: Nico Weber Date: Wed, 23 Jun 2021 18:25:08 +0000 (-0400) Subject: [lld/mac] Don't crash on absolute symbols in unwind info generation X-Git-Tag: llvmorg-14-init~3199 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dbbc8d8333f29cf4ad6f4793da1adf71bbfdac69;p=platform%2Fupstream%2Fllvm.git [lld/mac] Don't crash on absolute symbols in unwind info generation Fixes a regression from d6565a2dbcbe and PR50820. --- diff --git a/lld/MachO/UnwindInfoSection.cpp b/lld/MachO/UnwindInfoSection.cpp index 13be856..e1e8d30 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 72aeaf8..075bb32 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