Debian Codegraph @

unix/ldAix

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # ldAix ldCmd ldArg ldArg ...
4 #
5 # This shell script provides a wrapper for ld under AIX in order to
6 # create the .exp file required for linking. Its arguments consist
7 # of the name and arguments that would normally be provided to the
8 # ld command. This script extracts the names of the object files
9 # from the argument list, creates a .exp file describing all of the
10 # symbols exported by those files, and then invokes "ldCmd" to
11 # perform the real link.
12
13 # Extract from the arguments the names of all of the object files.
14
15 args=$*
16 ofiles=""
17 for i do
18 x=`echoscip-shell system . . echo. $i | grepscip-shell system . . grep. '[^.].o$'`
19 if testscip-shell system . . test. "$x" != ""; then
20 ofiles="$ofiles $i"
21 fi
22 done
23
24 # Extract the name of the object file that we're linking.
25 outputFile=`echoscip-shell system . . echo. $args | sedscip-shell system . . sed. -e 's/.*-o \([^ ]*\).*/\1/'`
26
27 # Create the export file from all of the object files, using nm followed
28 # by sed editing. Here are some tricky aspects of this:
29 #
30 # - Use the -X32_64 switch to nm to handle 32 or 64bit compiles.
31 # - Eliminate lines that end in ":": these are the names of object files
32 # - Eliminate entries with the "U" key letter; these are undefined symbols
33 # - If a line starts with ".", delete the leading ".", since this will just
34 # cause confusion later
35 # - Eliminate everything after the first field in a line, so that we're
36 # left with just the symbol name
37
38 nmopts="-g -C -h -X32_64"
39 rmscip-shell system . . rm. -f lib.exp
40 echoscip-shell system . . echo. "#! $outputFile" >lib.exp
41 /usr/ccs/bin/nmscip-shell filesystem . . `/usr/ccs/bin/nm`. $nmopts $ofiles | sedscip-shell system . . sed. -e '/:$/dscip-shell filesystem . . `/:$/d`.' -e '/ U /dscip-shell filesystem . . `/ U /d`.' -e 's/^\.//' -e 's/[ |].*//' | sortscip-shell system . . sort. | uniqscip-shell system . . uniq. >>lib.exp
42
43 # If we're linking a .a file, then link all the objects together into a
44 # single file "shr.o" and then put that into the archive. Otherwise link
45 # the object files directly into the .a file.
46
47 noDotA=`echoscip-shell system . . echo. $outputFile | sedscip-shell system . . sed. -e '/\.a$/dscip-shell filesystem . . `/\.a$/d`.'`
48 echoscip-shell system . . echo. "noDotA=\"$noDotA\""
49 if testscip-shell system . . test. "$noDotA" = "" ; then
50 linkArgs=`echoscip-shell system . . echo. $args | sedscip-shell system . . sed. -e 's/-o .*\.a /-o shr.o /'`
51 echoscip-shell system . . echo. $linkArgs
52 eval $linkArgs
53 echoscip-shell system . . echo. ar cr $outputFile shr.o
54 arscip-shell system . . ar. cr $outputFile shr.o
55 rmscip-shell system . . rm. -f shr.o
56 else
57 eval $args
58 fi