Hi, Sergey!

Thanks for the patch! LGTM with a minor comment.

Sergey

On 11/24/25 23:26, Sergey Kaplun wrote:
From: Mike Pall <mike>

Note: The -Wl,-no_deduplicate workaround is NOT needed anymore.
Thanks to fxcoudert, corsix, clason, baconpaul, mvf.

(cherry picked from commit 2240d84464cc3dcb22fd976f1db162b36b5b52d5)

When building LuaJIT in the non-Debug mode, the -O2 optimization flag is
applied for both the compiler and the linker. Thus, the linker may apply
various optimizations, such as code deduplication. Since macOS 15, the
bundled Clang provided by Xcode tools may wrongly deduplicate the part
of the LuaJIT VM. One workaround may be to provide a flag to the linker
`-Wl,-no_deduplicate` [1], which helps to avoid wrong deduplication. The
other option is to remove emitting `.subsections_via_symbols` [2] to
avoid shrinking the object file by the labels.

The second option is more robust, since there is no rationale why this
directive was added in the past.

[1]: https://rocm.docs.amd.com/projects/llvm-project/en/latest/LLVM/lld/html/MachO/ld64-vs-lld.html
[2]: https://reviews.llvm.org/D79926

I would also add a link to Mach-O File Format Reference [1]. We already referred to it in the commit 6e3aad8fb65f20a294171620b2e3bb4a8287e9b3 ("OSX/iOS/ARM64: Fix generation of Mach-O object files.").
Feel free to ignore.

1. https://github.com/aidansteele/osx-abi-macho-file-format-reference


    
<snipped>