diff --git a/lib/std/Target.zig b/lib/std/Target.zig index d98236421c..5ede5809f3 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 44c318c359..4dc8586e3c 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 5b42a701ff..291e76f084 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 8f61b2ba03..6af301e001 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