]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltmain.in (freebsd): compile symbol table file with pic_flag
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Sat, 6 Mar 1999 19:26:20 +0000 (19:26 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Sat, 6 Mar 1999 19:26:20 +0000 (19:26 +0000)
only on FreeBSD and when not static linking; it's been causing
trouble on platforms such as OpenBSD.

ChangeLog
ltmain.in

index 0726a38a19ca366471b0accc3b0766ab6de2c357..5bff1d9ee29ea3ae057467d4ecf0bb8ce7b9d74c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1999-03-06  Alexandre Oliva  <oliva@dcc.unicamp.br>
+
+       * ltmain.in (freebsd): compile symbol table file with pic_flag
+       only on FreeBSD and when not static linking; it's been causing
+       trouble on platforms such as OpenBSD.
+
 1999-02-26  Gary V. Vaughan  <gvaughan@oranda.demon.co.uk>
 
        * libtool.m4 (cygwin): s/\\(mingw\\|cygwin\\)32/\\1/g.  Must've
index ac434d3d8f6ea35f5b0a7c6761a2468dd7740ec7..52cba89a010da54cdcd7119ac1e35e97f89ff887 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -2389,9 +2389,11 @@ lt_preloaded_symbols[] =
 };
 
 /* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
 static const void *lt_preloaded_setup() {
   return lt_preloaded_symbols;
 }
+#endif
 
 #ifdef __cplusplus
 }
@@ -2399,10 +2401,22 @@ static const void *lt_preloaded_setup() {
 "
          fi
 
+         pic_flag_for_symtable=
+          case "$host" in
+         # compiling the symbol table file with pic_flag works around a 
+         # FreeBSD bug that causes programs to crash when -lm is linked
+         # before any other PIC object.  But we must not use pic_flag
+         # when linking with -static.
+         *-*-freebsd*)
+           case "$compile_command " in
+           *" -static "*) ;;
+           *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
+           esac
+         esac
+
          # Now compile the dynamic symbol file.
-         # pic_flag works around a bug in FreeBSD linker
-         $show "(cd $objdir && $C_compiler -c$no_builtin_flag $pic_flag -DPIC \"$dlsyms\")"
-         $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag $pic_flag -DPIC "$dlsyms")' || exit $?
+         $show "(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+         $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
 
          # Transform the symbol file into the correct name.
          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"`