]> git.saurik.com Git - apple/ld64.git/blobdiff - src/other/ObjectDump.cpp
ld64-302.3.1.tar.gz
[apple/ld64.git] / src / other / ObjectDump.cpp
index c9eb46c4774fcbb8a8148d31e0b6a4843621e6a8..6763e1a358938083c21e4cf2229e7677e736b015 100644 (file)
@@ -396,11 +396,13 @@ struct AtomSorter
                                        rightString = (char*)cstringAtom->rawContentPointer();
                                }
                        }
-                       assert(leftString != NULL);
-                       assert(rightString != NULL);
-                       diff = strcmp(leftString, rightString);
-                       if ( diff != 0 )
-                               return (diff < 0);
+                       if ( leftString != rightString ) {
+                               assert(leftString != NULL);
+                               assert(rightString != NULL);
+                               diff = strcmp(leftString, rightString);
+                               if ( diff != 0 )
+                                       return (diff < 0);
+                       }
                }
                else if ( left->section().type() == ld::Section::typeLiteral4 ) {
                        // if literal sort by content
@@ -804,6 +806,7 @@ void dumper::dumpFixup(const ld::Fixup* ref)
                case ld::Fixup::kindStoreThumbHigh16:
                        printf(", then store high-16 in Thumb movt");
                        break;
+#if SUPPORT_ARCH_arm64
                case ld::Fixup::kindStoreARM64Branch26:
                        printf(", then store as ARM64 26-bit pcrel branch");
                        break;
@@ -831,12 +834,19 @@ void dumper::dumpFixup(const ld::Fixup* ref)
                case ld::Fixup::kindStoreARM64TLVPLoadPageOff12:
                        printf(", then store as ARM64 12-bit page offset of TLVP");
                        break;
+               case ld::Fixup::kindStoreARM64TLVPLoadNowLeaPage21:
+                       printf(", then store as ARM64 21-bit pcrel ADRP of lea of TLVP");
+                       break;
+               case ld::Fixup::kindStoreARM64TLVPLoadNowLeaPageOff12:
+                       printf(", then store as ARM64 12-bit page offset of lea of TLVP");
+                       break;
                case ld::Fixup::kindStoreARM64PointerToGOT:
                        printf(", then store as 64-bit pointer to GOT entry");
                        break;
                case ld::Fixup::kindStoreARM64PCRelToGOT:
                        printf(", then store as 32-bit delta to GOT entry");
                        break;
+#endif
                case ld::Fixup::kindDtraceExtra:
                        printf("dtrace static probe extra info");
                        break;
@@ -858,12 +868,14 @@ void dumper::dumpFixup(const ld::Fixup* ref)
                case ld::Fixup::kindStoreThumbDtraceIsEnableSiteClear:
                        printf("Thumb dtrace static is-enabled site");
                        break;
+#if SUPPORT_ARCH_arm64
                case ld::Fixup::kindStoreARM64DtraceCallSiteNop:
                        printf("ARM64 dtrace static probe site");
                        break;
                case ld::Fixup::kindStoreARM64DtraceIsEnableSiteClear:
                        printf("ARM64 dtrace static is-enabled site");
                        break;
+#endif
                case ld::Fixup::kindLazyTarget:
                        printf("lazy reference to external symbol %s", referenceTargetAtomName(ref));
                        break;
@@ -981,6 +993,7 @@ void dumper::dumpFixup(const ld::Fixup* ref)
                case ld::Fixup::kindSetTargetTLVTemplateOffsetLittleEndian64:
                        printf("tlv template offset of %s", referenceTargetAtomName(ref));
                        break;
+#if SUPPORT_ARCH_arm64
                case ld::Fixup::kindStoreTargetAddressARM64Branch26:
                        printf("ARM64 store 26-bit pcrel branch to %s", referenceTargetAtomName(ref));
                        break;
@@ -990,12 +1003,6 @@ void dumper::dumpFixup(const ld::Fixup* ref)
                case ld::Fixup::kindStoreTargetAddressARM64PageOff12:
                        printf("ARM64 store 12-bit page offset of %s", referenceTargetAtomName(ref));
                        break;
-               case ld::Fixup::kindStoreTargetAddressARM64TLVPage21:
-                       printf("ARM64 store 21-bit pcrel ADRP to TLV for %s", referenceTargetAtomName(ref));
-                       break;
-               case ld::Fixup::kindStoreTargetAddressARM64TLVPageOff12:
-                       printf("ARM64 store 12-bit page offset of TLV of %s", referenceTargetAtomName(ref));
-                       break;
                case ld::Fixup::kindStoreTargetAddressARM64GOTLoadPage21:
                        printf("ARM64 store 21-bit pcrel ADRP to GOT for %s", referenceTargetAtomName(ref));
                        break;
@@ -1003,11 +1010,24 @@ void dumper::dumpFixup(const ld::Fixup* ref)
                        printf("ARM64 store 12-bit page offset of GOT of %s", referenceTargetAtomName(ref));
                        break;
                case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPage21:
-                       printf("ARM64 store 21-bit pcrel ADRP for lea of %s", referenceTargetAtomName(ref));
+                       printf("ARM64 store 21-bit pcrel ADRP to GOT lea for %s", referenceTargetAtomName(ref));
                        break;
                case ld::Fixup::kindStoreTargetAddressARM64GOTLeaPageOff12:
-                       printf("ARM64 store 12-bit page offset of lea of %s", referenceTargetAtomName(ref));
+                       printf("ARM64 store 12-bit page offset of GOT lea of %s", referenceTargetAtomName(ref));
+                       break;
+               case ld::Fixup::kindStoreTargetAddressARM64TLVPLoadPage21:
+                       printf("ARM64 store 21-bit pcrel ADRP to TLV for %s", referenceTargetAtomName(ref));
+                       break;
+               case ld::Fixup::kindStoreTargetAddressARM64TLVPLoadPageOff12:
+                       printf("ARM64 store 12-bit page offset of TLV of %s", referenceTargetAtomName(ref));
                        break;
+               case ld::Fixup::kindStoreTargetAddressARM64TLVPLoadNowLeaPage21:
+                       printf("ARM64 store 21-bit pcrel ADRP to lea for TLV for %s", referenceTargetAtomName(ref));
+                       break;
+               case ld::Fixup::kindStoreTargetAddressARM64TLVPLoadNowLeaPageOff12:
+                       printf("ARM64 store 12-bit page offset of lea for TLV of %s", referenceTargetAtomName(ref));
+                       break;
+#endif
                //default:
                //      printf("unknown fixup");
                //      break;
@@ -1230,12 +1250,16 @@ static ld::relocatable::File* createReader(const char* path)
        objOpts.keepDwarfUnwind         = false;
        objOpts.forceDwarfConversion = false;
        objOpts.verboseOptimizationHints = true;
+       objOpts.armUsesZeroCostExceptions = true;
        objOpts.subType                         = sPreferredSubArch;
+       objOpts.treateBitcodeAsData  = false;
+       objOpts.usingBitcode            = true;
 #if 1
        if ( ! foundFatSlice ) {
                cpu_type_t archOfObj;
                cpu_subtype_t subArchOfObj;
-               if ( mach_o::relocatable::isObjectFile(p, &archOfObj, &subArchOfObj) ) {
+               Options::Platform platform;
+               if ( mach_o::relocatable::isObjectFile(p, &archOfObj, &subArchOfObj, &platform) ) {
                        objOpts.architecture = archOfObj;
                        objOpts.subType = subArchOfObj;
                }