[m-rev.] for review: fix Alpha shared library problems

Simon Taylor stayl at cs.mu.OZ.AU
Mon May 13 16:01:35 AEST 2002


Estimated hours taken: 2.5
Branches: main

Fix link problems on murlibobo caused by my recent changes
to the way libmer_std.so and libmer_browser.so are built.
The linker doesn't like shared libraries being renamed
after they are built.

library/mer_std.m:
browser/mer_browser.m:
	Empty modules used to generate the libraries with
	the correct names.

library/Mmakefile:
browser/Mmakefile:
	Build and install libmer_std.* and libmer_browser.*
	rather than liblibrary.* and libmdb.*.

Mmake.workspace:
Mmake.common.in:
	Make sure SO_LOCATIONS_DIR is in ml's environment
	when building the libraries.

	Fix the order of the `-l' options.

compiler/Mmakefile:
	Make sure `main.o' comes before the library `.a' files
	on the ml command line.

doc/Mmakefile:
	Add mer_std.m to the list of files for which documentation
	should not be generated.

trace/Mmakefile:
	Add the grade-specific library directory to the rpath
	for libmer_trace.so.

Index: Mmake.common.in
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.common.in,v
retrieving revision 1.63
diff -u -u -r1.63 Mmake.common.in
--- Mmake.common.in	2002/05/02 07:54:54	1.63
+++ Mmake.common.in	2002/05/13 04:05:26
@@ -58,12 +58,6 @@
 # just reuse the .o files.
 EXT_FOR_PIC_OBJECTS	= @EXT_FOR_PIC_OBJECTS@
 
-# 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).
Index: Mmake.workspace
===================================================================
RCS file: /home/mercury1/repository/mercury/Mmake.workspace,v
retrieving revision 1.5
diff -u -u -r1.5 Mmake.workspace
--- Mmake.workspace	2002/05/09 08:46:50	1.5
+++ Mmake.workspace	2002/05/13 05:51:51
@@ -68,6 +68,13 @@
 TRACE_LIB_NAME = mer_trace
 BROWSER_LIB_NAME = mer_browser
 
+# 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        = $(WORKSPACE)/
+export SO_LOCATIONS_DIR
+
 MC =		$(SCRIPTS_DIR)/mmc
 MGNUC =		$(SCRIPTS_DIR)/mgnuc
 ML =		$(SCRIPTS_DIR)/ml
@@ -163,8 +170,8 @@
 endif
 endif
 
-LINK_LIB_OPTS = $(LINK_TRACE_LIB_OPTS) $(LINK_RT_LIB_OPTS) \
-			$(LINK_STD_LIB_OPTS) $(SHARED_GC_LIBS) 
+LINK_LIB_OPTS = $(LINK_TRACE_LIB_OPTS) $(LINK_STD_LIB_OPTS) \
+			$(LINK_RT_LIB_OPTS) $(SHARED_GC_LIBS) 
 LIB_DIR_OPTS = -L$(BOEHM_GC_DIR) -L$(RUNTIME_DIR) -L$(LIBRARY_DIR) \
 			-L$(TRACE_DIR) -L$(BROWSER_DIR)
 
Index: browser/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/browser/Mmakefile,v
retrieving revision 1.19
diff -u -u -r1.19 Mmakefile
--- browser/Mmakefile	2002/04/29 08:22:00	1.19
+++ browser/Mmakefile	2002/05/13 04:58:51
@@ -42,6 +42,8 @@
 # to abort compiling declarative_user.m.
 MCFLAGS-mdb.declarative_user = --no-deforestation
 
+MCFLAGS-mer_browser = --no-warn-nothing-exported
+
 MTAGS	=	$(SCRIPTS_DIR)/mtags
 
 LN	=	ln
@@ -71,58 +73,49 @@
 all : library browse_test declarative_test
 
 .PHONY: depend
-depend		: mdb.depend browse_test.depend declarative_test.depend
+depend		: $(BROWSER_LIB_NAME).depend \
+			browse_test.depend declarative_test.depend
 
 .PHONY: check
-check		: mdb.check
+check		: $(BROWSER_LIB_NAME).check
 
 .PHONY: all-ints 
 all-ints: ints int3s
 
 .PHONY: ints 
-ints		: mdb.ints browse_test.ints declarative_test.ints
+ints		: $(BROWSER_LIB_NAME).ints \
+			browse_test.ints declarative_test.ints
 
 .PHONY: int3s 
-int3s		: mdb.int3s
+int3s		: $(BROWSER_LIB_NAME).int3s
 
 #-----------------------------------------------------------------------------#
 
