[m-rev.] fix lcc rpath link error

Fergus Henderson fjh at cs.mu.OZ.AU
Sun Aug 17 17:25:00 AEST 2003


Estimated hours taken: 1.5
Branches: main

Fix a bug that resulted in a link error (with the misleading
message `/usr/bin/ld: bad -rpath option') when attempting to
compile Mercury programs with tracing enabled, and dynamically
linked, using lcc.

configure.in:
	For lcc, use `-Wl-export-dynamic' rather than `-rdynamic',
	because the latter only works with gcc.

Workspace: /home/ceres/fjh/mercury
Index: configure.in
===================================================================
RCS file: /home/mercury1/repository/mercury/configure.in,v
retrieving revision 1.374
diff -u -d -r1.374 configure.in
--- configure.in	6 Aug 2003 12:38:02 -0000	1.374
+++ configure.in	17 Aug 2003 07:23:43 -0000
@@ -573,15 +573,20 @@
 	LD_LIBFLAGS_FOR_DEBUG="-g"
 
 	#
-	# On Linux ELF, `-rdynamic' is needed to make symbols
-	# exported for use in code linked in with dlopen(),
+	# On Linux ELF, the linker option `-export-dynamic' is needed to make
+	# symbols exported for use in code linked in with dlopen(),
 	# which is used for interactive queries in the
-	# Mercury debugger.
-	#
+	# Mercury debugger.  For gcc, this linker option can be enabled by
+	# passing either `-rdynamic' or `-Wl,-export-dynamic' to gcc;
+	# we use the former.  For lcc 4.2, we need to use `-Wl-export-dynamic'.
+	# 
 	case $FULLARCH in
 		*-linux*aout) ;; # no special options needed
 		*-linux*)
-			LDFLAGS_FOR_TRACE="-rdynamic" ;;
+			case "$CC" in
+			lcc*) LDFLAGS_FOR_TRACE="-Wl-export-dynamic" ;;
+			*) LDFLAGS_FOR_TRACE="-rdynamic" ;;
+			esac
 	esac
 
 	USING_MICROSOFT_CL_COMPILER="no"

-- 
Fergus Henderson <fjh at cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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