[lld] [lld-macho] Scope addrsig keepUnique marking to code sections (PR #192636)

Zhaoxuan Jiang via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 19 19:29:20 PDT 2026


nocchijiang wrote:

Thanks. Your unease is reasonable, but I want to push back on one piece of framing.

The "why does LLVM think these are address-significant?" framing assumes the addrsig payload is a careful per-symbol assertion. In practice it isn't. LLVM derives addrsig from `GlobalValue::UnnamedAddr`, where `UnnamedAddr::Global` is the explicit "this is not address-significant" state. If you grep the codebase for `UnnamedAddr::` you'll see it's set in only a handful of places. The negative case is barely maintained, so the addrsig payload is closer to "everything we didn't bother to mark" than to "everything that's truly address-taken."

Some context too: ld64 ignores `__llvm_addrsig` entirely. MachO addrsig support is a relatively recent addition (IIRC also contributed from Meta), so for the data sections in question there's no historical "the linker honored my directive" expectation to break.

So the plan I'd propose, which I think lines up with your suggestion:

- Short-term: relax `noUniqueRequirement` for the sections ld64 always folds as a workaround.
- Long-term: improve `UnnamedAddr` use in LLVM, starting with the obvious cases - the `cfstring` / `classrefs` / `selrefs` emitters should be marking these `unnamed_addr` so the addrsig list stops lying.

Let me know your thoughts on the plan.

https://github.com/llvm/llvm-project/pull/192636


More information about the llvm-commits mailing list