From d9da52d5616fed6f1d48422d82f23ad3dae946a9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 26 Jun 2019 16:19:13 +0200 Subject: [PATCH] Clean up application module visibility on Android Disable ELF visibility using CMake properties on the shared object that's supposed to contain main(). Change-Id: I9cdbb2a76ad66cf2742280ddfea47908eaff2370 Reviewed-by: Leander Beernaert Reviewed-by: Alexandru Croitor --- src/corelib/Qt6CoreMacros.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/corelib/Qt6CoreMacros.cmake b/src/corelib/Qt6CoreMacros.cmake index d82a65e4a6a..7f40038e4a6 100644 --- a/src/corelib/Qt6CoreMacros.cmake +++ b/src/corelib/Qt6CoreMacros.cmake @@ -392,6 +392,12 @@ endif() function(add_qt_gui_executable target) if(ANDROID) add_library("${target}" MODULE ${ARGN}) + # On our qmake builds we do don't compile the executables with + # visibility=hidden. Not having this flag set will cause the + # executable to have main() hidden and can then no longer be loaded + # through dlopen() + set_property(TARGET "${target}" PROPERTY C_VISIBILITY_PRESET default) + set_property(TARGET "${target}" PROPERTY CXX_VISIBILITY_PRESET default) else() add_executable("${target}" WIN32 MACOSX_BUNDLE ${ARGN}) endif() @@ -399,11 +405,6 @@ function(add_qt_gui_executable target) if(ANDROID) qt_android_generate_deployment_settings("${target}") - # On our qmake builds we do don't compile the executables with - # visibility=hidden. Not having this flag set will cause the - # executable to have main() hidden and can then no longer be loaded - # through dlopen() - target_compile_options(${target} PRIVATE -fvisibility=default) endif() endfunction()