Commit 40104f2145

Alex Rønne Petersen <alex@alexrp.com>
2024-10-15 20:34:56
compiler: Disallow function alignment for nvptx and spirv.
1 parent 7b8fc18
Changed files (2)
src/target.zig
@@ -487,7 +487,14 @@ pub fn minFunctionAlignment(target: std.Target) Alignment {
 
 pub fn supportsFunctionAlignment(target: std.Target) bool {
     return switch (target.cpu.arch) {
-        .wasm32, .wasm64 => false,
+        .nvptx,
+        .nvptx64,
+        .spirv,
+        .spirv32,
+        .spirv64,
+        .wasm32,
+        .wasm64,
+        => false,
         else => true,
     };
 }
test/cases/compile_errors/function_alignment_on_unsupported_target.zig
@@ -0,0 +1,7 @@
+export fn entry() align(0) void {}
+
+// error
+// backend=stage2
+// target=nvptx-cuda,nvptx64-cuda,spirv-vulkan,spirv32-opencl,spirv64-opencl,wasm32-freestanding,wasm64-freestanding
+//
+// :1:25: error: target does not support function alignment