aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorkcbanner <kcbanner@gmail.com>2024-10-21 20:24:58 -0400
committerAndrew Kelley <andrew@ziglang.org>2024-10-21 22:54:52 -0700
commit85d87c9ca1f0c0c7fe9efa5ab54e306c6a309de3 (patch)
treea769d6746e8fac5d0b4bc9bf320a3e6e811a3fbe /src
parent9f84f7f921d8a74926bb2f0ca1969b7b00f08172 (diff)
downloadzig-85d87c9ca1f0c0c7fe9efa5ab54e306c6a309de3.tar.gz
zig-85d87c9ca1f0c0c7fe9efa5ab54e306c6a309de3.zip
coff: fix incorrect default `image_base` values and re-enable shared library tests on Windows
This was the cause of aarch64-windows shared libraries causing "bad image" errors during load-time linking. I also re-enabled the tests that were surfacing this bug.
Diffstat (limited to 'src')
-rw-r--r--src/link/Coff.zig10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/link/Coff.zig b/src/link/Coff.zig
index 1b25ee5e09..eb2c0d6fb5 100644
--- a/src/link/Coff.zig
+++ b/src/link/Coff.zig
@@ -274,11 +274,15 @@ pub fn createEmpty(
.image_base = options.image_base orelse switch (output_mode) {
.Exe => switch (target.cpu.arch) {
- .aarch64 => 0x140000000,
- .thumb, .x86_64, .x86 => 0x400000,
+ .aarch64, .x86_64 => 0x140000000,
+ .thumb, .x86 => 0x400000,
+ else => unreachable,
+ },
+ .Lib => switch (target.cpu.arch) {
+ .aarch64, .x86_64 => 0x180000000,
+ .thumb, .x86 => 0x10000000,
else => unreachable,
},
- .Lib => 0x10000000,
.Obj => 0,
},