]> git.saurik.com Git - apple/ld64.git/blobdiff - src/ld/LinkEditClassic.hpp
ld64-264.3.101.tar.gz
[apple/ld64.git] / src / ld / LinkEditClassic.hpp
index ee1c2078ef81e07d6c45680c9d73e1386667e3be..2eab13bfe85aa54fa8c1f3877c3aa12c0d3fbda5 100644 (file)
@@ -2002,7 +2002,6 @@ private:
        uint32_t                                                                        symIndexOfLazyPointerAtom(const ld::Atom*);
        uint32_t                                                                        symIndexOfNonLazyPointerAtom(const ld::Atom*);
        uint32_t                                                                        symbolIndex(const ld::Atom*);
-       bool                                                                            kextBundlesDontHaveIndirectSymbolTable();
 
 
        std::vector<uint32_t>                                           _entries;
@@ -2034,9 +2033,11 @@ uint32_t IndirectSymbolTableAtom<A>::symIndexOfStubAtom(const ld::Atom* stubAtom
 {
        for (ld::Fixup::iterator fit = stubAtom->fixupsBegin(); fit != stubAtom->fixupsEnd(); ++fit) {
                if ( fit->binding == ld::Fixup::bindingDirectlyBound ) {
-                       assert((fit->u.target->contentType() == ld::Atom::typeLazyPointer) 
-                                       || (fit->u.target->contentType() == ld::Atom::typeLazyDylibPointer));
-                       return symIndexOfLazyPointerAtom(fit->u.target);
+                       ld::Atom::ContentType type = fit->u.target->contentType();
+                       if (( type == ld::Atom::typeLazyPointer) || (type == ld::Atom::typeLazyDylibPointer) )
+                               return symIndexOfLazyPointerAtom(fit->u.target);
+                       if ( type == ld::Atom::typeNonLazyPointer )
+                               return symIndexOfNonLazyPointerAtom(fit->u.target);
                }
        }
        throw "internal error: stub missing fixup to lazy pointer";
@@ -2152,12 +2153,6 @@ void IndirectSymbolTableAtom<A>::encodeNonLazyPointerSection(ld::Internal::Final
        }
 }
 
-template <typename A>
-bool IndirectSymbolTableAtom<A>::kextBundlesDontHaveIndirectSymbolTable()
-{
-       return true;    
-}
-
 template <typename A>
 void IndirectSymbolTableAtom<A>::encode()
 {
@@ -2165,8 +2160,8 @@ void IndirectSymbolTableAtom<A>::encode()
        if ( (this->_options.outputKind() == Options::kStaticExecutable) && !_options.positionIndependentExecutable() ) 
                return;
 
-       // x86_64 kext bundles should not have an indirect symbol table
-       if ( (this->_options.outputKind() == Options::kKextBundle) && kextBundlesDontHaveIndirectSymbolTable() ) 
+       // x86_64 kext bundles should not have an indirect symbol table unless using stubs
+       if ( (this->_options.outputKind() == Options::kKextBundle) && !this->_options.kextsUseStubs() )
                return;
 
        // slidable static executables (-static -pie) should not have an indirect symbol table