From f19f943a6699d771ef85402998a56743d6dfa3d9 Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Fri, 3 Mar 2017 16:58:46 +0000 Subject: [PATCH] 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 --- src/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/meson.build b/src/meson.build index 3610af3..ecd032a 100644 --- a/src/meson.build +++ b/src/meson.build @@ -52,7 +52,7 @@ foreach h: headers endforeach if cc.get_id() == 'gcc' - common_ldflags = [ '-Wl,-Bsymbolic', ] + common_ldflags = [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ] else common_ldflags = [] endif