Follup-up to D107533, where we replaced local syms with non-local.
It doesn't make sense to replace local symbol with lazy.
Details
- Reviewers
int3 gkm - Group Reviewers
Restricted Project - Commits
- rG944071eca2c8: [lld-macho] Don't replace local personality symbol with LazySymbol
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Can we have a test? It's kind of subtle... we typically don't bother checking for LazySymbol because any such referenced symbol would typically by fetch()-ed once all the input files are loaded. But in this case we aren't looking up a symbol by relocation, but by name. I think it's worth documenting in a test so that the check doesn't get removed by someone trying to 'clean up' the code in the future.
lld/MachO/UnwindInfoSection.cpp | ||
---|---|---|
198 | unrelated to this diff, but doesn't find() return a non-const pointer? In which case we should just take a non-const value on line 197 and skip the cast here |
Turnt out - we still need this hack. putting it back on the review queue. Please have a look! 🙏
To be honest, I have a repro but I'm not sure there's a good (maintainable) way to put it into a test.
Repro:
// ------------- defined.s .private_extern _my_personality .text .no_dead_strip _my_personality _my_personality: .cfi_startproc .cfi_def_cfa_offset 16 .cfi_endproc nop .subsections_via_symbols // -----------objc.s .section __TEXT,__text .global _OBJC_CLASS_$_MyTest .no_dead_strip _OBJC_CLASS_$_MyTest _OBJC_CLASS_$_MyTest: .cfi_startproc .cfi_personality 155, _my_personality .cfi_def_cfa_offset 16 ret .cfi_endproc ret .subsections_via_symbols
build/link commands:
llvm-mc -filetype=obj -triple=x86_64-apple-iossimulator defined.s -o defined.o llvm-mc -filetype=obj -triple=x86_64-apple-iossimulator objc.s -o objc.o ld -r -o combined.o ar r pack.a defined.o combined.o ld64.lld.darwinnew -dylib -arch x86_64 -platform_version ios-simulator 12.0.0 15.0 -syslibroot third_party/apple_sdks/xcode_13_0/iphonesimulator -ObjC pack.a
Thoughts?
P.S: I mean, can we check in the archive? or can we rely on (llvm-)ar is available during tests?
yes, llvm-ar is available :) otherwise we wouldn't be able to test any of our archive handling code...
I think we should use yaml2obj + llvm-ar
lld/test/MachO/objc-uses-custom-personality.s | ||
---|---|---|
1 ↗ | (On Diff #388506) | Actually I think this is actually quite essential :P because only ObjC archives has the semantic of "force-loading" when -objC is specified. |
removed double space.
lld/test/MachO/objc-uses-custom-personality.s | ||
---|---|---|
5 ↗ | (On Diff #388506) | Thanks! |
unrelated to this diff, but doesn't find() return a non-const pointer? In which case we should just take a non-const value on line 197 and skip the cast here