From 5d2834924cac70c274149223b60e34e5db649882 Mon Sep 17 00:00:00 2001 From: KreitinnSoftware Date: Tue, 3 Oct 2023 18:38:47 -0300 Subject: [PATCH] Use --image-base instead of -Ttext-segment on Clang Compilers --- CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e53f7d19a..1450214a7 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -714,14 +714,22 @@ endif() if(${CMAKE_VERSION} VERSION_LESS "3.13") if(NOT NOLOADADDR) - set_target_properties(${BOX86} PROPERTIES LINK_FLAGS "-rdynamic -Wl,-Ttext-segment,${BOX86_ELF_ADDRESS}") + if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + set_target_properties(${BOX86} PROPERTIES LINK_FLAGS "-rdynamic -Wl,--image-base,${BOX86_ELF_ADDRESS}") + else() + set_target_properties(${BOX86} PROPERTIES LINK_FLAGS "-rdynamic -Wl,-Ttext-segment,${BOX86_ELF_ADDRESS}") + endif() else() set_target_properties(${BOX86} PROPERTIES LINK_FLAGS -rdynamic) endif() else() target_link_options(${BOX86} PUBLIC -rdynamic) if(NOT NOLOADADDR) - target_link_options(${BOX86} PUBLIC -Wl,-Ttext-segment,${BOX86_ELF_ADDRESS}) + if(CMAKE_C_COMPILER_ID STREQUAL "Clang") + target_link_options(${BOX86} PUBLIC -Wl,--image-base,${BOX86_ELF_ADDRESS}) + else() + target_link_options(${BOX86} PUBLIC -Wl,-Ttext-segment,${BOX86_ELF_ADDRESS}) + endif() endif() endif()