summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-07-12 16:55:55 (GMT)
committerBrad King <brad.king@kitware.com>2019-07-15 17:27:16 (GMT)
commit9f5c2040bfd41a2c87624cec3d9504cf477c9fc3 (patch)
tree9c3b008604781f25b8a43938c584d6a5627e8f90 /Tests
parent0f150b69d3a01c3c5b4a96d10334eb2703ba237f (diff)
downloadCMake-9f5c2040bfd41a2c87624cec3d9504cf477c9fc3.zip
CMake-9f5c2040bfd41a2c87624cec3d9504cf477c9fc3.tar.gz
CMake-9f5c2040bfd41a2c87624cec3d9504cf477c9fc3.tar.bz2
AIX: Explicitly compute executable exports for both XL and GNU
On AIX, symbols in executables must be exported in order to be visible to modules (plugins) they load via `dlopen`. Prior to policy `CMP0065`, CMake linked all executables with flags to export symbols, but the NEW behavior for that policy is to do so only for executables that have the `ENABLE_EXPORTS` target property set. In both cases, CMake has always used the AIX linker option `-bexpall` option to export symbols from executables. This has worked fairly well with the XL compiler, but with the GNU compiler it works only for C ABI symbols. The reason is that `-bexpall` does not export symbols starting in `_` but the GNU C++ ABI mangles all symbols with a leading `_`. Therefore we have only supported C ABI plugins with the GNU compiler on AIX. Some projects have tried to work around this by replacing `-bexpall` with `-bexpfull`, but the latter often exports symbols that we do not want exported. Avoid using `-bexpall` for executables by instead using by our own internal `ExportImportList` script to compute symbol export lists from the object files to be linked into an executable. Pass the explicitly computed export list to the AIX linker's `-bE:...` option. We already do this for shared object exports. Issue: #19163
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMP0065/RunCMakeTest.cmake7
-rw-r--r--Tests/RunCMake/CMakeLists.txt2
2 files changed, 6 insertions, 3 deletions
diff --git a/Tests/RunCMake/CMP0065/RunCMakeTest.cmake b/Tests/RunCMake/CMP0065/RunCMakeTest.cmake
index 254a4ec..e86b50e 100644
--- a/Tests/RunCMake/CMP0065/RunCMakeTest.cmake
+++ b/Tests/RunCMake/CMP0065/RunCMakeTest.cmake
@@ -1,8 +1,11 @@
include(RunCMake)
run_cmake(OLDBad1)
-run_cmake(OLDBad2)
-run_cmake(NEWBad)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "AIX")
+ # Tests with ENABLE_EXPORTS ON. For AIX we do not use the flags at all.
+ run_cmake(OLDBad2)
+ run_cmake(NEWBad)
+endif()
run_cmake(NEWGood)
run_cmake(WARN-OFF)
run_cmake(WARN-ON)
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 735ad5f..c952b1a 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -120,7 +120,7 @@ add_RunCMake_test(CMP0081)
# CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS variable, which both the VS and Xcode
# generators ignore. The policy will have no effect on those generators.
if(NOT CMAKE_GENERATOR MATCHES "Visual Studio|Xcode")
- add_RunCMake_test(CMP0065)
+ add_RunCMake_test(CMP0065 -DCMAKE_SYSTEM_NAME=${CMAKE_SYSTEM_NAME})
endif()
if(CMAKE_GENERATOR MATCHES "Make")
add_RunCMake_test(Make -DMAKE_IS_GNU=${MAKE_IS_GNU})