From 5816d3eaec3f3bb04e70c89aa402ba9e0e5e7b2c Mon Sep 17 00:00:00 2001 From: Isaac Freund Date: Thu, 9 Jun 2022 00:06:16 +0200 Subject: linker: remove `-z noexecstack` option Note that the current documentation for the `-z noexecstack` is incorrect. This indicates that an object *does not* require an executable stack. This is actually the default of LLD, and there has never been a way to override this default by passing `-z execstack` to LLD. This commit removes the redundant `-z noexecstack` option from zig build-exe/build-lib/build-obj and ignores the option if passed to zig cc for compatibility. As far as I can tell, there is no reason for code to require an executable stack. This option only exists because the stack was originally executable by default and some programs came to depend on that behavior. Instead, mprotect(2) may be used to make memory pages executable. --- src/Compilation.zig | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/Compilation.zig') diff --git a/src/Compilation.zig b/src/Compilation.zig index 7d686b2f40..b98548e9dc 100644 --- a/src/Compilation.zig +++ b/src/Compilation.zig @@ -762,7 +762,6 @@ pub const InitOptions = struct { linker_z_notext: bool = false, linker_z_defs: bool = false, linker_z_origin: bool = false, - linker_z_noexecstack: bool = false, linker_z_now: bool = true, linker_z_relro: bool = true, linker_z_nocopyreloc: bool = false, @@ -1602,7 +1601,6 @@ pub fn create(gpa: Allocator, options: InitOptions) !*Compilation { .z_defs = options.linker_z_defs, .z_origin = options.linker_z_origin, .z_nocopyreloc = options.linker_z_nocopyreloc, - .z_noexecstack = options.linker_z_noexecstack, .z_now = options.linker_z_now, .z_relro = options.linker_z_relro, .tsaware = options.linker_tsaware, @@ -2350,7 +2348,6 @@ fn addNonIncrementalStuffToCacheManifest(comp: *Compilation, man: *Cache.Manifes man.hash.add(comp.bin_file.options.z_defs); man.hash.add(comp.bin_file.options.z_origin); man.hash.add(comp.bin_file.options.z_nocopyreloc); - man.hash.add(comp.bin_file.options.z_noexecstack); man.hash.add(comp.bin_file.options.z_now); man.hash.add(comp.bin_file.options.z_relro); man.hash.add(comp.bin_file.options.hash_style); -- cgit v1.2.3