aboutsummaryrefslogtreecommitdiff
path: root/src/link.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2024-10-31 01:27:22 +0100
committerAlex Rønne Petersen <alex@alexrp.com>2024-10-31 01:27:22 +0100
commitf1f804e532e603a3f58d559d32a1c8120691d891 (patch)
treedd744ef6ca7fc930887d86021eb01298b5cfacb0 /src/link.zig
parent17a87d734167b500761ef0d61493342dea0ae01d (diff)
downloadzig-f1f804e532e603a3f58d559d32a1c8120691d891.tar.gz
zig-f1f804e532e603a3f58d559d32a1c8120691d891.zip
zig_llvm: Reduce our exposure to LLVM API breakage.
LLVM recently introduced new Triple::ArchType members in 19.1.3 which broke our static assertions in zig_llvm.cpp. When implementing a fix for that, I realized that we don't even need a lot of the stuff we have in zig_llvm.(cpp,h) anymore. This commit trims the interface down considerably.
Diffstat (limited to 'src/link.zig')
-rw-r--r--src/link.zig14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/link.zig b/src/link.zig
index cd777b86c4..b784e21f06 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -1209,8 +1209,18 @@ pub const File = struct {
const llvm = @import("codegen/llvm.zig");
const target = comp.root_mod.resolved_target.result;
llvm.initializeLLVMTarget(target.cpu.arch);
- const os_tag = llvm.targetOs(target.os.tag);
- const bad = llvm_bindings.WriteArchive(full_out_path_z, object_files.items.ptr, object_files.items.len, os_tag);
+ const bad = llvm_bindings.WriteArchive(
+ full_out_path_z,
+ object_files.items.ptr,
+ object_files.items.len,
+ switch (target.os.tag) {
+ .linux => .GNU,
+ .freebsd, .openbsd => .BSD,
+ .macos, .ios => .DARWIN,
+ .windows => .GNU,
+ else => .GNU,
+ },
+ );
if (bad) return error.UnableToWriteArchive;
if (!base.disable_lld_caching) {