Skip to content

Commit 8a57814

Browse files
committed
Patches part 3
1 parent 2c3a92f commit 8a57814

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

src/Compilation.zig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,6 +1354,7 @@ pub const cache_helpers = struct {
13541354
hh.add(mod.red_zone);
13551355
hh.add(mod.sanitize_c);
13561356
hh.add(mod.sanitize_thread);
1357+
hh.add(mod.sanitize_address);
13571358
hh.add(mod.fuzz);
13581359
hh.add(mod.unwind_tables);
13591360
hh.add(mod.structured_cfg);
@@ -1790,6 +1791,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
17901791
const any_unwind_tables = options.config.any_unwind_tables or options.root_mod.unwind_tables != .none;
17911792
const any_non_single_threaded = options.config.any_non_single_threaded or !options.root_mod.single_threaded;
17921793
const any_sanitize_thread = options.config.any_sanitize_thread or options.root_mod.sanitize_thread;
1794+
const any_sanitize_address = options.config.any_sanitize_address or options.root_mod.sanitize_address;
17931795
const any_sanitize_c: std.zig.SanitizeC = switch (options.config.any_sanitize_c) {
17941796
.off => options.root_mod.sanitize_c,
17951797
.trap => if (options.root_mod.sanitize_c == .full)
@@ -1920,6 +1922,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
19201922
cache.hash.add(options.config.any_unwind_tables);
19211923
cache.hash.add(options.config.any_non_single_threaded);
19221924
cache.hash.add(options.config.any_sanitize_thread);
1925+
cache.hash.add(options.config.any_sanitize_address);
19231926
cache.hash.add(options.config.any_sanitize_c);
19241927
cache.hash.add(options.config.any_fuzz);
19251928
cache.hash.add(options.function_sections);
@@ -2075,6 +2078,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
20752078
comp.config.any_unwind_tables = any_unwind_tables;
20762079
comp.config.any_non_single_threaded = any_non_single_threaded;
20772080
comp.config.any_sanitize_thread = any_sanitize_thread;
2081+
comp.config.any_sanitize_address = any_sanitize_address;
20782082
comp.config.any_sanitize_c = any_sanitize_c;
20792083
comp.config.any_fuzz = any_fuzz;
20802084

@@ -7415,6 +7419,7 @@ pub fn build_crt_file(
74157419
.stack_protector = 0,
74167420
.sanitize_c = .off,
74177421
.sanitize_thread = false,
7422+
.sanitize_address = false,
74187423
.red_zone = comp.root_mod.red_zone,
74197424
// Some libcs (e.g. musl) are opinionated about -fomit-frame-pointer.
74207425
.omit_frame_pointer = options.omit_frame_pointer orelse comp.root_mod.omit_frame_pointer,

src/Package/Module.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -467,6 +467,7 @@ pub fn createBuiltin(arena: Allocator, opts: Builtin, dirs: Compilation.Director
467467
.omit_frame_pointer = opts.omit_frame_pointer,
468468
.code_model = opts.code_model,
469469
.sanitize_thread = opts.sanitize_thread,
470+
.sanitize_address = opts.sanitize_address,
470471
.fuzz = opts.fuzz,
471472
.unwind_tables = opts.unwind_tables,
472473
.cc_argv = &.{},
@@ -498,6 +499,7 @@ pub fn getBuiltinOptions(m: Module, global: Compilation.Config) Builtin {
498499
.error_tracing = m.error_tracing,
499500
.valgrind = m.valgrind,
500501
.sanitize_thread = m.sanitize_thread,
502+
.sanitize_address = m.sanitize_address,
501503
.fuzz = m.fuzz,
502504
.pic = m.pic,
503505
.pie = global.pie,

src/libs/freebsd.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,6 +1051,7 @@ fn buildSharedLib(
10511051
.stack_protector = 0,
10521052
.sanitize_c = .off,
10531053
.sanitize_thread = false,
1054+
.sanitize_address = false,
10541055
.red_zone = comp.root_mod.red_zone,
10551056
.omit_frame_pointer = comp.root_mod.omit_frame_pointer,
10561057
.valgrind = false,

test/src/LlvmIr.zig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const TestCase = struct {
3232
pie: ?bool = null,
3333
red_zone: ?bool = null,
3434
sanitize_thread: ?bool = null,
35+
sanitize_address: ?bool = null,
3536
single_threaded: ?bool = null,
3637
stack_check: ?bool = null,
3738
stack_protector: ?bool = null,
@@ -99,6 +100,7 @@ pub fn addCase(self: *LlvmIr, case: TestCase) void {
99100
.optimize = case.params.optimize,
100101
.pic = case.params.pic,
101102
.sanitize_thread = case.params.sanitize_thread,
103+
.sanitize_address = case.params.sanitize_address,
102104
.single_threaded = case.params.single_threaded,
103105
.strip = case.params.strip,
104106
.target = target,

0 commit comments

Comments
 (0)