aboutsummaryrefslogtreecommitdiff
path: root/src/stage1/codegen.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/stage1/codegen.cpp')
-rw-r--r--src/stage1/codegen.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/stage1/codegen.cpp b/src/stage1/codegen.cpp
index c7f429ef49..738c4b7b0a 100644
--- a/src/stage1/codegen.cpp
+++ b/src/stage1/codegen.cpp
@@ -472,6 +472,10 @@ static LLVMValueRef make_fn_llvm_value(CodeGen *g, ZigFn *fn) {
ZigLLVMFunctionSetCallingConv(llvm_fn, get_llvm_cc(g, cc));
}
+ if (g->tsan_enabled) {
+ addLLVMFnAttr(llvm_fn, "sanitize_thread");
+ }
+
bool want_cold = fn->is_cold;
if (want_cold) {
ZigLLVMAddFunctionAttrCold(llvm_fn);
@@ -8432,7 +8436,7 @@ static void zig_llvm_emit_output(CodeGen *g) {
// pipeline multiple times if this is requested.
if (asm_filename != nullptr && bin_filename != nullptr) {
if (ZigLLVMTargetMachineEmitToFile(g->target_machine, g->module, &err_msg, g->build_mode == BuildModeDebug,
- is_small, g->enable_time_report, nullptr, bin_filename, llvm_ir_filename))
+ is_small, g->enable_time_report, g->tsan_enabled, nullptr, bin_filename, llvm_ir_filename))
{
fprintf(stderr, "LLVM failed to emit file: %s\n", err_msg);
exit(1);
@@ -8442,7 +8446,7 @@ static void zig_llvm_emit_output(CodeGen *g) {
}
if (ZigLLVMTargetMachineEmitToFile(g->target_machine, g->module, &err_msg, g->build_mode == BuildModeDebug,
- is_small, g->enable_time_report, asm_filename, bin_filename, llvm_ir_filename))
+ is_small, g->enable_time_report, g->tsan_enabled, asm_filename, bin_filename, llvm_ir_filename))
{
fprintf(stderr, "LLVM failed to emit file: %s\n", err_msg);
exit(1);