aboutsummaryrefslogtreecommitdiff
path: root/src/link.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-02-19 12:07:56 -0500
committerAndrew Kelley <andrew@ziglang.org>2019-02-19 12:07:56 -0500
commitdb74832e40f98960e5dc3e46c8196c59033ee0f9 (patch)
tree95d7e039968d665d0e0001c45c9c9c1f3e2a622d /src/link.cpp
parentc9fb5240d6305bcef7db5e12b7676ba3d741c11e (diff)
downloadzig-db74832e40f98960e5dc3e46c8196c59033ee0f9.tar.gz
zig-db74832e40f98960e5dc3e46c8196c59033ee0f9.zip
valgrind client requests for undefined values
with this change, when you assign undefined, zig emits a few assembly instructions to tell valgrind that the memory is undefined it's on by default for debug builds, and disabled otherwise. only support for linux, darwin, solaris, mingw on x86_64 is currently implemented. --disable-valgrind turns it off even in debug mode. --enable-valgrind turns it on even in release modes. It's always disabled for compiler_rt.a and builtin.a. Adds `@import("builtin").valgrind_support` which lets code know at comptime whether valgrind client requests are enabled. See #1989
Diffstat (limited to 'src/link.cpp')
-rw-r--r--src/link.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/link.cpp b/src/link.cpp
index a3a68e24d4..2878a00358 100644
--- a/src/link.cpp
+++ b/src/link.cpp
@@ -55,6 +55,7 @@ static Buf *build_a_raw(CodeGen *parent_gen, const char *aname, Buf *full_path)
codegen_set_strip(child_gen, parent_gen->strip_debug_symbols);
codegen_set_is_static(child_gen, true);
child_gen->disable_pic = parent_gen->disable_pic;
+ child_gen->valgrind_support = ValgrindSupportDisabled;
codegen_set_out_name(child_gen, buf_create_from_str(aname));