-tags		: $(MTAGS) $(mdb.ms)
-	$(MTAGS) $(mdb.ms) ../library/*.m
+tags		: $(MTAGS) $($(BROWSER_LIB_NAME).ms)
+	$(MTAGS) $($(BROWSER_LIB_NAME).ms) ../library/*.m
 
-mdb.stats : $(COMPILER_DIR)/source_stats.awk $(mdb.ms)
+$(BROWSER_LIB_NAME).stats : $(COMPILER_DIR)/source_stats.awk \
+				$($(BROWSER_LIB_NAME).ms)
 	awk -f $(COMPILER_DIR)/source_stats.awk \
-		`vpath_find $(mdb.ms)` > $@
+		`vpath_find $($(BROWSER_LIB_NAME).ms)` > $@
 	
 #-----------------------------------------------------------------------------#
 
 .PHONY: dates
 dates		:
-	touch $(mdb.dates)
+	touch $($(BROWSER_LIB_NAME).dates)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: os cs ss
-os: $(mdb.os)
-cs: $(mdb.cs)
-ss: $(mdb.ss)
+os: $($(BROWSER_LIB_NAME).os)
+cs: $($(BROWSER_LIB_NAME).cs)
+ss: $($(BROWSER_LIB_NAME).ss)
 
 #-----------------------------------------------------------------------------#
 
 .PHONY: library
-library: lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).$(EXT_FOR_SHARED_LIB)
-library: $(BROWSER_LIB_NAME).init
-
-lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A : libmdb.$A
-	rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
-	$(LN) libmdb.$A lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).$A
-
-lib$(BROWSER_LIB_NAME).so : libmdb.so
-	rm -f lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).so
-	$(LN) libmdb.so lib$(BROWSER_LIB_NAME)$(DLL_DEF_LIB).so
-
-$(BROWSER_LIB_NAME).init: $(deps_subdir)mdb.dep mdb.init
-	cp mdb.init $(BROWSER_LIB_NAME).init
+library: lib$(BROWSER_LIB_NAME)
 
 # Ensure we recompile mdb__version if VERSION is changed.
 $(os_subdir)mdb.o \
@@ -131,9 +124,10 @@
 
 #-----------------------------------------------------------------------------#
 
+# In the past we generated libmdb.* and then linked
+# libmer_browser.* to the files.
 realclean_local:
-	rm -f lib$(BROWSER_LIB_NAME).$A lib$(BROWSER_LIB_NAME).so \
-		$(BROWSER_LIB_NAME).init mdb.init
+	rm -rf libmdb.so libmdb.a mdb.init
 	rm -f tags
 
 #-----------------------------------------------------------------------------#
Index: doc/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/doc/Mmakefile,v
retrieving revision 1.30
diff -u -u -r1.30 Mmakefile
--- doc/Mmakefile	2002/01/09 04:15:06	1.30
+++ doc/Mmakefile	2002/05/12 12:39:26
@@ -182,6 +182,8 @@
 	echo "";							\
 	for filename in $(LIBRARY_DIR)/*.m; do				\
 		case $$filename in					\
+			$(LIBRARY_DIR)/mer_std.m)			\
+				;;					\
 			$(LIBRARY_DIR)/private_builtin.m)		\
 				;;					\
 			$(LIBRARY_DIR)/profiling_builtin.m)		\
@@ -200,6 +202,8 @@
 library-chapters.texi_pp: $(LIBRARY_DIR)/[a-z]*.m
 	for filename in $(LIBRARY_DIR)/[a-z]*.m; do 			\
 		case $$filename in					\
+			$(LIBRARY_DIR)/mer_std.m)			\
+				;;					\
 			$(LIBRARY_DIR)/private_builtin.m)		\
 				;;					\
 			$(LIBRARY_DIR)/profiling_builtin.m)		\
Index: library/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/library/Mmakefile,v
retrieving revision 1.89
diff -u -u -r1.89 Mmakefile
--- library/Mmakefile	2002/04/29 08:22:01	1.89
+++ library/Mmakefile	2002/05/13 05:03:44
@@ -81,6 +81,8 @@
 # Bug workarounds.
 MCFLAGS-std_util += --no-halt-at-warn
 
+MCFLAGS-mer_std = --no-warn-nothing-exported
+
 #-----------------------------------------------------------------------------#
 
 CFLAGS	+=	$(DLL_CFLAGS) -I$(TRACE_DIR)
@@ -126,10 +128,10 @@
 #-----------------------------------------------------------------------------#
 
 .PHONY: depend
-depend		: library.depend
+depend		: $(STD_LIB_NAME).depend
 
 .PHONY: check
-check		: library.check
+check		: $(STD_LIB_NAME).check
 
 .PHONY: all-ints 
 
@@ -144,46 +146,47 @@
 endif
 
 .PHONY: ints 
-ints		: library.ints
+ints		: $(STD_LIB_NAME).ints
 
 .PHONY: int3s 
-int3s		: library.int3s
+int3s		: $(STD_LIB_NAME).int3s
 
 .PHONY: opts 
-opts		: library.opts
+opts		: $(STD_LIB_NAME).opts
 
 .PHONY: trans_opts 
-trans_opts		: library.trans_opts
-library.trans_opts	: $(library.trans_opts)
+trans_opts		: $(STD_LIB_NAME).trans_opts
+$(STD_LIB_NAME).trans_opts	: $($(STD_LIB_NAME).trans_opts)
 
 #-----------------------------------------------------------------------------#
 
-tags		: $(MTAGS) $(library.ms)
-	$(MTAGS) $(library.ms)
+tags		: $(MTAGS) $($(STD_LIB_NAME).ms)
+	$(MTAGS) $($(STD_LIB_NAME).ms)
 
-library.stats : $(COMPILER_DIR)/source_stats.awk $(library.ms)
-	awk -f $(COMPILER_DIR)/source_stats.awk `vpath_find $(library.ms)` > $@
+$(STD_LIB_NAME).stats : $(COMPILER_DIR)/source_stats.awk $($(STD_LIB_NAME).ms)
+	awk -f $(COMPILER_DIR)/source_stats.awk \
+		`vpath_find $($(STD_LIB_NAME).ms)` > $@
 	
 #-----------------------------------------------------------------------------#
 
 .PHONY: dates
 dates		:
-	touch $(library.dates)
+	touch $($(STD_LIB_NAME).dates)
 
 #-----------------------------------------------------------------------------#
 
-# Note that we need to explicitly mention $(library.pic_ss) somewhere
+# Note that we need to explicitly mention $($(STD_LIB_NAME).pic_ss) somewhere
 # in the Mmakefile, otherwise it won't build properly with --target asm:
 # GNU Make's pattern rule algorithm will try to use the .m -> .c -> .pic_o
 # rule chain rather than the .m -> .pic_s_date -> .pic_s -> .pic_o chain.
 # So don't remove the pic_ss target here.
 
 .PHONY: os cs ss pic_ss ils 
-os: $(library.os)
-cs: $(library.cs)
-ss: $(library.ss)
-pic_ss: $(library.pic_ss)
-ils: $(library.ils)
+os: $($(STD_LIB_NAME).os)
+cs: $($(STD_LIB_NAME).cs)
+ss: $($(STD_LIB_NAME).ss)
+pic_ss: $($(STD_LIB_NAME).pic_ss)
+ils: $($(STD_LIB_NAME).ils)
 
 #-----------------------------------------------------------------------------#
 
@@ -217,9 +220,11 @@
 library_strong_name.sn:
 	sn -k library_strong_name.sn
 
-mercury.dll: copy_runtime_dlls $(library.dlls) $(library.foreign_dlls) library_strong_name.sn
+mercury.dll: copy_runtime_dlls $($(STD_LIB_NAME).dlls) \
+			$($(STD_LIB_NAME).foreign_dlls) library_strong_name.sn
 	$(MS_AL) -v:0.0.0.0 -keyf:library_strong_name.sn -out:mercury.dll \
-		$(library.dlls) $(library.foreign_dlls) $(RUNTIME_DLLS) 
+		$($(STD_LIB_NAME).dlls) $($(STD_LIB_NAME).foreign_dlls) \
+		$(RUNTIME_DLLS) 
 
 # The runtime DLLs must be copied into this directory from the runtime
 # directory so they can be installed properly.
@@ -237,21 +242,12 @@
 # the following dependency is just there to improve compilation speed;
 # making tree234.$O first improves effective parallelism with parallel makes.
 lib_std: $(os_subdir)tree234.$O
-lib_std: lib$(STD_LIB_NAME).$A lib$(STD_LIB_NAME).$(EXT_FOR_SHARED_LIB)
-lib_std: $(STD_LIB_NAME).init
-
-lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A : liblibrary.$A
-	rm -f lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A
-	$(LN) liblibrary.$A lib$(STD_LIB_NAME)$(DLL_DEF_LIB).$A
-
-lib$(STD_LIB_NAME).so : liblibrary.so
-	rm -f lib$(STD_LIB_NAME).so
-	$(LN) liblibrary.so lib$(STD_LIB_NAME).so
+lib_std: lib$(STD_LIB_NAME)
 
 endif
 
-$(STD_LIB_NAME).init: $(deps_subdir)library.dep
-	for file in $(library.ms); do \
+$(STD_LIB_NAME).init: $(deps_subdir)$(STD_LIB_NAME).dep
+	for file in $($(STD_LIB_NAME).ms); do \
 		grep '^INIT ' $$file; \
 		echo "INIT mercury__`basename $$file .m`__init"; \
 	done > $(STD_LIB_NAME).init
@@ -306,9 +302,11 @@
 
 #-----------------------------------------------------------------------------#
 
+# In the past we generated liblibrary.* and then linked
+# libmer_std.* to the files.
 realclean_local:
-	rm -f $(library.mods:%=%.h)
-	rm -f lib$(STD_LIB_NAME).$A lib$(STD_LIB_NAME).so $(STD_LIB_NAME).init
+	rm -f liblibrary.$A liblibrary.so library.init
+	rm -f $($(STD_LIB_NAME).mods:%=%.h)
 	rm -f tags
 
 #-----------------------------------------------------------------------------#
@@ -333,15 +331,10 @@
 install_mercury: install_ints install_hdrs install_init install_library
 
 .PHONY: install_ints
-install_ints: liblibrary.install_ints
+install_ints: lib$(STD_LIB_NAME).install_ints
 
 .PHONY: install_hdrs
-install_hdrs: liblibrary.install_hdrs
-
-# The following rules are hand-coded, rather than using the
-# liblibrary.* targets automatically generated by `mmake depend',
-# because they override the name used for the standard library:
-# they use $(STD_LIB_NAME) rather than `library'.
+install_hdrs: lib$(STD_LIB_NAME).install_hdrs
 
 .PHONY: install_init
 install_init: $(STD_LIB_NAME).init install_lib_dirs
@@ -358,7 +351,7 @@
 
 .PHONY: install_library
 install_library: mercury.dll install_grade_dirs install_gac install_strong_name
-	cp `vpath_find $(library.foreign_dlls) $(library.dlls) \
+	cp `vpath_find $($(STD_LIB_NAME).foreign_dlls) $($(STD_LIB_NAME).dlls) \
 		mercury.dll` $(INSTALL_MERC_LIB_DIR)
 
 # The GAC is the global assembly cache, which is the system managed
@@ -376,20 +369,14 @@
 else
 
 .PHONY: install_library
-install_library: lib$(STD_LIB_NAME).$A \
-		lib$(STD_LIB_NAME).$(EXT_FOR_SHARED_LIB) install_grade_dirs
-	cp `vpath_find lib$(STD_LIB_NAME).$A \
-		lib$(STD_LIB_NAME).$(EXT_FOR_SHARED_LIB)` \
-		$(INSTALL_MERC_LIB_DIR)
+install_library: lib$(STD_LIB_NAME).install_library
 
 endif	# non IL grades
 
-# library.split.$A is a version of lib$(STD_LIB_NAME).$A that has been compiled
-# with `--split-c-files'.
+# $(STD_LIB_NAME).split.$A is a version of lib$(STD_LIB_NAME).$A
+# that has been compiled with `--split-c-files'.
 .PHONY: install_split_library
-install_split_library: library.split.$A install_grade_dirs
-	cp `vpath_find library.split.$A` \
-		$(INSTALL_MERC_LIB_DIR)/lib$(STD_LIB_NAME).$A
+install_split_library: lib$(STD_LIB_NAME).install_split_library
 
 else
 
Index: trace/Mmakefile
===================================================================
RCS file: /home/mercury1/repository/mercury/trace/Mmakefile,v
retrieving revision 1.29
diff -u -u -r1.29 Mmakefile
--- trace/Mmakefile	2002/04/29 08:22:08	1.29
+++ trace/Mmakefile	2002/05/13 05:42:47
@@ -128,10 +128,13 @@
 		$(AR_LIBFILE_OPT)lib$(TRACE_LIB_NAME)$(DLL_DEF_LIB).$A $(OBJS)
 	$(RANLIB) lib$(TRACE_LIB_NAME)$(DLL_DEF_LIB).$A
 
+RPATH_1=$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_LIB_DIR)
+RPATH_2=$(SHLIB_RPATH_SEP)$(FINAL_INSTALL_MERC_GC_LIB_DIR)
+
 lib$(TRACE_LIB_NAME).so: $(PIC_OBJS)
 	$(LINK_SHARED_OBJ) $(ERROR_UNDEFINED)				\
 		-o lib$(TRACE_LIB_NAME).so $(PIC_OBJS)			\
-		$(SHLIB_RPATH_OPT)$(FINAL_INSTALL_MERC_GC_LIB_DIR)	\
+		$(RPATH_1)$(RPATH_2)					\
 		$(LDFLAGS) $(LDLIBS) $(THREADLIBS)			\
 		$(SHARED_LIBS)
 
--------------------------------------------------------------------------
mercury-reviews mailing list
post:  mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the reviews mailing list