| author | |
| committer | |
| log | ebaec8e03f46f15fe194f6b794c34816a416dc88 |
| tree | 054de5beb25a25e5ed7d6ae412de5beedd652d8c |
| parent | 135f1915daf8583a4dee81691da70cbeb14004f8 |
| signature |
We already have test/cases/pie_linux.zig covering this.3 files changed, 0 insertions(+), 44 deletions(-)
test/standalone/build.zig.zon-3| ... | ... | @@ -136,9 +136,6 @@ |
| 136 | 136 | .c_embed_path = .{ |
| 137 | 137 | .path = "c_embed_path", |
| 138 | 138 | }, |
| 139 | .pie = .{ | |
| 140 | .path = "pie", | |
| 141 | }, | |
| 142 | 139 | .issue_12706 = .{ |
| 143 | 140 | .path = "issue_12706", |
| 144 | 141 | }, |
test/standalone/pie/build.zig deleted-26| ... | ... | @@ -1,26 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | ||
| 3 | pub fn build(b: *std.Build) void { | |
| 4 | const test_step = b.step("test", "Test it"); | |
| 5 | b.default_step = test_step; | |
| 6 | ||
| 7 | const optimize: std.builtin.OptimizeMode = .Debug; | |
| 8 | const target = b.resolveTargetQuery(.{ | |
| 9 | .os_tag = .linux, | |
| 10 | .cpu_arch = .x86_64, | |
| 11 | }); | |
| 12 | ||
| 13 | const main = b.addTest(.{ | |
| 14 | .root_module = b.createModule(.{ | |
| 15 | .root_source_file = b.path("main.zig"), | |
| 16 | .optimize = optimize, | |
| 17 | .target = target, | |
| 18 | }), | |
| 19 | }); | |
| 20 | main.pie = true; | |
| 21 | ||
| 22 | const run = b.addRunArtifact(main); | |
| 23 | run.skip_foreign_checks = true; | |
| 24 | ||
| 25 | test_step.dependOn(&run.step); | |
| 26 | } |
test/standalone/pie/main.zig deleted-15| ... | ... | @@ -1,15 +0,0 @@ |
| 1 | const std = @import("std"); | |
| 2 | const elf = std.elf; | |
| 3 | ||
| 4 | threadlocal var foo: u8 = 42; | |
| 5 | ||
| 6 | test "Check ELF header" { | |
| 7 | // PIE executables are marked as ET_DYN, regular exes as ET_EXEC. | |
| 8 | const header = @as(*elf.Ehdr, @ptrFromInt(std.process.getBaseAddress())); | |
| 9 | try std.testing.expectEqual(elf.ET.DYN, header.e_type); | |
| 10 | } | |
| 11 | ||
| 12 | test "TLS is initialized" { | |
| 13 | // Ensure the TLS is initialized by the startup code. | |
| 14 | try std.testing.expectEqual(@as(u8, 42), foo); | |
| 15 | } |