cpython/Modules/ld_so_aix

73 lines
2.8 KiB
Plaintext
Raw Normal View History

1996-08-08 19:05:09 +00:00
#!/bin/sh
#
# ========================================================================
# FILE: ld_so_aix
# TYPE: executable, uses makexp_aix
# SYSTEM: AIX
#
# DESCRIPTION: Creates a shareable .o from a pre-compiled (unshared)
# .o file
#
1996-08-08 19:06:31 +00:00
# USAGE: ld_so_aix [CC] [arguments]
#
# ARGUMENTS: Same as for "ld". The -bM, -bE, -bI, -H, -T, and -lm
# arguments will be supplied by this script. The compiler
# specific ("-lc" or "-lc_r", "-lpthreads", etc) arguments
# will be automatically passed to "ld" according to the CC
# command provided as a first argument to this script.
# Usually, the same CC command was used to produce the
# pre-compiled .o file.
1996-08-08 19:05:09 +00:00
#
# NOTES: 1. Currently specific to the building of Python
# interpreter shared objects, in that the entry
# point name is hardcoded based on the object file
# name (the "mathmodule.o" file will expect an
# entry point of "initmath"). This could be remedied
# by the support (or simple expectation) of a "-e"
# argument.
# 2. The resulting shared object file is left in the
# current directory with the extension .so
# 3. Uncommenting the "echo" lines gives detailed output
# about the commands executed in the script.
#
1996-08-08 19:06:31 +00:00
# HISTORY: Aug-6-1996 -- Take care of the compiler specific --
# -- args by leaving CC to invoke "ld". --
# Vladimir Marangozov
#
# Jul-1-1996 -- Make sure to use /usr/ccs/bin/ld --
1996-08-08 19:05:09 +00:00
# -- Use makexp_aix for the export list. --
# Vladimir Marangozov (Vladimir.Marangozov@imag.fr)
#
# Manus Hand (mhand@csn.net) -- Initial code -- 6/24/96
# ========================================================================
#
# Variables
1996-08-08 19:06:31 +00:00
CC=$1; shift
objfile=$1; shift
1996-08-08 19:05:09 +00:00
filename=`echo $objfile | sed -e "s:.*/\([^/]*\)$:\1:" -e "s/\..*$//"`
entry=init`echo $filename | sed "s/module.*//"`
1996-08-08 19:06:31 +00:00
expfile="$filename.exp"
impfile="python.exp"
CCOPT="-Wl,-e$entry -Wl,-bE:$expfile -Wl,-bI:$impfile"
CCOPT="$CCOPT -Wl,-bM:SRE -Wl,-T512 -Wl,-H512 -lm"
CCARGS="$objfile $*"
1996-08-08 19:05:09 +00:00
# Export list generation
makexp_aix $filename.exp "$objfile" $objfile
# Perform the link.
1996-08-08 19:06:31 +00:00
#echo $CC $CCOPT $CCARGS
$CC $CCOPT $CCARGS
1996-08-08 19:05:09 +00:00
# Delete the module's export list file.
# Comment this line if you need it.
rm -f $filename.exp
# Remove the exec rights on the shared module.
#echo chmod -x `echo $objfile | sed "s/\.o$/.so/"`
chmod -x `echo $objfile | sed "s/\.o$/.so/"`