Rev 5084 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
#! /bin/sh# This script helps compiling a main program that will use dynamic# loading. It's needed on AIX since the linker has to know the export# list of the main program when compiling the shared libs that the# main program will load (with dlopen ()). It creates a file# "lib.exp" (or whatever you tell it to name it). This file contains# the export list for the main program (i.e. ".").## For this stage we automatically add "-bE:lib.exp". For the shared# libs you'll have to add "-bI:lib.exp" (maybe with a path).## This is only tested for AIX 4.2.#set -xusage="Usage: `basename $0` [-o <expfile>] ld <args for ld ...>"if [ ${1-"-h"} = "-h" ]; thenecho 1>&2 "$usage"exit 1fi# Check for name of export filecase $1 in-o)mainexp=${2?$usage}shift 2;;-o*)mainexp=$1mainexp=${mainexp#-o}shift;;*)mainexp="lib.exp";;esac# Check for object or archive filesofiles=""for arg; docase $arg in *.o) ofiles="$ofiles $arg";; esaccase $arg in *.a) ofiles="$ofiles $arg";; esacdone# Call nm so that it prints only global sympols (unsorted, w/o header)nm=nmnmopts="-p -g -h"# Replace ".funname T adr1 adr2" with "funname"regex1='s,^\.\([a-zA-Z][a-zA-Z0-9_]*\) *T .*$,\1,p'# Replace "varname B adr1 adr2" with "varname bss"regex2='s,^\([a-zA-Z][a-zA-Z0-9_]*\) *B .*$,\1 bss,p'echo "#! ." > $mainexp$nm $nmopts $ofiles | sed -n -e "$regex1" -e "$regex2" | \sort | uniq >> $mainexpexit $?