link: Fix archive format selection for some OSs.

* AIX has its own bespoke format.
* Handle all Apple platforms.
* FreeBSD and OpenBSD both use the GNU format in LLVM.
* Windows has since been switched to the COFF format by default in LLVM.
This commit is contained in:
Alex Rønne Petersen 2024-10-31 01:33:49 +01:00
parent 33715cb28f
commit 16b87f7082
No known key found for this signature in database

View File

@ -1214,11 +1214,9 @@ pub const File = struct {
object_files.items.ptr,
object_files.items.len,
switch (target.os.tag) {
.linux => .GNU,
.freebsd, .openbsd => .BSD,
.macos, .ios => .DARWIN,
.windows => .GNU,
else => .GNU,
.aix => .AIXBIG,
.windows => .COFF,
else => if (target.os.tag.isDarwin()) .DARWIN else .GNU,
},
);
if (bad) return error.UnableToWriteArchive;