about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-04-13 15:05:19 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-04-13 15:09:03 +0200
commit643b950eef38d30439aabde32050bdf0995ce8cf (patch)
tree3f8aaec580389fc209883845818287e653c90d7a
parent63a20f537afeea28ac31dad1623e30a32ca75535 (diff)
downloadbox64-643b950eef38d30439aabde32050bdf0995ce8cf.tar.gz
box64-643b950eef38d30439aabde32050bdf0995ce8cf.zip
Add option to ovoid building fixed address
-rwxr-xr-xCMakeLists.txt11
1 files changed, 9 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1c2cdf2b..100c4fd8 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,6 +5,7 @@ option(RK3326 "Set to ON if targeting an Rockchip RK3326 based device" ${RK3326}
 option(RK3399 "Set to ON if targeting an Rockchip RK3399 based device" ${RK3399})
 option(USE_CCACHE "Set to ON to use ccache if present in the system" ${USE_CCACHE})
 option(HAVE_TRACE "Set to ON to have Trace ability (needs ZydisInfo library)" ${HAVE_TRACE})
+option(NOLOADADDR "Set to ON to avoid fixing the load address of Box64" ${NO_LOADAADR})
 option(NOGIT "Set to ON if not building from a git clone repo (like when building from a zip download from github)" ${NOGIT})
 if(RK3399 OR RPI4ARM64 OR RK3326)
     set(LD80BITS OFF CACHE BOOL "")
@@ -370,10 +371,16 @@ if(ARM_DYNAREC)
 endif()
 
 if(${CMAKE_VERSION} VERSION_LESS "3.13")
-    set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-rdynamic -Wl,-Ttext-segment,${BOX64_ELF_ADDRESS}")
+    if(NOT NOLOADADDR)
+        set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-rdynamic -Wl,-Ttext-segment,${BOX64_ELF_ADDRESS}")
+    else()
+        set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-rdynamic")
+    endif()
 else()
     target_link_options(${BOX64} PUBLIC -rdynamic)
-    target_link_options(${BOX64} PUBLIC -Wl,-Ttext-segment,${BOX64_ELF_ADDRESS})
+    if(NOT NOLOADADDR)
+        target_link_options(${BOX64} PUBLIC -Wl,-Ttext-segment,${BOX64_ELF_ADDRESS})
+    endif()
 endif()
 
 string(COMPARE EQUAL "${CMAKE_HOST_SYSTEM_PROCESSOR}" "i686"  _x86)