Add -Wl,-single_module to the linker flags in Darwin. The page at

http://developer.apple.com/releasenotes/DeveloperTools/RN-dyld/index.html

says

	The static linker ld(1) supports building dylibs as either
	-multi_module or -single_module.  Conceptually, a multi-module
	dylib is like a group of smaller dylibs - one per source file. 
	The extra meta-data in a multi-module dylib allowed (pre-10.4)
	dyld to delay binding and running initializers on the individual
	modules.  In Mac OS X 10.4 dyld ignores all multi-module
	meta-data and completely binds and runs all initializers the
	same as if it were built single-module.  In general, building
	dylibs -single_module is preferred.  The one case where
	multi-module is still useful is it allows internal functions of
	a dylib to be interposable.  For instance, libSystem.dylib is
	built multi_module so that malloc() can be overridden and all
	uses of malloc in libSystem (e.g.  strdup) would be redirected
	to use the overridden version.

and we don't need the interposability for our dylibs, and Andreas Fink
indicates that it's necessary for the packaged Wireshark builds he's
doing.

svn path=/trunk/; revision=20301
This commit is contained in:
Guy Harris 2007-01-04 11:50:41 +00:00
parent cf6f013568
commit 461d5cc45f
1 changed files with 14 additions and 8 deletions

View File

@ -236,14 +236,20 @@ AC_MSG_CHECKING(for platform-specific linker flags)
case "$host_os" in
darwin*)
#
# Make sure that if we search directories A and B, in
# that order, for a given library, a non-shared version
# in directory A, rather than a shared version in
# directory B, is chosen (so we can use --with-pcap=/usr/local
# to force all programs to be linked with a static
# version installed in /usr/local/lib rather than the
# system version in /usr/lib).
LDFLAGS="-Wl,-search_paths_first $LDFLAGS"
# Add -Wl,-single_module; see the checkin comment for details
# of why we do that (it's considered preferable, at least in
# OS X 10.4 and later, by Apple, and it's needed for some
# packaged build work).
#
# Add -Wl,-search_paths_first to make sure that if we search
# directories A and B, in that order, for a given library, a
# non-shared version in directory A, rather than a shared
# version in directory B, is chosen (so we can use
# --with-pcap=/usr/local to force all programs to be linked
# with a static version installed in /usr/local/lib rather than
# the system version in /usr/lib).
#
LDFLAGS="-Wl,-single_module -Wl,-search_paths_first $LDFLAGS"
AC_MSG_RESULT(Apple linker - added -Wl,-search_paths_first)
;;
cygwin*)