From ff38f560402aa61ce8e4ae38b4fa0ff2ddbaede6 Mon Sep 17 00:00:00 2001 From: vole-dev Date: Sat, 30 Oct 2021 10:30:28 -0500 Subject: default mabi based on RISC-V extensions and -mabi build option The target abi can also be set in build.zig via LibExeObjStep.target_abi The value passed in is checked that it is a valid value in std.Target.TargetAbi The target abi is also validated against the target cpu --- src/codegen/llvm.zig | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) (limited to 'src/codegen') diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 4600c2e07e..886be120b0 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -244,18 +244,7 @@ pub const Object = struct { // TODO handle float ABI better- it should depend on the ABI portion of std.Target const float_abi: llvm.ABIType = .Default; - // TODO a way to override this as part of std.Target ABI? - const abi_name: ?[*:0]const u8 = switch (options.target.cpu.arch) { - .riscv32 => switch (options.target.os.tag) { - .linux => "ilp32d", - else => "ilp32", - }, - .riscv64 => switch (options.target.os.tag) { - .linux => "lp64d", - else => "lp64", - }, - else => null, - }; + const abi_name: ?[*:0]const u8 = if (options.target_abi) |t| @tagName(t) else null; const target_machine = llvm.TargetMachine.create( target, -- cgit v1.2.3