Skip to content

Commit 1b01198

Browse files
committed
Always enable 16KB alignment for 64-bit Android.
1 parent 285bb4d commit 1b01198

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

CMake/TdSetUpCompiler.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,10 @@ function(td_set_up_compiler)
6565
set(TD_LINKER_FLAGS "-Wl,--gc-sections")
6666
elseif (ANDROID)
6767
set(TD_LINKER_FLAGS "-Wl,--gc-sections -Wl,--exclude-libs,ALL -Wl,--icf=safe")
68+
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
69+
# Enable 16 KB ELF alignment
70+
set(TD_LINKER_FLAGS "${TD_LINKER_FLAGS} -Wl,-z,max-page-size=16384")
71+
endif()
6872
else()
6973
set(TD_LINKER_FLAGS "-Wl,--gc-sections -Wl,--exclude-libs,ALL")
7074
endif()

example/android/CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,6 @@ if (CMAKE_CROSSCOMPILING)
4141
endif()
4242
target_compile_definitions(tdjni PRIVATE PACKAGE_NAME="org/drinkless/tdlib")
4343

44-
if (${ANDROID_ABI} STREQUAL "arm64-v8a" OR ${ANDROID_ABI} STREQUAL "x86_64")
45-
# Enable 16 KB ELF alignment.
46-
target_link_options(tdjni PRIVATE "-Wl,-z,max-page-size=16384")
47-
endif()
48-
4944
add_custom_command(TARGET tdjni POST_BUILD
5045
COMMAND ${CMAKE_COMMAND} -E rename $<TARGET_FILE:tdjni> $<TARGET_FILE:tdjni>.debug
5146
COMMAND ${CMAKE_STRIP} --strip-debug --strip-unneeded $<TARGET_FILE:tdjni>.debug -o $<TARGET_FILE:tdjni>)

0 commit comments

Comments
 (0)