]> git.saurik.com Git - apple/ld64.git/blobdiff - src/ld/Resolver.cpp
ld64-128.2.tar.gz
[apple/ld64.git] / src / ld / Resolver.cpp
index a56cefe78d8585b9bcf3d5cff1c1e65d66356e48..2502820c01b6a5210bdbe225cf4a0249eb427cbf 100644 (file)
@@ -297,26 +297,6 @@ void Resolver::buildAtomList()
        //_symbolTable.printStatistics();
 }
 
-unsigned int Resolver::ppcSubTypeIndex(uint32_t subtype)
-{
-       switch ( subtype ) {
-               case CPU_SUBTYPE_POWERPC_ALL:
-                       return 0;
-               case CPU_SUBTYPE_POWERPC_750:
-                       // G3
-                       return 1;
-               case CPU_SUBTYPE_POWERPC_7400:
-               case CPU_SUBTYPE_POWERPC_7450:
-                       // G4
-                       return 2;
-               case CPU_SUBTYPE_POWERPC_970:
-                       // G5 can run everything
-                       return 3;
-               default:
-                       throw "Unhandled PPC cpu subtype!";
-                       break;
-       }
-}
 
 void Resolver::doFile(const ld::File& file)
 {
@@ -363,29 +343,6 @@ void Resolver::doFile(const ld::File& file)
                // update cpu-sub-type
                cpu_subtype_t nextObjectSubType = file.cpuSubType();
                switch ( _options.architecture() ) {
-                       case CPU_TYPE_POWERPC:
-                               // no checking when -force_cpusubtype_ALL is used
-                               if ( _options.forceCpuSubtypeAll() )
-                                       return;
-                               if ( _options.preferSubArchitecture() ) {
-                                       // warn if some .o file is not compatible with desired output sub-type
-                                       if ( _options.subArchitecture() != nextObjectSubType ) {
-                                               if ( ppcSubTypeIndex(nextObjectSubType) > ppcSubTypeIndex(_options.subArchitecture()) ) {
-                                                       if ( !_inputFiles.inferredArch() )
-                                                               warning("cpu-sub-type of %s is not compatible with command line cpu-sub-type", file.path());
-                                                       _internal.cpuSubType = nextObjectSubType;
-                                               }
-                                       }
-                               }
-                               else {
-                                       // command line to linker just had -arch ppc
-                                       // figure out final sub-type based on sub-type of all .o files
-                                       if ( ppcSubTypeIndex(nextObjectSubType) > ppcSubTypeIndex(_internal.cpuSubType) ) {
-                                               _internal.cpuSubType = nextObjectSubType;
-                                       }
-                               }
-                               break;
-                       
                        case CPU_TYPE_ARM:
                                if ( _options.subArchitecture() != nextObjectSubType ) {
                                        if ( (_options.subArchitecture() == CPU_SUBTYPE_ARM_ALL) && _options.forceCpuSubtypeAll() ) {
@@ -405,9 +362,6 @@ void Resolver::doFile(const ld::File& file)
                                }
                                break;
                        
-                       case CPU_TYPE_POWERPC64:
-                               break;
-                               
                        case CPU_TYPE_I386:
                                _internal.cpuSubType = CPU_SUBTYPE_I386_ALL;
                                break;
@@ -567,8 +521,6 @@ bool Resolver::isDtraceProbe(ld::Fixup::Kind kind)
                case ld::Fixup::kindStoreARMDtraceIsEnableSiteClear:
                case ld::Fixup::kindStoreThumbDtraceCallSiteNop:
                case ld::Fixup::kindStoreThumbDtraceIsEnableSiteClear:
-               case ld::Fixup::kindStorePPCDtraceCallSiteNop:
-               case ld::Fixup::kindStorePPCDtraceIsEnableSiteClear:
                case ld::Fixup::kindDtraceExtra:
                        return true;
                default: 
@@ -770,7 +722,6 @@ void Resolver::markLive(const ld::Atom& atom, WhyLiveBackChain* previous)
                        case ld::Fixup::kindStoreTargetAddressX86Abs32TLVLoadNowLEA:
                        case ld::Fixup::kindStoreTargetAddressARMBranch24:
                        case ld::Fixup::kindStoreTargetAddressThumbBranch22:
-                       case ld::Fixup::kindStoreTargetAddressPPCBranch24:
                                if ( fit->binding == ld::Fixup::bindingByContentBound ) {
                                        // normally this was done in convertReferencesToIndirect()
                                        // but a archive loaded .o file may have a forward reference
@@ -1078,7 +1029,8 @@ void Resolver::checkUndefines(bool force)
                        break;
        }
        std::vector<const char*> unresolvableUndefines;
-       if ( _options.deadCodeStrip() ) 
+       // <rdar://problem/10052396> LTO many have eliminated need for some undefines
+       if ( _options.deadCodeStrip() || _haveLLVMObjs ) 
                this->liveUndefines(unresolvableUndefines);
        else    
                _symbolTable.undefines(unresolvableUndefines);