Meta: Enable full RELRO on Linux

Pass -z relro and -z now to ELF linkers on Linux when the
linker supports them. This makes relocation sections read-only after
startup and disables lazy binding so the GOT is protected as well.
This commit is contained in:
Andreas Kling 2026-06-10 00:23:27 +02:00 committed by Andreas Kling
parent 67c9c62262
commit 30ec75ee74

View file

@ -199,6 +199,8 @@ endif()
if (LINUX)
add_cxx_compile_definitions(_FILE_OFFSET_BITS=64)
add_cxx_link_option_if_supported(LINKER:-z,relro)
add_cxx_link_option_if_supported(LINKER:-z,now)
endif()
if (APPLE)