[clang] [lld] [llvm] [lld-macho][clang][llvm-objcopy] Add x86_64 kext bundle support (PR #204805)
Visual Ehrmanntraut via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 5 02:01:11 PST 2026
VisualEhrmanntraut wrote:
I've addressed everything you two noticed, and additionally further cleaned up the changes, fixed a few uncovered cases and adjusted the behaviour closer to ld64:
- External relocations are now ordered by pointers before branches, each sorted by symbol and then address
- Local relocations are ordered by the section layout
- `__DATA` sections are ordered by input order, followed by `__got`, the zerofill sections, and `__common`
- GOT loads of external weak definitions are no longer relaxed
- The crash when an initialiser isn't defined in the kext in combination with `-init_offsets` is resolved; an error is reported instead
- A plain `llvm-strip` invocation now refuses to strip a kext whose external relocations reference symbols
A bit of a bigger change: I've made `disable-atexit-based-global-dtor-lowering` a module flag. It also means:
- The atexit disablement is now retained for distributed ThinLTO (i.e. `clang -fthinlto-index=` jobs), a subtle bug which was there before my changes
- The driver no longer passes `-mllvm -disable-atexit-based-global-dtor-lowering` to the linker
- `-ffreestanding` on non-Darwin MachO targets now gets `__mod_term_func` too
I have a few open questions:
1. I noticed that `LC_SOURCE_VERSION` is not emitted by lld for any output type, unlike ld64 which always adds it. Should a PR be created for it?
2. Should the module flag change be split into a different PR, to be merged before this one?
3. The aforementioned option is only used by `llvm/test/CodeGen/ARM/ctors_dtors.ll` now. Should I follow that up with a plain removal, a deprecation cycle, or leave it for compatibility with other frontends and/or tools?
https://github.com/llvm/llvm-project/pull/204805
More information about the cfe-commits
mailing list