| author | |
| committer | |
| log | ba60d456b45bd391ec25195c800d61ab14de7985 |
| tree | cda4a72fce1d9f66c94f4b483c3aca8dbba79e47 |
| parent | 12ff36265448850add6917c20a49a7f56a95dfe4 |
| signature |
SPIR-V cannot build libc, ssp, compiler-rt, etc at the time of this commit, so
prevent trying to build them.3 files changed, 14 insertions(+), 9 deletions(-)
lib/std/target.zig+5-1| ... | ... | @@ -944,7 +944,7 @@ pub const Target = struct { |
| 944 | 944 | }; |
| 945 | 945 | } |
| 946 | 946 | |
| 947 | pub fn isSPIRV(arch: Arch) bool { | |
| 947 | pub fn isSpirV(arch: Arch) bool { | |
| 948 | 948 | return switch (arch) { |
| 949 | 949 | .spirv32, .spirv64 => true, |
| 950 | 950 | else => false, |
| ... | ... | @@ -1534,6 +1534,10 @@ pub const Target = struct { |
| 1534 | 1534 | return !self.cpu.arch.isWasm(); |
| 1535 | 1535 | } |
| 1536 | 1536 | |
| 1537 | pub fn isSpirV(self: Target) bool { | |
| 1538 | return self.cpu.arch.isSpirV(); | |
| 1539 | } | |
| 1540 | ||
| 1537 | 1541 | pub const FloatAbi = enum { |
| 1538 | 1542 | hard, |
| 1539 | 1543 | soft, |
src/Compilation.zig+5-4| ... | ... | @@ -722,10 +722,11 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { |
| 722 | 722 | // Once they are capable this condition could be removed. When removing this condition, |
| 723 | 723 | // also test the use case of `build-obj -fcompiler-rt` with the native backends |
| 724 | 724 | // and make sure the compiler-rt symbols are emitted. |
| 725 | const capable_of_building_compiler_rt = build_options.have_llvm and options.target.os.tag != .plan9; | |
| 726 | ||
| 727 | const capable_of_building_zig_libc = build_options.have_llvm and options.target.os.tag != .plan9; | |
| 728 | const capable_of_building_ssp = build_options.have_llvm and options.target.os.tag != .plan9; | |
| 725 | const is_p9 = options.target.os.tag == .plan9; | |
| 726 | const is_spv = options.target.cpu.arch.isSpirV(); | |
| 727 | const capable_of_building_compiler_rt = build_options.have_llvm and !is_p9 and !is_spv; | |
| 728 | const capable_of_building_zig_libc = build_options.have_llvm and !is_p9 and !is_spv; | |
| 729 | const capable_of_building_ssp = build_options.have_llvm and !is_p9 and !is_spv; | |
| 729 | 730 | |
| 730 | 731 | const comp: *Compilation = comp: { |
| 731 | 732 | // For allocations that have the same lifetime as Compilation. This arena is used only during this |
src/target.zig+4-4| ... | ... | @@ -163,7 +163,7 @@ pub fn canBuildLibC(target: std.Target) bool { |
| 163 | 163 | pub fn cannotDynamicLink(target: std.Target) bool { |
| 164 | 164 | return switch (target.os.tag) { |
| 165 | 165 | .freestanding, .other => true, |
| 166 | else => false, | |
| 166 | else => target.isSpirV(), | |
| 167 | 167 | }; |
| 168 | 168 | } |
| 169 | 169 | |
| ... | ... | @@ -331,18 +331,18 @@ pub fn supportsStackProbing(target: std.Target) bool { |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | pub fn supportsStackProtector(target: std.Target) bool { |
| 334 | _ = target; | |
| 335 | return true; | |
| 334 | return !target.isSpirV(); | |
| 336 | 335 | } |
| 337 | 336 | |
| 338 | 337 | pub fn libcProvidesStackProtector(target: std.Target) bool { |
| 339 | return !target.isMinGW() and target.os.tag != .wasi; | |
| 338 | return !target.isMinGW() and target.os.tag != .wasi and !target.isSpirV(); | |
| 340 | 339 | } |
| 341 | 340 | |
| 342 | 341 | pub fn supportsReturnAddress(target: std.Target) bool { |
| 343 | 342 | return switch (target.cpu.arch) { |
| 344 | 343 | .wasm32, .wasm64 => target.os.tag == .emscripten, |
| 345 | 344 | .bpfel, .bpfeb => false, |
| 345 | .spirv32, .spirv64 => false, | |
| 346 | 346 | else => true, |
| 347 | 347 | }; |
| 348 | 348 | } |