libtool-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Get C++ right on Darwin


From: Paolo Bonzini
Subject: [PATCH] Get C++ right on Darwin
Date: Wed, 9 Oct 2002 10:03:03 +0200
User-agent: Mutt/1.4i

This is the patch that Benjamin Reed posted to address@hidden a few hours
ago.  I wrote a ChangeLog entry.

Robert, I don't have CVS access right now.  Can you please send me a diff
from 1.4.2 to current CVS 1.4 branch?  Thank you very much.

Paolo Bonzini


2002-10-08  Benjamin Reed  <address@hidden>

        * ltmain.in [darwin]: disable lazy linking, needed
        to resolve C++ global constructor issues
        * libtool.m4 [darwin]: fix more problems with broken
        ld when working with C++

RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.265
diff -u -b -r1.265 libtool.m4
--- libtool.m4  4 Oct 2002 15:34:50 -0000       1.265
+++ libtool.m4  8 Oct 2002 22:00:05 -0000
@@ -2631,6 +2631,12 @@
          ld_shlibs=no
         ;;
 
+  darwin*)
+    shared_flag='-dynamiclib'
+    archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o 
$libobjs && $CC -dynamiclib -install_name $rpath/$soname $predep_objects 
${lib}-master.o $deplibs $postdep_objects $compiler_flags -o $lib'
+    output_verbose_link_cmd='$CC -dynamiclib $CFLAGS -v conftest.$objext2>&1 | 
egrep "\-L"'
+    ;;
+
   dgux*)
     case $cc_basename in
       ec++)
@@ -4950,7 +4956,7 @@
       #        cross-compilation, but unfortunately the echo tests do not
       #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
       #               `"' quotes if we put them in here... so don't!
-      archive_cmds='$CC $(test .$module = .yes && echo -bundle || echo 
-dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags 
-install_name $rpath/$soname $verstring'
+      archive_cmds='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o 
$libobjs && $CC $(test .$module = .yes && echo -bundle || echo -dynamiclib) 
$allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags $(test 
.$module != .yes && echo -install_name $rpath/$soname $verstring)'
       # We need to add '_' to the symbols in $export_symbols first
       #archive_expsym_cmds="$archive_cmds"' && strip -s $export_symbols'
       hardcode_direct=yes

diff -u -b -r1.301 ltmain.in
--- ltmain.in   25 Sep 2002 04:26:20 -0000      1.301
+++ ltmain.in   8 Oct 2002 22:00:06 -0000
@@ -3644,6 +3644,14 @@
        ;;
       esac
 
+      case $host in
+      *darwin*)
+        # Don't allow lazy linking, it breaks C++ global constructors
+        compile_command="$compile_command ${wl}-bind_at_load"
+        finalize_command="$finalize_command ${wl}-bind_at_load"
+        ;;
+      esac
+
       compile_command="$compile_command $compile_deplibs"
       finalize_command="$finalize_command $finalize_deplibs"
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]