Guido van Rossum | b4ae6a3 | 1996-08-08 19:05:09 +0000 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # ======================================================================== |
| 4 | # FILE: ld_so_aix |
| 5 | # TYPE: executable, uses makexp_aix |
| 6 | # SYSTEM: AIX |
| 7 | # |
| 8 | # DESCRIPTION: Creates a shareable .o from a pre-compiled (unshared) |
| 9 | # .o file |
| 10 | # |
Guido van Rossum | a93b504 | 1996-08-08 19:06:31 +0000 | [diff] [blame^] | 11 | # USAGE: ld_so_aix [CC] [arguments] |
| 12 | # |
| 13 | # ARGUMENTS: Same as for "ld". The -bM, -bE, -bI, -H, -T, and -lm |
| 14 | # arguments will be supplied by this script. The compiler |
| 15 | # specific ("-lc" or "-lc_r", "-lpthreads", etc) arguments |
| 16 | # will be automatically passed to "ld" according to the CC |
| 17 | # command provided as a first argument to this script. |
| 18 | # Usually, the same CC command was used to produce the |
| 19 | # pre-compiled .o file. |
Guido van Rossum | b4ae6a3 | 1996-08-08 19:05:09 +0000 | [diff] [blame] | 20 | # |
| 21 | # NOTES: 1. Currently specific to the building of Python |
| 22 | # interpreter shared objects, in that the entry |
| 23 | # point name is hardcoded based on the object file |
| 24 | # name (the "mathmodule.o" file will expect an |
| 25 | # entry point of "initmath"). This could be remedied |
| 26 | # by the support (or simple expectation) of a "-e" |
| 27 | # argument. |
| 28 | # 2. The resulting shared object file is left in the |
| 29 | # current directory with the extension .so |
| 30 | # 3. Uncommenting the "echo" lines gives detailed output |
| 31 | # about the commands executed in the script. |
| 32 | # |
Guido van Rossum | a93b504 | 1996-08-08 19:06:31 +0000 | [diff] [blame^] | 33 | # HISTORY: Aug-6-1996 -- Take care of the compiler specific -- |
| 34 | # -- args by leaving CC to invoke "ld". -- |
| 35 | # Vladimir Marangozov |
| 36 | # |
| 37 | # Jul-1-1996 -- Make sure to use /usr/ccs/bin/ld -- |
Guido van Rossum | b4ae6a3 | 1996-08-08 19:05:09 +0000 | [diff] [blame] | 38 | # -- Use makexp_aix for the export list. -- |
| 39 | # Vladimir Marangozov (Vladimir.Marangozov@imag.fr) |
| 40 | # |
| 41 | # Manus Hand (mhand@csn.net) -- Initial code -- 6/24/96 |
| 42 | # ======================================================================== |
| 43 | # |
| 44 | |
| 45 | # Variables |
Guido van Rossum | a93b504 | 1996-08-08 19:06:31 +0000 | [diff] [blame^] | 46 | CC=$1; shift |
| 47 | |
| 48 | objfile=$1; shift |
Guido van Rossum | b4ae6a3 | 1996-08-08 19:05:09 +0000 | [diff] [blame] | 49 | filename=`echo $objfile | sed -e "s:.*/\([^/]*\)$:\1:" -e "s/\..*$//"` |
| 50 | entry=init`echo $filename | sed "s/module.*//"` |
Guido van Rossum | a93b504 | 1996-08-08 19:06:31 +0000 | [diff] [blame^] | 51 | expfile="$filename.exp" |
| 52 | impfile="python.exp" |
| 53 | |
| 54 | CCOPT="-Wl,-e$entry -Wl,-bE:$expfile -Wl,-bI:$impfile" |
| 55 | CCOPT="$CCOPT -Wl,-bM:SRE -Wl,-T512 -Wl,-H512 -lm" |
| 56 | CCARGS="$objfile $*" |
Guido van Rossum | b4ae6a3 | 1996-08-08 19:05:09 +0000 | [diff] [blame] | 57 | |
| 58 | # Export list generation |
| 59 | makexp_aix $filename.exp "$objfile" $objfile |
| 60 | |
| 61 | # Perform the link. |
Guido van Rossum | a93b504 | 1996-08-08 19:06:31 +0000 | [diff] [blame^] | 62 | #echo $CC $CCOPT $CCARGS |
| 63 | $CC $CCOPT $CCARGS |
Guido van Rossum | b4ae6a3 | 1996-08-08 19:05:09 +0000 | [diff] [blame] | 64 | |
| 65 | # Delete the module's export list file. |
| 66 | # Comment this line if you need it. |
| 67 | rm -f $filename.exp |
| 68 | |
| 69 | # Remove the exec rights on the shared module. |
| 70 | #echo chmod -x `echo $objfile | sed "s/\.o$/.so/"` |
| 71 | chmod -x `echo $objfile | sed "s/\.o$/.so/"` |
| 72 | |