about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2021-07-30 14:42:01 +0200
committerptitSeb <sebastien.chev@gmail.com>2021-07-30 14:42:01 +0200
commit9f50a19856c8b48b0414b97ffcdfbe4e81feeec3 (patch)
tree7f368c7158942e01b303d882d858a8f95dd13072
parent6207b3fa386467fb4533136d4bd716d2bae3d4fd (diff)
downloadbox64-9f50a19856c8b48b0414b97ffcdfbe4e81feeec3.tar.gz
box64-9f50a19856c8b48b0414b97ffcdfbe4e81feeec3.zip
Try to handle Clang (for linker)
-rwxr-xr-xCMakeLists.txt12
1 files changed, 10 insertions, 2 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1a1fe66d..d71598b0 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -424,12 +424,20 @@ endif()
 
 if(${CMAKE_VERSION} VERSION_LESS "3.13")
     if(NOT NOLOADADDR)
-        set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-Wl,-Ttext-segment,${BOX64_ELF_ADDRESS}")
+        if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+            set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-Wl,--image_base=${BOX64_ELF_ADDRESS}")
+        else()
+            set_target_properties(${BOX64} PROPERTIES LINK_FLAGS "-Wl,-Ttext-segment,${BOX64_ELF_ADDRESS}")
+        endif()
     endif()
 else()
     # If symbols are missing, try this: target_link_options(${BOX64} PUBLIC -rdynamic)
     if(NOT NOLOADADDR)
-        target_link_options(${BOX64} PUBLIC LINKER:-Ttext-segment,${BOX64_ELF_ADDRESS})
+        if(CMAKE_C_COMPILER_ID STREQUAL "Clang")
+            target_link_options(${BOX64} PUBLIC LINKER:--image_base=${BOX64_ELF_ADDRESS})
+        else()
+            target_link_options(${BOX64} PUBLIC LINKER:-Ttext-segment,${BOX64_ELF_ADDRESS})
+        endif()
     endif()
 endif()