This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: PATCH: Support libtool -no-undefined under GNU/Linux.


On 06-Feb-2001, Alexandre Oliva <aoliva@redhat.com> wrote:
> 
> > So I think this patch also requires some code in libtool to link in
> > /lib/ld-linux.so.2 if needed.
> 
> The problem is that the name of the dynamic linker may change across
> glibc versions.  I'm not sure I want to go down that road in libtool.
> -no-undefined is a do-nothing on most platforms, anyway, so I don't
> think it's a big deal for it to be a do-nothing on GNU/Linux too.

I do think it is a reasonably important issue, because some platforms
require no undefined symbols when building shared libraries, but lots
of development is done on GNU/Linux, and so if `--no-undefined' doesn't
work on GNU/Linux, then shared libraries on AIX/Windows/Beos will
continually be broken by developers on GNU/Linux,

For various reasons, mainly historical, the Mercury implementation
doesn't use libtool.  Here's what I did for the Mercury implementation.
It's probably not very robust.  But maybe this or something similar to
this can be used for libtool.  (I'm not volunteering ;-)

	AC_MSG_CHECKING(ld-linux.so version)
	echo "int main(void) { return 0; }" > conftest.c
	$CC -o conftest conftest.c
	ld_linux=`ldd ./conftest | awk '/ld-linux/{print $1;}'`
	case $ld_linux in /lib/ld-linux.so*)
		AC_MSG_RESULT($ld_linux)
		# insert code here to (a) enable --no-undefined
		# and (b) link in $ld_linux
		...
		;;
	*)
		AC_MSG_RESULT(no)
		# insert code here to disable --no-undefined
		...
		;;
	esac
	rm -f conftest*


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]