diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2020-11-22 17:30:34 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-11-22 17:30:34 -0700 |
| commit | c7170e4a5480581db5f30913eebd9ad4f7cd121e (patch) | |
| tree | fba79b8f4241c94f886e7708d18081e8fc0e31fe /lib/std/start.zig | |
| parent | 98d5bfbd4d21e99363a0a68ef5a0d0104c302ecb (diff) | |
| parent | abc717f203060f7ab16d36f2afe681d838b46801 (diff) | |
| download | zig-c7170e4a5480581db5f30913eebd9ad4f7cd121e.tar.gz zig-c7170e4a5480581db5f30913eebd9ad4f7cd121e.zip | |
Support PIE (Position Independent Executables)
Closes #4503
Revives #3960
Merges branch 'pie' into master
Diffstat (limited to 'lib/std/start.zig')
| -rw-r--r-- | lib/std/start.zig | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/std/start.zig b/lib/std/start.zig index de8d035315..6e15dad84c 100644 --- a/lib/std/start.zig +++ b/lib/std/start.zig @@ -202,6 +202,12 @@ fn posixCallMainAndExit() noreturn { // Find the beginning of the auxiliary vector const auxv = @ptrCast([*]std.elf.Auxv, @alignCast(@alignOf(usize), envp.ptr + envp_count + 1)); std.os.linux.elf_aux_maybe = auxv; + + // Do this as early as possible, the aux vector is needed + if (builtin.position_independent_executable) { + @import("os/linux/start_pie.zig").apply_relocations(); + } + // Initialize the TLS area std.os.linux.tls.initStaticTLS(); |
