diff options
author | Brad King <brad.king@kitware.com> | 2016-10-21 13:12:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2016-10-21 14:43:45 (GMT) |
commit | 295c8efa359cbee22e45e6e9358990209b35aa39 (patch) | |
tree | ae83f951612f72fe2fade6e083ff31b3d68ca9de /Modules/Platform/Android | |
parent | 43f4326ece5035a5a028a7bb90a67c193804c997 (diff) | |
download | CMake-295c8efa359cbee22e45e6e9358990209b35aa39.zip CMake-295c8efa359cbee22e45e6e9358990209b35aa39.tar.gz CMake-295c8efa359cbee22e45e6e9358990209b35aa39.tar.bz2 |
Android: Add missing link flags for device executables
See `${ndk}/build/core/default-build-commands.mk` for link flags the NDK
uses for executables. Add them to our default executable link flags.
Suppress `nocopyreloc` on `arm64-v8a` because it does not work with
some STL types.
Closes: #16380
Diffstat (limited to 'Modules/Platform/Android')
-rw-r--r-- | Modules/Platform/Android/abi-arm64-v8a-Clang.cmake | 3 | ||||
-rw-r--r-- | Modules/Platform/Android/abi-arm64-v8a-GNU.cmake | 3 | ||||
-rw-r--r-- | Modules/Platform/Android/abi-common.cmake | 6 |
3 files changed, 12 insertions, 0 deletions
diff --git a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake index 3ff1fe5..e56b67b 100644 --- a/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake +++ b/Modules/Platform/Android/abi-arm64-v8a-Clang.cmake @@ -5,4 +5,7 @@ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -fpic" ) +# Suppress -Wl,-z,nocopyreloc flag on arm64-v8a +set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1) + include(Platform/Android/abi-common-Clang) diff --git a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake index 538ec2f..0bcfc86 100644 --- a/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake +++ b/Modules/Platform/Android/abi-arm64-v8a-GNU.cmake @@ -3,4 +3,7 @@ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -fpic" ) +# Suppress -Wl,-z,nocopyreloc flag on arm64-v8a +set(_ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc 1) + include(Platform/Android/abi-common-GNU) diff --git a/Modules/Platform/Android/abi-common.cmake b/Modules/Platform/Android/abi-common.cmake index 12d8e5c..84e7dbd 100644 --- a/Modules/Platform/Android/abi-common.cmake +++ b/Modules/Platform/Android/abi-common.cmake @@ -2,3 +2,9 @@ string(APPEND _ANDROID_ABI_INIT_CFLAGS " -funwind-tables" " -no-canonical-prefixes" ) + +string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -Wl,--gc-sections") + +if(NOT _ANDROID_ABI_INIT_EXE_LDFLAGS_NO_nocopyreloc) + string(APPEND _ANDROID_ABI_INIT_EXE_LDFLAGS " -Wl,-z,nocopyreloc") +endif() |