[Tarantool-patches] [PATCH luajit 1/3] macOS: Fix macOS 15 / Clang 16 build.

Sergey Kaplun skaplun at tarantool.org
Mon Nov 24 23:26:36 MSK 2025


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

Sergey Kaplun:
* added the description for the problem

Part of tarantool/tarantool#11691
---
 src/vm_arm64.dasc | 1 -
 src/vm_x64.dasc   | 1 -
 src/vm_x86.dasc   | 1 -
 3 files changed, 3 deletions(-)

diff --git a/src/vm_arm64.dasc b/src/vm_arm64.dasc
index c5f0a7a7..6600e226 100644
--- a/src/vm_arm64.dasc
+++ b/src/vm_arm64.dasc
@@ -4076,7 +4076,6 @@ static void emit_asm_debug(BuildCtx *ctx)
 	"LEFDEY:\n\n", fcsize);
     }
 #endif
-    fprintf(ctx->fp, ".subsections_via_symbols\n");
     }
     break;
 #endif
diff --git a/src/vm_x64.dasc b/src/vm_x64.dasc
index d5296759..8b6781a6 100644
--- a/src/vm_x64.dasc
+++ b/src/vm_x64.dasc
@@ -4943,7 +4943,6 @@ static void emit_asm_debug(BuildCtx *ctx)
 	  "LEFDEY:\n\n", fcsize);
     }
 #endif
-    fprintf(ctx->fp, ".subsections_via_symbols\n");
     }
     break;
 #endif
diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc
index b043b830..7c11c78e 100644
--- a/src/vm_x86.dasc
+++ b/src/vm_x86.dasc
@@ -5853,7 +5853,6 @@ static void emit_asm_debug(BuildCtx *ctx)
 	  fprintf(ctx->fp, "L_%s$stub:\n\t.indirect_symbol _%s\n\t.ascii \"\\364\\364\\364\\364\\364\"\n", *xn, *xn);
     }
 #endif
-    fprintf(ctx->fp, ".subsections_via_symbols\n");
     }
     break;
 #endif
-- 
2.51.2



More information about the Tarantool-patches mailing list