aboutsummaryrefslogtreecommitdiff
path: root/src/llvm_backend_general.cpp
diff options
context:
space:
mode:
authorJesse Meyer <jesse.r.meyer@me.com>2026-02-01 09:04:53 -0500
committerJesse Meyer <jesse.r.meyer@me.com>2026-02-03 20:16:20 -0500
commit43ad4a1d9f18a89822e1b9f554adef1a228136db (patch)
treeca7a569d1e5adc6fa3f1d7eb6c1a5fe36b175715 /src/llvm_backend_general.cpp
parentf7901cffc9f4983259586241d5b336cdb6377b9c (diff)
Add ThinLTO support via -lto:thin and -lto:thin-files flags
- Add -lto:thin and -lto:thin-files CLI flags with validation - Emit LLVM bitcode (.bc) instead of object files when LTO is enabled - Pass -flto=thin and -flto-jobs to clang/lld linkers - Guard linkage corrections to skip declarations without definitions (required for LTO where declarations appear across modules) - Allow module-per-file with LTO even at higher optimization levels Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/llvm_backend_general.cpp')
-rw-r--r--src/llvm_backend_general.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/llvm_backend_general.cpp b/src/llvm_backend_general.cpp
index c0e57143d..572e3990c 100644
--- a/src/llvm_backend_general.cpp
+++ b/src/llvm_backend_general.cpp
@@ -163,7 +163,7 @@ gb_internal bool lb_init_generator(lbGenerator *gen, Checker *c) {
map_init(&gen->modules_through_ctx, gen->info->packages.count*2);
if (USE_SEPARATE_MODULES) {
- bool module_per_file = build_context.module_per_file && build_context.optimization_level <= 0;
+ bool module_per_file = build_context.module_per_file && (build_context.optimization_level <= 0 || build_context.lto_kind != LTO_None);
for (auto const &entry : gen->info->packages) {
AstPackage *pkg = entry.value;
auto m = gb_alloc_item(permanent_allocator(), lbModule);