[lld/mac] Don't crash on absolute symbols in unwind info generation

Fixes a regression from d6565a2dbc and PR50820.
This commit is contained in:
Nico Weber 2021-06-23 14:25:08 -04:00
parent e5f2b035dd
commit dbbc8d8333
2 changed files with 6 additions and 1 deletions

View File

@ -297,7 +297,9 @@ static void addEntriesForFunctionsWithoutUnwindInfo(
// Add explicit "has no unwind info" entries for all global and local symbols // Add explicit "has no unwind info" entries for all global and local symbols
// without unwind info. // without unwind info.
auto markNoUnwindInfo = [&cuVector, &hasUnwindInfo](const Defined *d) { 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(); Ptr ptr = d->getVA();
if (!hasUnwindInfo.count(ptr)) if (!hasUnwindInfo.count(ptr))
cuVector.push_back({ptr, 0, 0, 0, 0}); cuVector.push_back({ptr, 0, 0, 0, 0});

View File

@ -110,6 +110,9 @@ _main:
_quux: _quux:
ret ret
.globl _abs
_abs = 4
.p2align 2 .p2align 2
_baz: _baz:
.cfi_startproc .cfi_startproc