This is an archive of the discontinued LLVM Phabricator instance.

[lld-macho] Simplify the handling of "no unwind info" functions
ClosedPublic

Authored by int3 on Sep 16 2021, 8:36 PM.

Details

Summary

This diff does away with addEntriesForFunctionsWithoutUnwindInfo(),
because addSymbol() can now determine which functions need those
entries.

While overhauling UnwindInfoSection, I also parallelized the relocation
of the contents of the CUEs. This somewhat offsets the time regression
from creating one InputSection per CUE (which was done in D109944).

Diff Detail

Event Timeline

int3 created this revision.Sep 16 2021, 8:36 PM
Herald added a project: Restricted Project. · View Herald Transcript
int3 requested review of this revision.Sep 16 2021, 8:36 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 16 2021, 8:36 PM
oontvoo added inline comments.
lld/MachO/UnwindInfoSection.cpp
146–151

Please include the explanation on why we're doing this (for eg., "because we'll use it with parallelForEachN" )

(or perhaps move this comment to the symbols's decl statement.)

287

this never changes - would be nice to have it fixed somewhere rather than having to re-type it in a few places

int3 updated this revision to Diff 373361.Sep 17 2021, 4:21 PM
int3 marked an inline comment as done.

elaborate on comment

lld/MachO/UnwindInfoSection.cpp
287

If we end up using it in multiple places, sure

oontvoo accepted this revision.Sep 17 2021, 6:55 PM

LGTM

This revision is now accepted and ready to land.Sep 17 2021, 6:55 PM
This revision was landed with ongoing or failed builds.Oct 26 2021, 1:04 PM
This revision was automatically updated to reflect the committed changes.

I think this may have broken: lld/test/MachO/invalid/compact-unwind-bad-reloc.s?

: 'RUN: at line 2';   /android0/llvm-project/llvm/build/bin/llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 /android0/llvm-project/lld/test/MachO/invalid/compact-unwind-bad-reloc.s -o /android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp.o
: 'RUN: at line 3';   not ld64.lld -arch x86_64 -platform_version macos 10.15 11.0 -syslibroot /android0/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -fatal_warnings -pie -lSystem -lc++ /android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp.o -o /android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp 2>&1 | /android0/llvm-project/llvm/build/bin/FileCheck /android0/llvm-project/lld/test/MachO/invalid/compact-unwind-bad-reloc.s -DFILE=/android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp.o
--
Exit Code: 2

Command Output (stderr):
--
+ : 'RUN: at line 2'
+ /android0/llvm-project/llvm/build/bin/llvm-mc -filetype=obj -triple=x86_64-apple-darwin19.0.0 /android0/llvm-project/lld/test/MachO/invalid/compact-unwind-bad-reloc.s -o /android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp.o
+ : 'RUN: at line 3'
+ not ld64.lld -arch x86_64 -platform_version macos 10.15 11.0 -syslibroot /android0/llvm-project/lld/test/MachO/Inputs/MacOSX.sdk -fatal_warnings -pie -lSystem -lc++ /android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp.o -o /android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp
+ /android0/llvm-project/llvm/build/bin/FileCheck /android0/llvm-project/lld/test/MachO/invalid/compact-unwind-bad-reloc.s -DFILE=/android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp.o
FileCheck error: '<stdin>' is empty.
FileCheck command line:  /android0/llvm-project/llvm/build/bin/FileCheck /android0/llvm-project/lld/test/MachO/invalid/compact-unwind-bad-reloc.s -DFILE=/android0/llvm-project/llvm/build/tools/lld/test/MachO/invalid/Output/compact-unwind-bad-reloc.s.tmp.o