diff options
author | Dmitry Marakasov <amdmi3@amdmi3.ru> | 2021-05-15 11:15:03 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-15 10:15:03 +0200 |
commit | 53dca4f95fb48d2a16e1f26f01515d4811aab78d (patch) | |
tree | ac31fe42ea0319f5451e8ce0eea620d3f5dcd470 | |
parent | 69c70dd319532f7860f211f4a527a902b0386e49 (diff) | |
download | minetest-53dca4f95fb48d2a16e1f26f01515d4811aab78d.tar.gz minetest-53dca4f95fb48d2a16e1f26f01515d4811aab78d.tar.bz2 minetest-53dca4f95fb48d2a16e1f26f01515d4811aab78d.zip |
Use --image-base instead of -Ttext-segment for lld linker on FreeBSD (#9367) (#11263)
-rw-r--r-- | src/CMakeLists.txt | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9526e88f9..2a2adfaf0 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -758,7 +758,16 @@ else() check_c_source_compiles("#ifndef __aarch64__\n#error\n#endif\nint main(){}" IS_AARCH64) if(IS_AARCH64) # Move text segment below LuaJIT's 47-bit limit (see issue #9367) - SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Ttext-segment=0x200000000") + if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + # FreeBSD uses lld, and lld does not support -Ttext-segment, suggesting + # --image-base instead. Not sure if it's equivalent change for the purpose + # but at least if fixes build on FreeBSD/aarch64 + # XXX: the condition should also be changed to check for lld regardless of + # os, bit CMake doesn't have anything like CMAKE_LINKER_IS_LLD yet + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--image-base=0x200000000") + else() + SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Ttext-segment=0x200000000") + endif() endif() endif() |