From 8924b63d5a552d8055c84affa96093655c56de58 Mon Sep 17 00:00:00 2001 From: "Anton D. Kachalov" Date: Mon, 14 Dec 2020 05:39:05 -0800 Subject: [PATCH] Add hardening linker options. PiperOrigin-RevId: 347367335 Change-Id: Ia7d707bd3e7e58021fc3bb14df13a9f06c5e2735 --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5996d17..b06272c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,6 +60,7 @@ add_compile_options(-fno-exceptions) if(SAPI_HARDENED_SOURCE) add_compile_options(-fstack-protector -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2) + add_link_options(-Wl,-z,relro -Wl,-z,now) endif() # Make Bazel-style includes work