Commit ba60d456b4
Changed files (3)
lib
std
lib/std/target.zig
@@ -944,7 +944,7 @@ pub const Target = struct {
};
}
- pub fn isSPIRV(arch: Arch) bool {
+ pub fn isSpirV(arch: Arch) bool {
return switch (arch) {
.spirv32, .spirv64 => true,
else => false,
@@ -1534,6 +1534,10 @@ pub const Target = struct {
return !self.cpu.arch.isWasm();
}
+ pub fn isSpirV(self: Target) bool {
+ return self.cpu.arch.isSpirV();
+ }
+
pub const FloatAbi = enum {
hard,
soft,
src/Compilation.zig
@@ -722,10 +722,11 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation {
// Once they are capable this condition could be removed. When removing this condition,
// also test the use case of `build-obj -fcompiler-rt` with the native backends
// and make sure the compiler-rt symbols are emitted.
- const capable_of_building_compiler_rt = build_options.have_llvm and options.target.os.tag != .plan9;
-
- const capable_of_building_zig_libc = build_options.have_llvm and options.target.os.tag != .plan9;
- const capable_of_building_ssp = build_options.have_llvm and options.target.os.tag != .plan9;
+ const is_p9 = options.target.os.tag == .plan9;
+ const is_spv = options.target.cpu.arch.isSpirV();
+ const capable_of_building_compiler_rt = build_options.have_llvm and !is_p9 and !is_spv;
+ const capable_of_building_zig_libc = build_options.have_llvm and !is_p9 and !is_spv;
+ const capable_of_building_ssp = build_options.have_llvm and !is_p9 and !is_spv;
const comp: *Compilation = comp: {
// For allocations that have the same lifetime as Compilation. This arena is used only during this
src/target.zig
@@ -163,7 +163,7 @@ pub fn canBuildLibC(target: std.Target) bool {
pub fn cannotDynamicLink(target: std.Target) bool {
return switch (target.os.tag) {
.freestanding, .other => true,
- else => false,
+ else => target.isSpirV(),
};
}
@@ -331,18 +331,18 @@ pub fn supportsStackProbing(target: std.Target) bool {
}
pub fn supportsStackProtector(target: std.Target) bool {
- _ = target;
- return true;
+ return !target.isSpirV();
}
pub fn libcProvidesStackProtector(target: std.Target) bool {
- return !target.isMinGW() and target.os.tag != .wasi;
+ return !target.isMinGW() and target.os.tag != .wasi and !target.isSpirV();
}
pub fn supportsReturnAddress(target: std.Target) bool {
return switch (target.cpu.arch) {
.wasm32, .wasm64 => target.os.tag == .emscripten,
.bpfel, .bpfeb => false,
+ .spirv32, .spirv64 => false,
else => true,
};
}