[m-dev.] diff: fix problem with ../so_locations
Fergus Henderson
fjh at cs.mu.OZ.AU
Tue Nov 23 18:23:21 AEDT 1999
Estimated hours taken: 0.75
Fix a problem where `ml --shared' was trying to create a so_locations
file in `../so_locations'; that is ugly, and causes trouble if the
parent directory is not writable, for example.
configure.in:
Mmake.common.in:
Add a new variable SO_LOCATIONS_DIR, defined (for compilation
of the Mercury compiler itself) as equal to $(MERCURY_DIR),
which is the root of the Mercury source distribution tree.
Change the definition of LINK_SHARED_OBJECT so that it uses
that variable rather than hard-coding `../'.
This required splitting LINK_SHARED_OBJECT into two variables,
one for Mmake and one for Bourne shell, since the two languages
have different syntaxes for referencing variables.
scripts/ml.in:
Use LINK_SHARED_OBJECT_SH rather than LINK_SHARED_OBJECT.
bindist/bindist.configure.in:
bindist/bindist.build_vars.in:
Pass down the value of the new LINK_SHARED_OBJECT_SH variable.
Workspace: /d-drive/home/hg/fjh/mercury
Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.41
diff -u -d -r1.41 Mmake.common.in
--- Mmake.common.in 1999/11/15 05:10:22 1.41
+++ Mmake.common.in 1999/11/23 07:07:45
@@ -58,13 +58,27 @@
# bootstrapping from the source distribution.
LIBRARY_RM_C = @LIBRARY_RM_C@
-# Specify the command to link a shared library
+# This specifies the path to the so_locations file (or its equivalent),
+# which is used by the linker to help it to map different shared objects
+# to different virtual memory addresses at static link time, so as to avoid
+# the need to relocate them at dynamic link time.
+SO_LOCATIONS_DIR = $(MERCURY_DIR)
+
+# Specify the Mmake command to link a shared library.
# This is only used if EXT_FOR_SHARED_LIB was defined as `so' above.
+# This command may reference $(SO_LOCATIONS_DIR).
+#
# LINK_SHARED_OBJ = ld -shared # for Irix 5
# LINK_SHARED_OBJ = gcc -assert nodefinitions
# # for SunOS 4 (completely untested)
# LINK_SHARED_OBJ = gcc -shared # for Solaris etc.
LINK_SHARED_OBJ = @LINK_SHARED_OBJ@
+
+# This is the same as LINK_SHARED_OBJ except that it
+# specifies a Bourne shell command rather than an Mmake command,
+# so if it references the SO_LOCATIONS_DIR variable it must use
+# ${SO_LOCATIONS_DIR} rather than $(SO_LOCATIONS_DIR).
+LINK_SHARED_OBJ_SH = @LINK_SHARED_OBJ_SH@
# The following variables specify how to pass options to the # $(CC) or
# $(LINK_SHARED_OBJ) command to specify directories to be searched at
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.191
diff -u -d -r1.191 configure.in
--- configure.in 1999/11/23 06:26:01 1.191
+++ configure.in 1999/11/23 07:10:25
@@ -1836,6 +1836,7 @@
# set up some default values that should work on most systems
# see Mmake.common.in for documentation on the meaning of these variables
LINK_SHARED_OBJ="$CC -shared"
+LINK_SHARED_OBJ_SH="$CC -shared"
SHARED_LIBS='`gcc -print-libgcc-file-name` -lm -lc'
EXE_RPATH_OPT="-Wl,-rpath,"
EXE_RPATH_SEP=" -Wl,-rpath,"
@@ -1863,6 +1864,7 @@
# From Cornelis van der Laan <nils at ims.uni-stuttgart.de>
AC_MSG_RESULT(yes)
LINK_SHARED_OBJ="ld -Bshareable"
+ LINK_SHARED_OBJ_SH="ld -Bshareable"
EXT_FOR_SHARED_LIB=so
# From Kevet Duncombe <dunc at acm.org> tested on FreeBSD 2.2.5
EXE_RPATH_OPT="-R"
@@ -1874,6 +1876,7 @@
AC_MSG_RESULT(yes)
SHARED_LIBS="-lm -lc" # don't link in libgcc.a
LINK_SHARED_OBJ="$CC -G"
+ LINK_SHARED_OBJ_SH="$CC -G"
ERROR_UNDEFINED="-Wl,-z,defs"
EXE_RPATH_OPT="-R"
EXE_RPATH_SEP=" -R"
@@ -1914,8 +1917,10 @@
;;
alpha-dec-osf*)
AC_MSG_RESULT(yes)
- LINK_SHARED_OBJ="gcc -shared \
- -Wl,-O3,-update_registry,../so_locations"
+ LINK_SHARED_OBJ='gcc -shared \
+ -Wl,-O3,-update_registry,$(SO_LOCATIONS_DIR)so_locations'
+ LINK_SHARED_OBJ_SH='gcc -shared \
+ -Wl,-O3,-update_registry,${SO_LOCATIONS_DIR}so_locations'
ERROR_UNDEFINED="-Wl,-error_unresolved"
EXE_RPATH_OPT="-Wl,-rpath,"
EXE_RPATH_SEP=":"
@@ -1927,8 +1932,12 @@
EXT_FOR_PIC_OBJECTS=o
;;
mips-sgi-irix5.*)
- LINK_SHARED_OBJ="ld -shared -update_registry ../so_locations\
- -quickstart_info -rdata_shared"
+ LINK_SHARED_OBJ='ld -shared \
+ -update_registry $(SO_LOCATIONS_DIR)so_locations \
+ -quickstart_info -rdata_shared'
+ LINK_SHARED_OBJ_SH='ld -shared \
+ -update_registry ${SO_LOCATIONS_DIR}so_locations \
+ -quickstart_info -rdata_shared'
ERROR_UNDEFINED="-no_unresolved"
EXE_RPATH_OPT="-Wl,-rpath,"
EXE_RPATH_SEP=":"
@@ -2006,6 +2015,7 @@
#-----------------------------------------------------------------------------#
AC_SUBST(LINK_SHARED_OBJ)
+AC_SUBST(LINK_SHARED_OBJ_SH)
AC_SUBST(ERROR_UNDEFINED)
AC_SUBST(ALLOW_UNDEFINED)
AC_SUBST(EXE_RPATH_OPT)
Index: bindist/bindist.build_vars.in
===================================================================
RCS file: /home/mercury1/repository/mercury/bindist/bindist.build_vars.in,v
retrieving revision 1.10
diff -u -d -r1.10 bindist.build_vars.in
--- bindist/bindist.build_vars.in 1999/11/23 06:25:57 1.10
+++ bindist/bindist.build_vars.in 1999/11/23 07:12:14
@@ -20,6 +20,7 @@
CFLAGS_FOR_REGS="@CFLAGS_FOR_REGS@"
CFLAGS_FOR_GOTOS="@CFLAGS_FOR_GOTOS@"
LINK_SHARED_OBJ="@LINK_SHARED_OBJ@"
+LINK_SHARED_OBJ_SH="@LINK_SHARED_OBJ_SH@"
EXE_RPATH_OPT="@EXE_RPATH_OPT@"
EXE_RPATH_SEP="@EXE_RPATH_SEP@"
SHLIB_RPATH_OPT="@SHLIB_RPATH_OPT@"
Index: bindist/bindist.configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/bindist/bindist.configure.in,v
retrieving revision 1.25
diff -u -d -r1.25 bindist.configure.in
--- bindist/bindist.configure.in 1999/11/23 06:25:57 1.25
+++ bindist/bindist.configure.in 1999/11/23 07:12:34
@@ -50,6 +50,7 @@
AC_SUBST(CFLAGS_FOR_REGS)
AC_SUBST(CFLAGS_FOR_GOTOS)
AC_SUBST(LINK_SHARED_OBJ)
+AC_SUBST(LINK_SHARED_OBJ_SH)
AC_SUBST(CFLAGS_FOR_PIC)
AC_SUBST(EXE_RPATH_OPT)
AC_SUBST(EXE_RPATH_SEP)
Index: scripts/ml.in
===================================================================
RCS file: /home/mercury1/repository/mercury/scripts/ml.in,v
retrieving revision 1.72
diff -u -d -r1.72 ml.in
--- scripts/ml.in 1999/11/12 07:05:23 1.72
+++ scripts/ml.in 1999/11/23 07:10:50
@@ -28,7 +28,7 @@
EXE_RPATH_OPT=${MERCURY_EXE_RPATH_OPT="@EXE_RPATH_OPT@"}
EXE_RPATH_SEP=${MERCURY_EXE_RPATH_SEP="@EXE_RPATH_SEP@"}
EXT_FOR_SHARED_LIB=${MERCURY_EXT_FOR_SHARED_LIB="@EXT_FOR_SHARED_LIB@"}
-LINK_SHARED_OBJ=${MERCURY_LINK_SHARED_OBJ="@LINK_SHARED_OBJ@"}
+LINK_SHARED_OBJ=${MERCURY_LINK_SHARED_OBJ="@LINK_SHARED_OBJ_SH@"}
SHLIB_RPATH_OPT=${MERCURY_SHLIB_RPATH_OPT="@SHLIB_RPATH_OPT@"}
SHLIB_RPATH_SEP=${MERCURY_SHLIB_RPATH_SEP="@SHLIB_RPATH_SEP@"}
SHARED_LIBS=${MERCURY_SHARED_LIBS="@SHARED_LIBS@"}
--
Fergus Henderson <fjh at cs.mu.oz.au> | "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh> | of excellence is a lethal habit"
PGP: finger fjh at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
mercury-developers mailing list
Post messages to: mercury-developers at cs.mu.oz.au
Administrative Queries: owner-mercury-developers at cs.mu.oz.au
Subscriptions: mercury-developers-request at cs.mu.oz.au
--------------------------------------------------------------------------
More information about the developers
mailing list