aboutsummaryrefslogtreecommitdiff
path: root/lib/std/Build/CompileStep.zig
diff options
context:
space:
mode:
authorJakub Konka <kubkon@jakubkonka.com>2023-03-28 20:18:25 +0200
committerGitHub <noreply@github.com>2023-03-28 20:18:25 +0200
commit2b805526033b0446fba7f38990df707204e7e23a (patch)
tree27eb2a50726b9f8980add2b2c380b17e80a54842 /lib/std/Build/CompileStep.zig
parent43487eb3ef0933c1da53b917c44ba6070d8e5a21 (diff)
parent43ff6c14f96187ec93bbc23432cdbb885f5ab8f1 (diff)
downloadzig-2b805526033b0446fba7f38990df707204e7e23a.tar.gz
zig-2b805526033b0446fba7f38990df707204e7e23a.zip
Merge pull request #14771 from kcbanner/coff_dynamicbase
Allow dynamicbase to be disabled by CompileStep
Diffstat (limited to 'lib/std/Build/CompileStep.zig')
-rw-r--r--lib/std/Build/CompileStep.zig6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/Build/CompileStep.zig b/lib/std/Build/CompileStep.zig
index 2747f56af2..b438331991 100644
--- a/lib/std/Build/CompileStep.zig
+++ b/lib/std/Build/CompileStep.zig
@@ -140,6 +140,9 @@ link_function_sections: bool = false,
/// exported symbols.
link_gc_sections: ?bool = null,
+/// (Windows) Whether or not to enable ASLR. Maps to the /DYNAMICBASE[:NO] linker argument.
+linker_dynamicbase: bool = true,
+
linker_allow_shlib_undefined: ?bool = null,
/// Permit read-only relocations in read-only segments. Disallowed by default.
@@ -1474,6 +1477,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
if (self.link_gc_sections) |x| {
try zig_args.append(if (x) "--gc-sections" else "--no-gc-sections");
}
+ if (!self.linker_dynamicbase) {
+ try zig_args.append("--no-dynamicbase");
+ }
if (self.linker_allow_shlib_undefined) |x| {
try zig_args.append(if (x) "-fallow-shlib-undefined" else "-fno-allow-shlib-undefined");
}