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
signaturebadge-check 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 {...@@ -699,7 +699,8 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
699 .cygnus => "cygnus",699 .cygnus => "cygnus",
700 .simulator => "simulator",700 .simulator => "simulator",
701 .macabi => "macabi",701 .macabi => "macabi",
702 .ohos => "openhos",702 .ohos => "ohos",
703 .ohoseabi => "ohoseabi",
703 };704 };
704 writer.writeAll(llvm_abi) catch unreachable;705 writer.writeAll(llvm_abi) catch unreachable;
705 return stream.getWritten();706 return stream.getWritten();
lib/std/Target.zig+14-3
...@@ -677,6 +677,7 @@ pub const Abi = enum {...@@ -677,6 +677,7 @@ pub const Abi = enum {
677 simulator,677 simulator,
678 macabi,678 macabi,
679 ohos,679 ohos,
680 ohoseabi,
680681
681 // LLVM tags deliberately omitted:682 // LLVM tags deliberately omitted:
682 // - amplification683 // - amplification
...@@ -766,8 +767,18 @@ pub const Abi = enum {...@@ -766,8 +767,18 @@ pub const Abi = enum {
766767
767 pub inline fn isMusl(abi: Abi) bool {768 pub inline fn isMusl(abi: Abi) bool {
768 return switch (abi) {769 return switch (abi) {
769 .musl, .musleabi, .musleabihf, .muslx32 => true,770 .musl,
770 .ohos => true,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,
771 else => false,782 else => false,
772 };783 };
773 }784 }
...@@ -786,7 +797,7 @@ pub const Abi = enum {...@@ -786,7 +797,7 @@ pub const Abi = enum {
786 .gnueabi,797 .gnueabi,
787 .musleabi,798 .musleabi,
788 .gnusf,799 .gnusf,
789 .ohos,800 .ohoseabi,
790 => .soft,801 => .soft,
791 else => .hard,802 else => .hard,
792 };803 };
lib/std/zig/LibCDirs.zig+1
...@@ -242,6 +242,7 @@ fn libCGenericName(target: std.Target) [:0]const u8 {...@@ -242,6 +242,7 @@ fn libCGenericName(target: std.Target) [:0]const u8 {
242 .muslx32,242 .muslx32,
243 .none,243 .none,
244 .ohos,244 .ohos,
245 .ohoseabi,
245 => return "musl",246 => return "musl",
246 .code16,247 .code16,
247 .eabi,248 .eabi,
src/codegen/llvm.zig+1
...@@ -185,6 +185,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {...@@ -185,6 +185,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
185 .simulator => "simulator",185 .simulator => "simulator",
186 .macabi => "macabi",186 .macabi => "macabi",
187 .ohos => "ohos",187 .ohos => "ohos",
188 .ohoseabi => "ohoseabi",
188 };189 };
189 try llvm_triple.appendSlice(llvm_abi);190 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 {...@@ -46,7 +46,7 @@ pub fn requiresPIC(target: std.Target, linking_libc: bool) bool {
46 target.os.tag == .windows or target.os.tag == .uefi or46 target.os.tag == .windows or target.os.tag == .uefi or
47 osRequiresLibC(target) or47 osRequiresLibC(target) or
48 (linking_libc and target.isGnuLibC()) or48 (linking_libc and target.isGnuLibC()) or
49 (target.abi == .ohos and target.cpu.arch == .aarch64);49 (target.cpu.arch == .aarch64 and target.abi == .ohos);
50}50}
5151
52pub fn picLevel(target: std.Target) u32 {52pub fn picLevel(target: std.Target) u32 {