Commit 8aae0d87b5
Changed files (4)
lib
std
src
codegen
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,
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,
};
}
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);
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