Skip to content

Commit 67ad68a

Browse files
alexrpbernardassan
authored andcommitted
std.Target: Introduce Abi.ohoseabi to distinguish the soft float case.
For the same reason as ziglang#21504.
1 parent 33a4885 commit 67ad68a

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

lib/compiler/aro/aro/target.zig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
255255
.simulator => "simulator",
256256
.macabi => "macabi",
257257
.ohos => "ohos",
258+
.ohoseabi => "ohoseabi",
258259
};
259260
try llvm_triple.appendSlice(llvm_abi);
260261

src/target.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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

5252
pub fn picLevel(target: std.Target) u32 {

0 commit comments

Comments
 (0)