blob: e5da17eda5a7c0858c79a2ac73076cba75f67efd [file] [log] [blame]
Guido van Rossumb4ae6a31996-08-08 19:05:09 +00001#!/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 Rossuma93b5041996-08-08 19:06:31 +000011# 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 Rossumb4ae6a31996-08-08 19:05:09 +000020#
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 Rossuma93b5041996-08-08 19:06:31 +000033# 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 Rossumb4ae6a31996-08-08 19:05:09 +000038# -- 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 Rossuma93b5041996-08-08 19:06:31 +000046CC=$1; shift
47
48objfile=$1; shift
Guido van Rossumb4ae6a31996-08-08 19:05:09 +000049filename=`echo $objfile | sed -e "s:.*/\([^/]*\)$:\1:" -e "s/\..*$//"`
50entry=init`echo $filename | sed "s/module.*//"`
Guido van Rossuma93b5041996-08-08 19:06:31 +000051expfile="$filename.exp"
52impfile="python.exp"
53
54CCOPT="-Wl,-e$entry -Wl,-bE:$expfile -Wl,-bI:$impfile"
55CCOPT="$CCOPT -Wl,-bM:SRE -Wl,-T512 -Wl,-H512 -lm"
56CCARGS="$objfile $*"
Guido van Rossumb4ae6a31996-08-08 19:05:09 +000057
58# Export list generation
59makexp_aix $filename.exp "$objfile" $objfile
60
61# Perform the link.
Guido van Rossuma93b5041996-08-08 19:06:31 +000062#echo $CC $CCOPT $CCARGS
63$CC $CCOPT $CCARGS
Guido van Rossumb4ae6a31996-08-08 19:05:09 +000064
65# Delete the module's export list file.
66# Comment this line if you need it.
67rm -f $filename.exp
68
69# Remove the exec rights on the shared module.
70#echo chmod -x `echo $objfile | sed "s/\.o$/.so/"`
71chmod -x `echo $objfile | sed "s/\.o$/.so/"`
72