aboutsummaryrefslogtreecommitdiff
path: root/src/Compilation.zig
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alex@alexrp.com>2025-02-18 00:51:59 +0100
committerGitHub <noreply@github.com>2025-02-18 00:51:59 +0100
commitb732070fd36267fb055347e3aa8a1851e4054d50 (patch)
tree9851eb03564eff472bbb4a605e13e4058baed4c6 /src/Compilation.zig
parent55c46870b23ac16670beaa3ff1c082b703738307 (diff)
parentfaccd79ca5debbe22fe168193b8de54393257604 (diff)
downloadzig-b732070fd36267fb055347e3aa8a1851e4054d50.tar.gz
zig-b732070fd36267fb055347e3aa8a1851e4054d50.zip
Merge pull request #22589 from alexrp/target-changes
Some miscellaneous target and calling convention changes
Diffstat (limited to 'src/Compilation.zig')
-rw-r--r--src/Compilation.zig21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/Compilation.zig b/src/Compilation.zig
index 5bbeca4b7d..aafbc30fef 100644
--- a/src/Compilation.zig
+++ b/src/Compilation.zig
@@ -1766,11 +1766,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
if (comp.config.link_libc and is_exe_or_dyn_lib) {
// If the "is darwin" check is moved below the libc_installation check below,
// error.LibCInstallationMissingCrtDir is returned from lci.resolveCrtPaths().
- if (target.isDarwin()) {
- switch (target.abi) {
- .none, .simulator, .macabi => {},
- else => return error.LibCUnavailable,
- }
+ if (target.isDarwinLibC()) {
// TODO delete logic from MachO flush() and queue up tasks here instead.
} else if (comp.libc_installation) |lci| {
const basenames = LibCInstallation.CrtBasenames.get(.{
@@ -1793,7 +1789,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
// Loads the libraries provided by `target_util.libcFullLinkFlags(target)`.
comp.link_task_queue.shared.appendAssumeCapacity(.load_host_libc);
comp.remaining_prelink_tasks += 1;
- } else if (target.isMusl() and !target.isWasm()) {
+ } else if (target.isMuslLibC()) {
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
if (musl.needsCrt0(comp.config.output_mode, comp.config.link_mode, comp.config.pie)) |f| {
@@ -1817,7 +1813,7 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
comp.queued_jobs.glibc_crt_file[@intFromEnum(glibc.CrtFile.libc_nonshared_a)] = true;
comp.remaining_prelink_tasks += 1;
- } else if (target.isWasm() and target.os.tag == .wasi) {
+ } else if (target.isWasiLibC()) {
if (!std.zig.target.canBuildLibC(target)) return error.LibCUnavailable;
for (comp.wasi_emulated_libs) |crt_file| {
@@ -1839,11 +1835,6 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
// When linking mingw-w64 there are some import libs we always need.
try comp.windows_libs.ensureUnusedCapacity(gpa, mingw.always_link_libs.len);
for (mingw.always_link_libs) |name| comp.windows_libs.putAssumeCapacity(name, {});
- } else if (target.isDarwin()) {
- switch (target.abi) {
- .none, .simulator, .macabi => {},
- else => return error.LibCUnavailable,
- }
} else if (target.os.tag == .freestanding and capable_of_building_zig_libc) {
comp.queued_jobs.zig_libc = true;
comp.remaining_prelink_tasks += 1;
@@ -5545,7 +5536,7 @@ pub fn addCCArgs(
// We might want to support -mfloat-abi=softfp for Arm and CSKY here in the future.
if (target_util.clangSupportsFloatAbiArg(target)) {
- const fabi = @tagName(target.floatAbi());
+ const fabi = @tagName(target.abi.float());
try argv.append(switch (target.cpu.arch) {
// For whatever reason, Clang doesn't support `-mfloat-abi` for s390x.
@@ -5598,7 +5589,7 @@ pub fn addCCArgs(
if (ext != .assembly) {
try argv.append(if (target.os.tag == .freestanding) "-ffreestanding" else "-fhosted");
- if (target_util.clangSupportsNoImplicitFloatArg(target) and target.floatAbi() == .soft) {
+ if (target_util.clangSupportsNoImplicitFloatArg(target) and target.abi.float() == .soft) {
try argv.append("-mno-implicit-float");
}
@@ -5646,7 +5637,7 @@ pub fn addCCArgs(
// LLVM IR files don't support these flags.
if (ext != .ll and ext != .bc) {
// https://github.com/llvm/llvm-project/issues/105972
- if (target.cpu.arch.isPowerPC() and target.floatAbi() == .soft) {
+ if (target.cpu.arch.isPowerPC() and target.abi.float() == .soft) {
try argv.append("-D__NO_FPRS__");
try argv.append("-D_SOFT_FLOAT");
try argv.append("-D_SOFT_DOUBLE");