]> git.saurik.com Git - apple/ld64.git/blobdiff - src/ld/passes/dylibs.cpp
ld64-274.2.tar.gz
[apple/ld64.git] / src / ld / passes / dylibs.cpp
index 47b1647c732254cdf13c96aea724a389c3b8af1b..7edc85ccc1beb6eb3b348ebdbc4aa2bfde3716d2 100644 (file)
@@ -30,6 +30,7 @@
 #include <mach/machine.h>
 
 #include <vector>
+#include <map>
 
 #include "ld.hpp"
 #include "dylibs.h"
@@ -52,10 +53,6 @@ void doPass(const Options& opts, ld::Internal& state)
 {
 //     const bool log = false;
        
-       // only optimize dylibs in final linked images
-       if ( opts.outputKind() == Options::kObjectFile )
-               return;
-
        // clear "willRemoved" bit on all dylibs
        for (std::vector<ld::dylib::File*>::iterator it = state.dylibs.begin(); it != state.dylibs.end(); ++it) {
                ld::dylib::File* aDylib = *it;
@@ -97,9 +94,11 @@ void doPass(const Options& opts, ld::Internal& state)
                                                targetIsWeakImport = fit->weakImport;
                                                break;
                     default:
-                        break;   
+                        break;
                                }
                                if ( (target != NULL) && (target->definition() == ld::Atom::definitionProxy) ) {
+                                       if ( targetIsWeakImport && !opts.allowWeakImports() )
+                                               throwf("weak import of symbol '%s' not supported because of option: -no_weak_imports", target->name());
                                        ld::Atom::WeakImportState curWI = target->weakImportState();
                                        if ( curWI == ld::Atom::weakImportUnset ) {
                                                // first use of this proxy, set weak-import based on this usage