| author | |
| committer | |
| log | 537a873b171b521d422704fc1f9c23f8d3b954ea |
| tree | 5fb4a2dee58220de64e158b95ba02a23e9eda613 |
| parent | 4ceefca14be313e91a248fdc532e37edf4a02a51 |
| signature |
https://llvm.org/docs/HowToBuildWindowsItaniumPrograms.html
This is a weird middle ground between `*-windows-gnu` and `*-windows-msvc`. It
uses the C++ ABI of the former while using the system libraries of the latter.14 files changed, 21 insertions(+), 19 deletions(-)
lib/compiler_rt/aulldiv.zig+2-1| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const arch = builtin.cpu.arch; |
| 4 | const os = builtin.os.tag; | |
| 4 | 5 | const abi = builtin.abi; |
| 5 | 6 | const common = @import("common.zig"); |
| 6 | 7 | |
| 7 | 8 | pub const panic = common.panic; |
| 8 | 9 | |
| 9 | 10 | comptime { |
| 10 | if (arch == .x86 and abi == .msvc and builtin.zig_backend != .stage2_c) { | |
| 11 | if (arch == .x86 and os == .windows and (abi == .msvc or abi == .itanium) and builtin.zig_backend != .stage2_c) { | |
| 11 | 12 | // Don't let LLVM apply the stdcall name mangling on those MSVC builtins |
| 12 | 13 | @export(&_alldiv, .{ .name = "\x01__alldiv", .linkage = common.linkage, .visibility = common.visibility }); |
| 13 | 14 | @export(&_aulldiv, .{ .name = "\x01__aulldiv", .linkage = common.linkage, .visibility = common.visibility }); |
lib/compiler_rt/aullrem.zig+2-1| ... | ... | @@ -1,13 +1,14 @@ |
| 1 | 1 | const std = @import("std"); |
| 2 | 2 | const builtin = @import("builtin"); |
| 3 | 3 | const arch = builtin.cpu.arch; |
| 4 | const os = builtin.os.tag; | |
| 4 | 5 | const abi = builtin.abi; |
| 5 | 6 | const common = @import("common.zig"); |
| 6 | 7 | |
| 7 | 8 | pub const panic = common.panic; |
| 8 | 9 | |
| 9 | 10 | comptime { |
| 10 | if (arch == .x86 and abi == .msvc and builtin.zig_backend != .stage2_c) { | |
| 11 | if (arch == .x86 and os == .windows and (abi == .msvc or abi == .itanium) and builtin.zig_backend != .stage2_c) { | |
| 11 | 12 | // Don't let LLVM apply the stdcall name mangling on those MSVC builtins |
| 12 | 13 | @export(&_allrem, .{ .name = "\x01__allrem", .linkage = common.linkage, .visibility = common.visibility }); |
| 13 | 14 | @export(&_aullrem, .{ .name = "\x01__aullrem", .linkage = common.linkage, .visibility = common.visibility }); |
lib/std/Target.zig+2-2| ... | ... | @@ -113,7 +113,7 @@ pub const Os = struct { |
| 113 | 113 | |
| 114 | 114 | pub fn staticLibSuffix(tag: Tag, abi: Abi) [:0]const u8 { |
| 115 | 115 | return switch (abi) { |
| 116 | .msvc => ".lib", | |
| 116 | .msvc, .itanium => ".lib", | |
| 117 | 117 | else => switch (tag) { |
| 118 | 118 | .windows, .uefi => ".lib", |
| 119 | 119 | else => ".a", |
| ... | ... | @@ -138,7 +138,7 @@ pub const Os = struct { |
| 138 | 138 | |
| 139 | 139 | pub fn libPrefix(tag: Os.Tag, abi: Abi) [:0]const u8 { |
| 140 | 140 | return switch (abi) { |
| 141 | .msvc => "", | |
| 141 | .msvc, .itanium => "", | |
| 142 | 142 | else => switch (tag) { |
| 143 | 143 | .windows, .uefi => "", |
| 144 | 144 | else => "lib", |
lib/std/c.zig+1-1| ... | ... | @@ -9506,7 +9506,7 @@ else if (native_os == .linux and builtin.target.isMusl()) |
| 9506 | 9506 | else |
| 9507 | 9507 | private.getcontext; |
| 9508 | 9508 | |
| 9509 | pub const max_align_t = if (native_abi == .msvc) | |
| 9509 | pub const max_align_t = if (native_abi == .msvc or native_abi == .itanium) | |
| 9510 | 9510 | f64 |
| 9511 | 9511 | else if (builtin.target.isDarwin()) |
| 9512 | 9512 | c_longdouble |
lib/std/os/windows/tls.zig+1-1| ... | ... | @@ -9,7 +9,7 @@ export var __xl_a: windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLA") = null; |
| 9 | 9 | export var __xl_z: windows.PIMAGE_TLS_CALLBACK linksection(".CRT$XLZ") = null; |
| 10 | 10 | |
| 11 | 11 | comptime { |
| 12 | if (builtin.cpu.arch == .x86 and builtin.abi == .msvc and builtin.zig_backend != .stage2_c) { | |
| 12 | if (builtin.cpu.arch == .x86 and !builtin.abi.isGnu() and builtin.zig_backend != .stage2_c) { | |
| 13 | 13 | // The __tls_array is the offset of the ThreadLocalStoragePointer field |
| 14 | 14 | // in the TEB block whose base address held in the %fs segment. |
| 15 | 15 | asm ( |
lib/std/zig/LibCDirs.zig+1-1| ... | ... | @@ -69,7 +69,7 @@ pub fn detect( |
| 69 | 69 | // On windows, instead of the native (mingw) abi, we want to check |
| 70 | 70 | // for the MSVC abi as a fallback. |
| 71 | 71 | const use_system_abi = if (builtin.os.tag == .windows) |
| 72 | target.abi == .msvc | |
| 72 | target.abi == .msvc or target.abi == .itanium | |
| 73 | 73 | else |
| 74 | 74 | is_native_abi; |
| 75 | 75 |
lib/std/zig/LibCInstallation.zig+2-2| ... | ... | @@ -86,14 +86,14 @@ pub fn parse( |
| 86 | 86 | return error.ParseError; |
| 87 | 87 | } |
| 88 | 88 | |
| 89 | if (self.msvc_lib_dir == null and os_tag == .windows and target.abi == .msvc) { | |
| 89 | if (self.msvc_lib_dir == null and os_tag == .windows and (target.abi == .msvc or target.abi == .itanium)) { | |
| 90 | 90 | log.err("msvc_lib_dir may not be empty for {s}-{s}", .{ |
| 91 | 91 | @tagName(os_tag), |
| 92 | 92 | @tagName(target.abi), |
| 93 | 93 | }); |
| 94 | 94 | return error.ParseError; |
| 95 | 95 | } |
| 96 | if (self.kernel32_lib_dir == null and os_tag == .windows and target.abi == .msvc) { | |
| 96 | if (self.kernel32_lib_dir == null and os_tag == .windows and (target.abi == .msvc or target.abi == .itanium)) { | |
| 97 | 97 | log.err("kernel32_lib_dir may not be empty for {s}-{s}", .{ |
| 98 | 98 | @tagName(os_tag), |
| 99 | 99 | @tagName(target.abi), |
src/Compilation.zig+1-1| ... | ... | @@ -2639,7 +2639,7 @@ fn addNonIncrementalStuffToCacheManifest( |
| 2639 | 2639 | const target = comp.root_mod.resolved_target.result; |
| 2640 | 2640 | if (comp.libc_installation) |libc_installation| { |
| 2641 | 2641 | man.hash.addOptionalBytes(libc_installation.crt_dir); |
| 2642 | if (target.abi == .msvc) { | |
| 2642 | if (target.abi == .msvc or target.abi == .itanium) { | |
| 2643 | 2643 | man.hash.addOptionalBytes(libc_installation.msvc_lib_dir); |
| 2644 | 2644 | man.hash.addOptionalBytes(libc_installation.kernel32_lib_dir); |
| 2645 | 2645 | } |
src/clang.zig+1-1| ... | ... | @@ -64,7 +64,7 @@ pub const APValueKind = enum(c_int) { |
| 64 | 64 | |
| 65 | 65 | pub const APValue = extern struct { |
| 66 | 66 | Kind: APValueKind, |
| 67 | Data: if (builtin.os.tag == .windows and builtin.abi == .msvc) [52]u8 else [68]u8, | |
| 67 | Data: if (builtin.os.tag == .windows and (builtin.abi == .msvc or builtin.abi == .itanium)) [52]u8 else [68]u8, | |
| 68 | 68 | |
| 69 | 69 | pub const getKind = ZigClangAPValue_getKind; |
| 70 | 70 | extern fn ZigClangAPValue_getKind(*const APValue) APValueKind; |
src/libcxx.zig+1-1| ... | ... | @@ -221,7 +221,7 @@ pub fn buildLibCXX(comp: *Compilation, prog_node: std.Progress.Node) BuildError! |
| 221 | 221 | for (libcxx_files) |cxx_src| { |
| 222 | 222 | var cflags = std.ArrayList([]const u8).init(arena); |
| 223 | 223 | |
| 224 | if ((target.os.tag == .windows and target.abi == .msvc) or target.os.tag == .wasi) { | |
| 224 | if ((target.os.tag == .windows and (target.abi == .msvc or target.abi == .itanium)) or target.os.tag == .wasi) { | |
| 225 | 225 | // Filesystem stuff isn't supported on WASI and Windows (MSVC). |
| 226 | 226 | if (std.mem.startsWith(u8, cxx_src, "src/filesystem/")) |
| 227 | 227 | continue; |
src/link/C.zig+1-1| ... | ... | @@ -398,7 +398,7 @@ fn abiDefines(self: *C, target: std.Target) !std.ArrayList(u8) { |
| 398 | 398 | errdefer defines.deinit(); |
| 399 | 399 | const writer = defines.writer(); |
| 400 | 400 | switch (target.abi) { |
| 401 | .msvc => try writer.writeAll("#define ZIG_TARGET_ABI_MSVC\n"), | |
| 401 | .msvc, .itanium => try writer.writeAll("#define ZIG_TARGET_ABI_MSVC\n"), | |
| 402 | 402 | else => {}, |
| 403 | 403 | } |
| 404 | 404 | try writer.print("#define ZIG_TARGET_MAX_INT_ALIGNMENT {d}\n", .{ |
src/link/Coff/lld.zig+3-3| ... | ... | @@ -93,7 +93,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_no |
| 93 | 93 | man.hash.add(comp.libc_installation != null); |
| 94 | 94 | if (comp.libc_installation) |libc_installation| { |
| 95 | 95 | man.hash.addBytes(libc_installation.crt_dir.?); |
| 96 | if (target.abi == .msvc) { | |
| 96 | if (target.abi == .msvc or target.abi == .itanium) { | |
| 97 | 97 | man.hash.addBytes(libc_installation.msvc_lib_dir.?); |
| 98 | 98 | man.hash.addBytes(libc_installation.kernel32_lib_dir.?); |
| 99 | 99 | } |
| ... | ... | @@ -256,7 +256,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_no |
| 256 | 256 | if (comp.libc_installation) |libc_installation| { |
| 257 | 257 | try argv.append(try allocPrint(arena, "-LIBPATH:{s}", .{libc_installation.crt_dir.?})); |
| 258 | 258 | |
| 259 | if (target.abi == .msvc) { | |
| 259 | if (target.abi == .msvc or target.abi == .itanium) { | |
| 260 | 260 | try argv.append(try allocPrint(arena, "-LIBPATH:{s}", .{libc_installation.msvc_lib_dir.?})); |
| 261 | 261 | try argv.append(try allocPrint(arena, "-LIBPATH:{s}", .{libc_installation.kernel32_lib_dir.?})); |
| 262 | 262 | } |
| ... | ... | @@ -499,7 +499,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, tid: Zcu.PerThread.Id, prog_no |
| 499 | 499 | continue; |
| 500 | 500 | } |
| 501 | 501 | } |
| 502 | if (target.abi == .msvc) { | |
| 502 | if (target.abi == .msvc or target.abi == .itanium) { | |
| 503 | 503 | argv.appendAssumeCapacity(lib_basename); |
| 504 | 504 | continue; |
| 505 | 505 | } |
src/main.zig+1-1| ... | ... | @@ -3874,7 +3874,7 @@ fn createModule( |
| 3874 | 3874 | }; |
| 3875 | 3875 | } |
| 3876 | 3876 | |
| 3877 | if (builtin.target.os.tag == .windows and target.abi == .msvc and | |
| 3877 | if (builtin.target.os.tag == .windows and (target.abi == .msvc or target.abi == .itanium) and | |
| 3878 | 3878 | external_system_libs.len != 0) |
| 3879 | 3879 | { |
| 3880 | 3880 | if (create_module.libc_installation == null) { |
src/target.zig+2-2| ... | ... | @@ -31,7 +31,7 @@ pub fn libcNeedsLibUnwind(target: std.Target) bool { |
| 31 | 31 | .wasi, // Wasm/WASI currently doesn't offer support for libunwind, so don't link it. |
| 32 | 32 | => false, |
| 33 | 33 | |
| 34 | .windows => target.abi != .msvc, | |
| 34 | .windows => target.abi.isGnu(), | |
| 35 | 35 | else => true, |
| 36 | 36 | }; |
| 37 | 37 | } |
| ... | ... | @@ -87,7 +87,7 @@ pub fn hasValgrindSupport(target: std.Target) bool { |
| 87 | 87 | .aarch64_be, |
| 88 | 88 | => { |
| 89 | 89 | return target.os.tag == .linux or target.os.tag == .solaris or target.os.tag == .illumos or |
| 90 | (target.os.tag == .windows and target.abi != .msvc); | |
| 90 | (target.os.tag == .windows and target.abi.isGnu()); | |
| 91 | 91 | }, |
| 92 | 92 | else => return false, |
| 93 | 93 | } |