From c79a6c9c9f80459eaf510afa70b46049feae5639 Mon Sep 17 00:00:00 2001 From: Haesik Jun Date: Wed, 24 Jun 2020 01:32:04 +0900 Subject: [PATCH] Add pie flag to support ASLR Change-Id: I290f3d929d77605a5efc692e4dff8de1a02b71cb Signed-off-by: Haesik Jun --- CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8321e0..b3266a4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,6 +82,13 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") if(HAS_NO_PIE AND NOT "${TARGET_OS}" STREQUAL "darwin") iotjs_add_link_flags(-no-pie) endif() +else() + iotjs_add_compile_flags(-fPIE) + if("${TARGET_OS}" STREQUAL "darwin") + iotjs_add_link_flags(-Wl,-pie) + else() + iotjs_add_link_flags(-pie) + endif() endif() if (CREATE_SHARED_LIB) -- 2.34.1