Commit ad2be71514
Changed files (4)
test/cases/pic_freestanding.zig
@@ -0,0 +1,14 @@
+const builtin = @import("builtin");
+const std = @import("std");
+
+fn _start() callconv(.naked) void {}
+
+comptime {
+ @export(&_start, .{ .name = if (builtin.cpu.arch.isMIPS()) "__start" else "_start" });
+}
+
+// compile
+// backend=stage2,llvm
+// target=arm-freestanding,armeb-freestanding,thumb-freestanding,thumbeb-freestanding,aarch64-freestanding,aarch64_be-freestanding,loongarch64-freestanding,mips-freestanding,mipsel-freestanding,mips64-freestanding,mips64el-freestanding,powerpc-freestanding,powerpcle-freestanding,powerpc64-freestanding,powerpc64le-freestanding,riscv32-freestanding,riscv64-freestanding,s390x-freestanding,x86-freestanding,x86_64-freestanding
+// pic=true
+// output_mode=Exe
test/cases/pic_linux.zig
@@ -0,0 +1,14 @@
+const std = @import("std");
+
+// Eventually, this test should be made to work without libc by providing our
+// own `__tls_get_addr` implementation. powerpcle-linux should be added to the
+// target list here when that happens.
+//
+// https://github.com/ziglang/zig/issues/20625
+pub fn main() void {}
+
+// run
+// backend=stage2,llvm
+// target=arm-linux,armeb-linux,thumb-linux,thumbeb-linux,aarch64-linux,aarch64_be-linux,loongarch64-linux,mips-linux,mipsel-linux,mips64-linux,mips64el-linux,powerpc-linux,powerpc64-linux,powerpc64le-linux,riscv32-linux,riscv64-linux,s390x-linux,x86-linux,x86_64-linux
+// pic=true
+// link_libc=true
test/cases/pie_freestanding.zig
@@ -0,0 +1,16 @@
+const builtin = @import("builtin");
+const std = @import("std");
+
+// The self-hosted backends currently output a bunch of bad relocations for PIE,
+// so this test is LLVM only for now.
+fn _start() callconv(.naked) void {}
+
+comptime {
+ @export(&_start, .{ .name = if (builtin.cpu.arch.isMIPS()) "__start" else "_start" });
+}
+
+// compile
+// backend=llvm
+// target=arm-freestanding,armeb-freestanding,thumb-freestanding,thumbeb-freestanding,aarch64-freestanding,aarch64_be-freestanding,loongarch64-freestanding,mips-freestanding,mipsel-freestanding,mips64-freestanding,mips64el-freestanding,powerpc-freestanding,powerpcle-freestanding,powerpc64-freestanding,powerpc64le-freestanding,riscv32-freestanding,riscv64-freestanding,s390x-freestanding,x86-freestanding,x86_64-freestanding
+// pie=true
+// output_mode=Exe
test/cases/pie_linux.zig
@@ -0,0 +1,10 @@
+const std = @import("std");
+
+// The self-hosted backends can't handle `.hidden _DYNAMIC` and `.weak _DYNAMIC`
+// directives in inline assembly yet, so this test is LLVM only for now.
+pub fn main() void {}
+
+// run
+// backend=llvm
+// target=arm-linux,armeb-linux,thumb-linux,thumbeb-linux,aarch64-linux,aarch64_be-linux,loongarch64-linux,mips-linux,mipsel-linux,mips64-linux,mips64el-linux,powerpc-linux,powerpcle-linux,powerpc64-linux,powerpc64le-linux,riscv32-linux,riscv64-linux,s390x-linux,x86-linux,x86_64-linux
+// pie=true