Add z,relro and z,now to the GCC linker flags

These flags are mitigations against memory corruption bugs, and are
typically enabled by Linux distributions hardening rules.

We only use these flags with GCC, similarly to `-Bsymbolic`.

More information on relro is available here:

 - http://tk-blog.blogspot.co.uk/2009/02/relro-not-so-well-known-memory.html
 - http://mudongliang.github.io/2016/07/11/relro-a-not-so-well-known-memory-corruption-mitigation-technique.html
 - https://wiki.debian.org/Hardening#DEB_BUILD_HARDENING_RELRO_.28ld_-z_relro.29
macos/v1.5.9
Emmanuele Bassi 8 years ago
parent 7d58fd3d47
commit f19f943a66
  1. 2
      src/meson.build

@ -52,7 +52,7 @@ foreach h: headers
endforeach endforeach
if cc.get_id() == 'gcc' if cc.get_id() == 'gcc'
common_ldflags = [ '-Wl,-Bsymbolic', ] common_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ]
else else
common_ldflags = [] common_ldflags = []
endif endif

Loading…
Cancel
Save