mirror of
https://github.com/ziglang/zig.git
synced 2024-12-03 10:28:48 +00:00
Merge pull request #21605 from alexrp/ohos-stuff
`std.Target`: Introduce `Abi.ohoseabi` to distinguish the soft float case.
This commit is contained in:
commit
ece265b1c2
3
lib/compiler/aro/aro/target.zig
vendored
3
lib/compiler/aro/aro/target.zig
vendored
@ -699,7 +699,8 @@ pub fn toLLVMTriple(target: std.Target, buf: []u8) []const u8 {
|
||||
.cygnus => "cygnus",
|
||||
.simulator => "simulator",
|
||||
.macabi => "macabi",
|
||||
.ohos => "openhos",
|
||||
.ohos => "ohos",
|
||||
.ohoseabi => "ohoseabi",
|
||||
};
|
||||
writer.writeAll(llvm_abi) catch unreachable;
|
||||
return stream.getWritten();
|
||||
|
@ -677,6 +677,7 @@ pub const Abi = enum {
|
||||
simulator,
|
||||
macabi,
|
||||
ohos,
|
||||
ohoseabi,
|
||||
|
||||
// LLVM tags deliberately omitted:
|
||||
// - amplification
|
||||
@ -766,8 +767,18 @@ pub const Abi = enum {
|
||||
|
||||
pub inline fn isMusl(abi: Abi) bool {
|
||||
return switch (abi) {
|
||||
.musl, .musleabi, .musleabihf, .muslx32 => true,
|
||||
.ohos => true,
|
||||
.musl,
|
||||
.musleabi,
|
||||
.musleabihf,
|
||||
.muslx32,
|
||||
=> true,
|
||||
else => abi.isOpenHarmony(),
|
||||
};
|
||||
}
|
||||
|
||||
pub inline fn isOpenHarmony(abi: Abi) bool {
|
||||
return switch (abi) {
|
||||
.ohos, .ohoseabi => true,
|
||||
else => false,
|
||||
};
|
||||
}
|
||||
@ -786,7 +797,7 @@ pub const Abi = enum {
|
||||
.gnueabi,
|
||||
.musleabi,
|
||||
.gnusf,
|
||||
.ohos,
|
||||
.ohoseabi,
|
||||
=> .soft,
|
||||
else => .hard,
|
||||
};
|
||||
|
@ -242,6 +242,7 @@ fn libCGenericName(target: std.Target) [:0]const u8 {
|
||||
.muslx32,
|
||||
.none,
|
||||
.ohos,
|
||||
.ohoseabi,
|
||||
=> return "musl",
|
||||
.code16,
|
||||
.eabi,
|
||||
|
@ -255,6 +255,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 {
|
||||
.simulator => "simulator",
|
||||
.macabi => "macabi",
|
||||
.ohos => "ohos",
|
||||
.ohoseabi => "ohoseabi",
|
||||
};
|
||||
try llvm_triple.appendSlice(llvm_abi);
|
||||
|
||||
|
@ -45,8 +45,7 @@ pub fn requiresPIC(target: std.Target, linking_libc: bool) bool {
|
||||
return target.isAndroid() or
|
||||
target.os.tag == .windows or target.os.tag == .uefi or
|
||||
osRequiresLibC(target) or
|
||||
(linking_libc and target.isGnuLibC()) or
|
||||
(target.abi == .ohos and target.cpu.arch == .aarch64);
|
||||
(linking_libc and target.isGnuLibC());
|
||||
}
|
||||
|
||||
pub fn picLevel(target: std.Target) u32 {
|
||||
@ -306,7 +305,7 @@ pub fn libcFullLinkFlags(target: std.Target) []const []const u8 {
|
||||
"-lc",
|
||||
"-lnetwork",
|
||||
},
|
||||
else => if (target.isAndroid()) &[_][]const u8{
|
||||
else => if (target.isAndroid() or target.abi.isOpenHarmony()) &[_][]const u8{
|
||||
"-lm",
|
||||
"-lc",
|
||||
"-ldl",
|
||||
|
@ -13,9 +13,11 @@ const targets = [_]std.Target.Query{
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .ios, .abi = .macabi },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .ios, .abi = .none },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .ios, .abi = .simulator },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .android },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .gnu },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .gnuilp32 },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .none },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .linux, .abi = .ohos },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .macos, .abi = .none },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .netbsd, .abi = .none },
|
||||
.{ .cpu_arch = .aarch64, .os_tag = .openbsd, .abi = .none },
|
||||
@ -54,12 +56,14 @@ const targets = [_]std.Target.Query{
|
||||
.{ .cpu_arch = .arm, .os_tag = .freestanding, .abi = .eabihf },
|
||||
.{ .cpu_arch = .arm, .os_tag = .haiku, .abi = .eabi },
|
||||
.{ .cpu_arch = .arm, .os_tag = .haiku, .abi = .eabihf },
|
||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .androideabi },
|
||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .eabi },
|
||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .eabihf },
|
||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .gnueabi },
|
||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .gnueabihf },
|
||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .musleabi },
|
||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .musleabihf },
|
||||
.{ .cpu_arch = .arm, .os_tag = .linux, .abi = .ohoseabi },
|
||||
.{ .cpu_arch = .arm, .os_tag = .netbsd, .abi = .eabi },
|
||||
.{ .cpu_arch = .arm, .os_tag = .netbsd, .abi = .eabihf },
|
||||
.{ .cpu_arch = .arm, .os_tag = .openbsd, .abi = .eabi },
|
||||
@ -223,6 +227,7 @@ const targets = [_]std.Target.Query{
|
||||
.{ .cpu_arch = .riscv32, .os_tag = .linux, .abi = .gnu },
|
||||
.{ .cpu_arch = .riscv32, .os_tag = .linux, .abi = .musl },
|
||||
.{ .cpu_arch = .riscv32, .os_tag = .linux, .abi = .none },
|
||||
.{ .cpu_arch = .riscv32, .os_tag = .linux, .abi = .ohos },
|
||||
.{ .cpu_arch = .riscv32, .os_tag = .rtems, .abi = .none },
|
||||
.{ .cpu_arch = .riscv32, .os_tag = .uefi, .abi = .none },
|
||||
|
||||
@ -231,9 +236,11 @@ const targets = [_]std.Target.Query{
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .fuchsia, .abi = .none },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .haiku, .abi = .none },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .hermit, .abi = .none },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .android },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .gnu },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .musl },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .none },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .linux, .abi = .ohos },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .netbsd, .abi = .none },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .openbsd, .abi = .none },
|
||||
.{ .cpu_arch = .riscv64, .os_tag = .rtems, .abi = .none },
|
||||
@ -311,9 +318,11 @@ const targets = [_]std.Target.Query{
|
||||
.{ .cpu_arch = .x86, .os_tag = .freestanding, .abi = .none },
|
||||
.{ .cpu_arch = .x86, .os_tag = .haiku, .abi = .none },
|
||||
.{ .cpu_arch = .x86, .os_tag = .hurd, .abi = .gnu },
|
||||
.{ .cpu_arch = .x86, .os_tag = .linux, .abi = .android },
|
||||
.{ .cpu_arch = .x86, .os_tag = .linux, .abi = .gnu },
|
||||
.{ .cpu_arch = .x86, .os_tag = .linux, .abi = .musl },
|
||||
.{ .cpu_arch = .x86, .os_tag = .linux, .abi = .none },
|
||||
.{ .cpu_arch = .x86, .os_tag = .linux, .abi = .ohos },
|
||||
.{ .cpu_arch = .x86, .os_tag = .netbsd, .abi = .none },
|
||||
.{ .cpu_arch = .x86, .os_tag = .openbsd, .abi = .none },
|
||||
.{ .cpu_arch = .x86, .os_tag = .rtems, .abi = .none },
|
||||
@ -340,7 +349,13 @@ const targets = [_]std.Target.Query{
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .illumos, .abi = .none },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .ios, .abi = .macabi },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .ios, .abi = .simulator },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .android },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .gnu },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .gnux32 },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .musl },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .muslx32 },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .none },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .linux, .abi = .ohos },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .macos, .abi = .none },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .netbsd, .abi = .none },
|
||||
.{ .cpu_arch = .x86_64, .os_tag = .openbsd, .abi = .none },
|
||||
|
Loading…
Reference in New Issue
Block a user