AIX: Add ExportImportList option to skip the object files

This commit is contained in:
Brad King
2020-01-30 10:22:56 -05:00
parent 0dcfb63cb9
commit 0ffd54f094

View File

@@ -5,7 +5,7 @@
# 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> [-l <lib>] [--] <objects>...'
usage='usage: ExportImportList -o <out-file> [-l <lib>] [-n] [--] <objects>...'
die() {
echo "$@" 1>&2; exit 1
@@ -14,10 +14,12 @@ die() {
# Process command-line arguments.
out=''
lib=''
no_objects=''
while test "$#" != 0; do
case "$1" in
-l) shift; lib="$1" ;;
-o) shift; out="$1" ;;
-n) no_objects='1' ;;
--) shift; break ;;
-*) die "$usage" ;;
*) break ;;
@@ -32,20 +34,22 @@ trap 'rm -f "$out_tmp"' EXIT INT TERM
> "$out_tmp"
# Collect symbols exported from all object files.
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)]
if test -z "$no_objects"; then
for f in "$@"; do
dump -tov -X 32_64 "$f" |
awk '
BEGIN {
V["EXPORTED"]=" export"
V["PROTECTED"]=" protected"
}
}
'
done >> "$out_tmp"
/^\[[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"
fi
# Generate the export/import file.
{