authorgravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-05 15:13:37+02:00
committergravatar for alex@alexrp.comAlex Rønne Petersen <alex@alexrp.com> 2024-10-05 15:13:37+02:00
log84e192c88b2a970b249c7a7480e14717535b6096
treedb460c21cc6016e7d3ae78feff9e86874b69631c
parent043b1adb8dff184deaf9e145e6045b36b9bf733b
signature Signed by SSH key SHA256:7B/LJ7bpR1eX8aCXSr4mtd5M45VMPKcx9zY8e95b5QM

std.Target: Introduce Abi.ohoseabi to distinguish the soft float case.

For the same reason as #21504.

5 files changed, 19 insertions(+), 5 deletions(-)

lib/compiler/aro/aro/target.zig+2-1
......@@ -699,7 +699,8 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
699699 .cygnus => "cygnus",
700700 .simulator => "simulator",
701701 .macabi => "macabi",
702 .ohos => "openhos",
702 .ohos => "ohos",
703 .ohoseabi => "ohoseabi",
703704 };
704705 writer.writeAll(llvm_abi) catch unreachable;
705706 return stream.getWritten();
lib/std/Target.zig+14-3
......@@ -677,6 +677,7 @@ pub const Abi = enum {
677677 simulator,
678678 macabi,
679679 ohos,
680 ohoseabi,
680681
681682 // LLVM tags deliberately omitted:
682683 // - amplification
......@@ -766,8 +767,18 @@ pub const Abi = enum {
766767
767768 pub inline fn isMusl(abi: Abi) bool {
768769 return switch (abi) {
769 .musl, .musleabi, .musleabihf, .muslx32 => true,
770 .ohos => true,
770 .musl,
771 .musleabi,
772 .musleabihf,
773 .muslx32,
774 => true,
775 else => abi.isOpenHarmony(),
776 };
777 }
778
779 pub inline fn isOpenHarmony(abi: Abi) bool {
780 return switch (abi) {
781 .ohos, .ohoseabi => true,
771782 else => false,
772783 };
773784 }
......@@ -786,7 +797,7 @@ pub const Abi = enum {
786797 .gnueabi,
787798 .musleabi,
788799 .gnusf,
789 .ohos,
800 .ohoseabi,
790801 => .soft,
791802 else => .hard,
792803 };
lib/std/zig/LibCDirs.zig+1
......@@ -242,6 +242,7 @@ fn libCGenericName(target: std.Target) [:0]const u8 {
242242 .muslx32,
243243 .none,
244244 .ohos,
245 .ohoseabi,
245246 => return "musl",
246247 .code16,
247248 .eabi,
src/codegen/llvm.zig+1
......@@ -185,6 +185,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
185185 .simulator => "simulator",
186186 .macabi => "macabi",
187187 .ohos => "ohos",
188 .ohoseabi => "ohoseabi",
188189 };
189190 try llvm_triple.appendSlice(llvm_abi);
190191
src/target.zig+1-1
......@@ -46,7 +46,7 @@ pub fn requiresPIC(target: std.Target, linking_libc: bool) bool {
4646 target.os.tag == .windows or target.os.tag == .uefi or
4747 osRequiresLibC(target) or
4848 (linking_libc and target.isGnuLibC()) or
49 (target.abi == .ohos and target.cpu.arch == .aarch64);
49 (target.cpu.arch == .aarch64 and target.abi == .ohos);
5050}
5151
5252pub fn picLevel(target: std.Target) u32 {