libtool-patches
[Top][All Lists]
Advanced

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

darwin.6.diff


From: Peter O'Gorman
Subject: darwin.6.diff
Date: Wed, 26 Mar 2003 22:51:41 +0900

Hi,
While we need to link all deplibs (actually link against them, not just -L to the dir) on darwin, we only need to do so for shared libraries. This patch fixes that.

Also, I had left a couple of printf's in the ltdl code for dyld, and incorrectly returned a 1 in dlcose when the close was successful, and a 0 when it failed, did not set an error string either.

Patch is inline and attached. Almost the same as my last patch, except it now sets the dlerror string for the dlcose failing.

Thanks,
Peter

Attachment: darwin.6.diff.gz
Description: GNU Zip compressed data


Index: ChangeLog
===================================================================
RCS file: /cvsroot/libtool/libtool/ChangeLog,v
retrieving revision 1.1210
diff -u -d -b -w -r1.1210 ChangeLog
--- ChangeLog   25 Mar 2003 23:53:38 -0000      1.1210
+++ ChangeLog   26 Mar 2003 13:46:15 -0000
@@ -1,3 +1,9 @@
+2003-03-26  Peter O'Gorman  <address@hidden>
+
+       * libltdl/ltdl.c (dyld): remove some debug printf's, fix a bug.
+       * ltmain.in (darwin): Only link against shared libraries when doing
+       link_all_deplibs.
+
 2003-03-25  Robert Boehne  <address@hidden>

        * bootstrap: Add f77demo to the directories that AUTOHEADER
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.329
diff -u -d -b -w -r1.329 ltmain.in
--- ltmain.in   22 Mar 2003 06:46:07 -0000      1.329
+++ ltmain.in   26 Mar 2003 13:46:17 -0000
@@ -2515,7 +2515,6 @@
          if test "$link_all_deplibs" != no; then
            # Add the search paths of all dependency libraries
            for deplib in $dependency_libs; do
-             depdepl=
              case $deplib in
              -L*) path="$deplib" ;;
              *.la)
@@ -2548,28 +2547,37 @@
                depdepl=
                case $host in
                *-*-darwin*)
- depdepl=`$echo "X$deplib" | ${SED} -e 's,.*/,,' -e 's,^lib,,' -e 's,\.la$,,'`
-                 newlib_search_path="$newlib_search_path $path"
-                 if grep "^installed=no" $deplib > /dev/null; then
-                 # FIXME - ugly
-                  if test -f "$path/lib${depdepl}.dylib" ; then
-                      eval depdepl=$path/lib${depdepl}.dylib
-                  else
-                  # We shouldn't get here
-                      depdepl="-l$depdepl"
+ # we do not want to link against static libs, but need to link against shared + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
+                 if test -n "$deplibrary_names" ; then
+                   for tmp in $deplibrary_names ; do
+                     depdepl=$tmp
+                   done
+                   if test -f "$path/$depdepl" ; then
+                     depdepl="$path/$depdepl"
                   fi
-                 else
-                   depdepl="-l$depdepl"
+                   newlib_search_path="$newlib_search_path $path"
+                   path=""
                  fi
                  ;;
-                 # end ugly FIXME
-               esac
+               *)
                path="-L$path"
                ;;
+               esac
+               
+               ;;
                  -l*)
                case $host in
                *-*-darwin*)
-           depdepl=$deplib
+                # Again, we only want to link against shared libraries
+                eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+                for tmp in $newlib_search_path ; do
+                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
+                      eval depdepl="$tmp/lib$tmp_libs.dylib"
+                      break
+                    fi
+         done
+         path=""
                  ;;
                *) continue ;;
                esac            
Index: libltdl/ltdl.c
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/ltdl.c,v
retrieving revision 1.173
diff -u -d -b -w -r1.173 ltdl.c
--- libltdl/ltdl.c      20 Mar 2003 20:24:21 -0000      1.173
+++ libltdl/ltdl.c      26 Mar 2003 13:46:17 -0000
@@ -1583,10 +1583,6 @@
 # include <mach-o/dyld.h>
 #endif
 #include <mach-o/getsect.h>
-/*
-  sectname __mod_term_func
-   segname __DATA
-*/

 /* We have to put some stuff here that isn't in older dyld.h files */
 #ifndef ENUM_DYLD_BOOL
@@ -1729,7 +1725,6 @@
        unsigned long offset = sizeof(struct mach_header);
        NSSymbol retSym = 0;
        const struct mach_header *mh1;
-       fprintf(stderr,"Symbol: %s\n",symbol);
        if ((ltdl_NSLookupSymbolInImage) && NSIsSymbolNameDefined(symbol) )
        {
                for (j = 0; j < mh->ncmds; j++)
@@ -1737,8 +1732,6 @@
                        lc = (struct load_command*)(((unsigned long)mh) + 
offset);
                        if ((LC_LOAD_DYLIB == lc->cmd) || (LC_LOAD_WEAK_DYLIB == 
lc->cmd))
                        {
- fprintf(stderr,"Symbol %s\n",(char*)(((struct dylib_command*)lc)->dylib.name.offset +
-                                                                               
(unsigned long)lc));
mh1=lt_int_dyld_match_loaded_lib_by_install_name((char*)(((struct dylib_command*)lc)->dylib.name.offset +
                                                                                
(unsigned long)lc));
                                if (!mh1)
@@ -1855,8 +1848,11 @@
 #ifdef __ppc__
                        flags += NSUNLINKMODULE_OPTION_RESET_LAZY_REFERENCES;
 #endif
-               retCode = NSUnLinkModule(module,flags);                         
                                                                
-       
+               if (!NSUnLinkModule(module,flags))
+               {
+                       retCode=1;
+ LT_DLMUTEX_SETERROR (lt_int_dyld_error(LT_DLSTRERROR(CANNOT_CLOSE)));
+               }                                                               
                
        }
        
  return retCode;

reply via email to

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