authorgravatar for thatlemon@gmail.comLemonBoy <thatlemon@gmail.com> 2021-05-25 19:41:41+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2021-05-25 18:03:05-04:00
log3ed6379192ceffdc1b85cd83c16e87cd477e2043
tree8c2f829978af4b291b466d4754ca84d0c1cebdc4
parent2f538f30fda59d259b2d3c890a7ade6d35085da0

stage1: Store target info in the LLVM module

This is needed to let LLVM (or, better, libLTO) produce code using the target options specified by the user. Fix #8803

1 files changed, 7 insertions(+), 0 deletions(-)

src/stage1/codegen.cpp+7
...@@ -589,6 +589,13 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) {...@@ -589,6 +589,13 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) {
589 // use the ABI alignment, which is fine.589 // use the ABI alignment, which is fine.
590 }590 }
591591
592 if (g->zig_target->llvm_cpu_name != nullptr) {
593 ZigLLVMAddFunctionAttr(llvm_fn, "target-cpu", g->zig_target->llvm_cpu_name);
594 }
595 if (g->zig_target->llvm_cpu_features != nullptr) {
596 ZigLLVMAddFunctionAttr(llvm_fn, "target-features", g->zig_target->llvm_cpu_features);
597 }
598
592 if (is_async) {599 if (is_async) {
593 addLLVMArgAttr(llvm_fn, 0, "nonnull");600 addLLVMArgAttr(llvm_fn, 0, "nonnull");
594 } else {601 } else {