summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/AIX-GNU.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-16 14:30:30 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-07-16 14:30:38 (GMT)
commitc3d9d800157a8fe2c0478d7e054544b99694c240 (patch)
treee723f303f577f058be0b5771053dbee027e6c32e /Modules/Platform/AIX-GNU.cmake
parent76a540bab5f05e4d523ce1b0480b0ee6424c676b (diff)
parentc2c3d22504728e0763c3d0e88333a34d24457fb6 (diff)
downloadCMake-c3d9d800157a8fe2c0478d7e054544b99694c240.zip
CMake-c3d9d800157a8fe2c0478d7e054544b99694c240.tar.gz
CMake-c3d9d800157a8fe2c0478d7e054544b99694c240.tar.bz2
Merge topic 'aix-explicit-exports'
c2c3d22504 Tests: Drop RunCMake workaround for AIX ld warnings about GNU atexit 9f5c2040bf AIX: Explicitly compute executable exports for both XL and GNU 0f150b69d3 AIX: Explicitly compute shared object exports for both XL and GNU a5bf4e7921 AIX: Drop redundant -brtl flags 9cb5f040d7 XL: De-duplicate shared object creation flags Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3556
Diffstat (limited to 'Modules/Platform/AIX-GNU.cmake')
-rw-r--r--Modules/Platform/AIX-GNU.cmake15
1 files changed, 12 insertions, 3 deletions
diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake
index 0abbb61..cec71a1 100644
--- a/Modules/Platform/AIX-GNU.cmake
+++ b/Modules/Platform/AIX-GNU.cmake
@@ -11,8 +11,6 @@ set(__AIX_COMPILER_GNU 1)
#
# By default, runtime linking is enabled. All shared objects specified on the command line
# will be listed, even if there are no symbols referenced, in the output file.
-string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " -Wl,-brtl")
-string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " -Wl,-brtl")
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,-brtl")
@@ -20,11 +18,22 @@ macro(__aix_compiler_gnu lang)
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:")
set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":")
string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-G,-bnoipath")
- set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall")
+ set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") # CMP0065 old behavior
set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1)
set(CMAKE_${lang}_LINK_FLAGS "-Wl,-bnoipath")
if(CMAKE_${lang}_COMPILER_VERSION VERSION_LESS 7 OR CMAKE_SYSTEM_VERSION VERSION_LESS 7.1)
unset(CMAKE_${lang}_COMPILE_OPTIONS_VISIBILITY)
endif()
+
+ # Construct the export list ourselves to pass only the object files so
+ # that we export only the symbols actually provided by the sources.
+ set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
+ "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/objects.exp <OBJECTS>"
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> <SONAME_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>"
+ )
+
+ set(CMAKE_${lang}_LINK_EXECUTABLE_WITH_EXPORTS
+ "\"${CMAKE_ROOT}/Modules/Platform/AIX/ExportImportList\" -o <OBJECT_DIR>/objects.exp <OBJECTS>"
+ "<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> -Wl,-bE:<OBJECT_DIR>/objects.exp <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
endmacro()