]> 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:29 +0000 (19:26 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Sat, 6 Mar 1999 19:26:29 +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 5103d16d1c81c4e557f515d4fdbf3b5794eeaaec..2dce6d281a50fe731e59ff6f6ed3d58ad1d9e4b8 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>
 
        * ltconfig.in (cygwin, old_archive_from_new_cmds): no longer
index 53a99bad1f57a0bf22768464e56faff89ea9d8a7..a7715a7575547816d0dd3478c49848af7e3654e1 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -2821,9 +2821,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
 }
@@ -2831,10 +2833,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}%"`