diff --git a/lib/std/Target.zig b/lib/std/Target.zig index d98236421c7774c6d8f1531254ecc313f4fbab3f..5ede5809f370485f51c390d35c858a61227be63d 100644 --- a/lib/std/Target.zig +++ b/lib/std/Target.zig @@ -649,6 +649,7 @@ pub const Abi = enum { callable, mesh, amplification, + ohos, pub fn default(arch: Cpu.Arch, os: Os) Abi { return if (arch.isWasm()) .musl else switch (os.tag) { @@ -688,6 +689,7 @@ pub const Abi = enum { .wasi, .emscripten, => .musl, + .liteos => .ohos, .opencl, // TODO: SPIR-V ABIs with Linkage capability .glsl450, .vulkan, @@ -699,7 +701,6 @@ pub const Abi = enum { .visionos, .driverkit, .shadermodel, - .liteos, // TODO: audit this .solaris, .illumos, .serenity, @@ -716,7 +717,8 @@ pub const Abi = enum { pub inline fn isMusl(abi: Abi) bool { return switch (abi) { - .musl, .musleabi, .musleabihf => true, + .musl, .musleabi, .musleabihf, .muslx32 => true, + .ohos => true, else => false, }; } @@ -727,6 +729,7 @@ pub const Abi = enum { .eabihf, .musleabihf, => .hard, + .ohos => .soft, else => .soft, }; } diff --git a/lib/std/zig/LibCDirs.zig b/lib/std/zig/LibCDirs.zig index 44c318c3590c64310dc66ed473e2408295655c74..4dc8586e3cffa3579a594c052205f84e57a5f90e 100644 --- a/lib/std/zig/LibCDirs.zig +++ b/lib/std/zig/LibCDirs.zig @@ -242,6 +242,7 @@ fn libCGenericName(target: std.Target) [:0]const u8 { .musleabihf, .muslx32, .none, + .ohos, => return "musl", .code16, .eabi, diff --git a/src/codegen/llvm.zig b/src/codegen/llvm.zig index 5b42a701ffc04974e4da798bf49a2c2f59c75555..291e76f08465f7d3c6fc97c94958c81481f95e7e 100644 --- a/src/codegen/llvm.zig +++ b/src/codegen/llvm.zig @@ -212,6 +212,7 @@ pub fn targetTriple(allocator: Allocator, target: std.Target) ![]const u8 { .callable => "callable", .mesh => "mesh", .amplification => "amplification", + .ohos => "ohos", }; try llvm_triple.appendSlice(llvm_abi); diff --git a/src/target.zig b/src/target.zig index 8f61b2ba03170ad775b267abc682e113242fcd3f..6af301e001015817013a267a9d517ad5b912bbee 100644 --- a/src/target.zig +++ b/src/target.zig @@ -45,7 +45,8 @@ 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()); + (linking_libc and target.isGnuLibC()) or + (target.abi == .ohos and target.cpu.arch == .aarch64); } /// This is not whether the target supports Position Independent Code, but whether the -fPIC