summaryrefslogtreecommitdiffstats
path: root/Modules/Platform/AIX
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
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')
-rwxr-xr-xModules/Platform/AIX/ExportImportList48
1 files changed, 48 insertions, 0 deletions
diff --git a/Modules/Platform/AIX/ExportImportList b/Modules/Platform/AIX/ExportImportList
new file mode 100755
index 0000000..c17378c
--- /dev/null
+++ b/Modules/Platform/AIX/ExportImportList
@@ -0,0 +1,48 @@
+#!/bin/sh
+# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
+# file Copyright.txt or https://cmake.org/licensing for details.
+
+# This script is internal to CMake and meant only to be
+# invoked by CMake-generated build systems on AIX.
+
+usage='usage: ExportImportList -o <out-file> [--] <objects>...'
+
+die() {
+ echo "$@" 1>&2; exit 1
+}
+
+# Process command-line arguments.
+out=''
+while test "$#" != 0; do
+ case "$1" in
+ -o) shift; out="$1" ;;
+ --) shift; break ;;
+ -*) die "$usage" ;;
+ *) break ;;
+ esac
+ shift
+done
+test -n "$out" || die "$usage"
+
+# Collect symbols exported from all object files.
+out_tmp="$out.tmp$$"
+trap 'rm -f "$out_tmp"' EXIT INT TERM
+for f in "$@"; do
+ dump -tov -X 32_64 "$f" |
+ awk '
+ BEGIN {
+ V["EXPORTED"]=" export"
+ V["PROTECTED"]=" protected"
+ }
+ /^\[[0-9]+\]\tm +[^ ]+ +\.(text|data|bss) +[^ ]+ +(extern|weak) +(EXPORTED|PROTECTED| ) / {
+ if (!match($NF,/^(\.|__sinit|__sterm|__[0-9]+__)/)) {
+ print $NF V[$(NF-1)]
+ }
+ }
+ '
+done > "$out_tmp"
+
+# Generate the export/import file.
+{
+ sort -u "$out_tmp"
+} > "$out"