Skip to content

Commit 4ec6746

Browse files
authored
Add pie flag to support ASLR (#1942)
IoT.js-DCO-1.0-Signed-off-by: Haesik Jun [email protected]
1 parent c35e675 commit 4ec6746

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,14 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
8888
if(HAS_NO_PIE AND NOT "${TARGET_OS}" STREQUAL "darwin")
8989
iotjs_add_link_flags(-no-pie)
9090
endif()
91+
else()
92+
93+
iotjs_add_compile_flags(-fPIE)
94+
if("${TARGET_OS}" STREQUAL "darwin")
95+
iotjs_add_link_flags(-Wl,-pie)
96+
else()
97+
iotjs_add_link_flags(-pie)
98+
endif()
9199
endif()
92100

93101
if (CREATE_SHARED_LIB)

0 commit comments

Comments
 (0)