1996-08-08 21:05:09 +02:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# ===========================================================================
|
|
|
|
# FILE: makexp_aix
|
|
|
|
# TYPE: standalone executable
|
2020-11-16 16:16:10 +01:00
|
|
|
# SYSTEM: AIX
|
1996-08-08 21:05:09 +02:00
|
|
|
#
|
|
|
|
# DESCRIPTION: This script creates an export list of ALL global symbols
|
|
|
|
# from a list of object or archive files.
|
|
|
|
#
|
|
|
|
# USAGE: makexp_aix <OutputFile> "<FirstLine>" <InputFile> ...
|
|
|
|
#
|
|
|
|
# where:
|
|
|
|
# <OutputFile> is the target export list filename.
|
|
|
|
# <FirstLine> is the path/file string to be appended
|
|
|
|
# after the "#!" symbols in the first line of the
|
|
|
|
# export file. Passing "" means deferred resolution.
|
|
|
|
# <InputFile> is an object (.o) or an archive file (.a).
|
|
|
|
#
|
|
|
|
# HISTORY:
|
1998-04-09 23:46:02 +02:00
|
|
|
# 3-Apr-1998 -- remove C++ entries of the form Class::method
|
|
|
|
# Vladimir Marangozov
|
|
|
|
#
|
1996-08-08 21:05:09 +02:00
|
|
|
# 1-Jul-1996 -- added header information
|
|
|
|
# Vladimir Marangozov
|
|
|
|
#
|
|
|
|
# 28-Jun-1996 -- initial code
|
|
|
|
# Vladimir Marangozov (Vladimir.Marangozov@imag.fr)
|
|
|
|
# ==========================================================================
|
|
|
|
|
|
|
|
# Variables
|
|
|
|
expFileName=$1
|
|
|
|
toAppendStr=$2
|
|
|
|
shift; shift;
|
|
|
|
inputFiles=$*
|
|
|
|
automsg="Generated automatically by makexp_aix"
|
|
|
|
notemsg="NOTE: lists _all_ global symbols defined in the above file(s)."
|
|
|
|
curwdir=`pwd`
|
|
|
|
|
|
|
|
# Create the export file and setup the header info
|
|
|
|
echo "#!"$toAppendStr > $expFileName
|
|
|
|
echo "*" >> $expFileName
|
|
|
|
echo "* $automsg (`date -u`)" >> $expFileName
|
|
|
|
echo "*" >> $expFileName
|
|
|
|
echo "* Base Directory: $curwdir" >> $expFileName
|
|
|
|
echo "* Input File(s) : $inputFiles" >> $expFileName
|
|
|
|
echo "*" >> $expFileName
|
|
|
|
echo "* $notemsg" >> $expFileName
|
|
|
|
echo "*" >> $expFileName
|
|
|
|
|
2020-11-16 16:16:10 +01:00
|
|
|
# Extract the symbol list using 'nm'
|
1996-08-08 21:05:09 +02:00
|
|
|
# Here are some hidden tricks:
|
2020-11-16 16:16:10 +01:00
|
|
|
# - Use the -B flag to have a standard BSD representation
|
|
|
|
# of the symbol list.
|
|
|
|
# - Use the -x flag to have a hex representation of the symbol
|
|
|
|
# values. This fills the leading whitespaces, thus simplifying
|
|
|
|
# the sed statement.
|
|
|
|
# - Eliminate all entries except those with either "B", "D"
|
|
|
|
# or "T" key letters. We are interested only in the global
|
|
|
|
# (extern) BSS, DATA and TEXT symbols. With the same statement
|
|
|
|
# we eliminate object member lines relevant to AIX 4.
|
|
|
|
# - Eliminate entries containing a dot. We can have a dot only
|
|
|
|
# as a symbol prefix, but such symbols are undefined externs.
|
|
|
|
# - Eliminate everything including the key letter, so that we're
|
|
|
|
# left with just the symbol name.
|
|
|
|
# - Eliminate all entries containing two colons, like Class::method
|
1996-08-08 21:05:09 +02:00
|
|
|
#
|
2005-09-14 20:09:42 +02:00
|
|
|
|
2020-11-16 16:16:10 +01:00
|
|
|
/usr/ccs/bin/nm -Bex -X32_64 $inputFiles \
|
1998-04-09 23:46:02 +02:00
|
|
|
| sed -e '/ [^BDT] /d' -e '/\./d' -e 's/.* [BDT] //' -e '/::/d' \
|
1996-08-08 21:05:09 +02:00
|
|
|
| sort | uniq >> $expFileName
|