diff --git a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp index e77abf429e6b4..c8f567e5f4195 100644 --- a/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp +++ b/llvm/lib/CodeGen/AsmPrinter/AsmPrinter.cpp @@ -2139,16 +2139,20 @@ void AsmPrinter::emitFunctionBody() { } /// Compute the number of Global Variables that uses a Constant. -static unsigned getNumGlobalVariableUses(const Constant *C) { - if (!C) +static unsigned getNumGlobalVariableUses(const Constant *C, + bool &HasNonGlobalUsers) { + if (!C) { + HasNonGlobalUsers = true; return 0; + } if (isa(C)) return 1; unsigned NumUses = 0; for (const auto *CU : C->users()) - NumUses += getNumGlobalVariableUses(dyn_cast(CU)); + NumUses += + getNumGlobalVariableUses(dyn_cast(CU), HasNonGlobalUsers); return NumUses; } @@ -2159,7 +2163,8 @@ static unsigned getNumGlobalVariableUses(const Constant *C) { /// candidates are skipped and are emitted later in case at least one cstexpr /// isn't replaced by a PC relative GOT entry access. static bool isGOTEquivalentCandidate(const GlobalVariable *GV, - unsigned &NumGOTEquivUsers) { + unsigned &NumGOTEquivUsers, + bool &HasNonGlobalUsers) { // Global GOT equivalents are unnamed private globals with a constant // pointer initializer to another global symbol. They must point to a // GlobalVariable or Function, i.e., as GlobalValue. @@ -2171,7 +2176,8 @@ static bool isGOTEquivalentCandidate(const GlobalVariable *GV, // To be a got equivalent, at least one of its users need to be a constant // expression used by another global variable. for (const auto *U : GV->users()) - NumGOTEquivUsers += getNumGlobalVariableUses(dyn_cast(U)); + NumGOTEquivUsers += + getNumGlobalVariableUses(dyn_cast(U), HasNonGlobalUsers); return NumGOTEquivUsers > 0; } @@ -2189,9 +2195,13 @@ void AsmPrinter::computeGlobalGOTEquivs(Module &M) { for (const auto &G : M.globals()) { unsigned NumGOTEquivUsers = 0; - if (!isGOTEquivalentCandidate(&G, NumGOTEquivUsers)) + bool HasNonGlobalUsers = false; + if (!isGOTEquivalentCandidate(&G, NumGOTEquivUsers, HasNonGlobalUsers)) continue; - + // If non-global variables use it, we still need to emit it. + // Add 1 here, then emit it in `emitGlobalGOTEquivs`. + if (HasNonGlobalUsers) + NumGOTEquivUsers += 1; const MCSymbol *GOTEquivSym = getSymbol(&G); GlobalGOTEquivs[GOTEquivSym] = std::make_pair(&G, NumGOTEquivUsers); } diff --git a/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp b/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp index 8ecd669e67178..93bc6631e64c8 100644 --- a/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp +++ b/llvm/lib/ObjCopy/MachO/MachOLayoutBuilder.cpp @@ -116,10 +116,6 @@ uint64_t MachOLayoutBuilder::layoutSegments() { const bool IsObjectFile = O.Header.FileType == MachO::HeaderFileType::MH_OBJECT; uint64_t Offset = IsObjectFile ? (HeaderSize + O.Header.SizeOfCmds) : 0; - // If we are emitting an encryptable binary, our load commands must have a - // separate (non-encrypted) page to themselves. - bool RequiresFirstSectionOutsideFirstPage = - O.EncryptionInfoCommandIndex.has_value(); for (LoadCommand &LC : O.LoadCommands) { auto &MLC = LC.MachOLoadCommand; StringRef Segname; @@ -173,10 +169,6 @@ uint64_t MachOLayoutBuilder::layoutSegments() { if (!Sec->hasValidOffset()) { Sec->Offset = 0; } else { - if (RequiresFirstSectionOutsideFirstPage) { - SectOffset = alignToPowerOf2(SectOffset, PageSize); - RequiresFirstSectionOutsideFirstPage = false; - } Sec->Offset = SegOffset + SectOffset; Sec->Size = Sec->Content.size(); SegFileSize = std::max(SegFileSize, SectOffset + Sec->Size); diff --git a/llvm/lib/ObjCopy/MachO/MachOObject.cpp b/llvm/lib/ObjCopy/MachO/MachOObject.cpp index e0819d89d24ff..8d2c02dc37c99 100644 --- a/llvm/lib/ObjCopy/MachO/MachOObject.cpp +++ b/llvm/lib/ObjCopy/MachO/MachOObject.cpp @@ -98,10 +98,6 @@ void Object::updateLoadCommandIndexes() { case MachO::LC_DYLD_EXPORTS_TRIE: ExportsTrieCommandIndex = Index; break; - case MachO::LC_ENCRYPTION_INFO: - case MachO::LC_ENCRYPTION_INFO_64: - EncryptionInfoCommandIndex = Index; - break; } } } diff --git a/llvm/lib/ObjCopy/MachO/MachOObject.h b/llvm/lib/ObjCopy/MachO/MachOObject.h index 79eb0133c2802..a454c4f502fd6 100644 --- a/llvm/lib/ObjCopy/MachO/MachOObject.h +++ b/llvm/lib/ObjCopy/MachO/MachOObject.h @@ -341,9 +341,6 @@ struct Object { /// The index of the LC_SEGMENT or LC_SEGMENT_64 load command /// corresponding to the __TEXT segment. std::optional TextSegmentCommandIndex; - /// The index of the LC_ENCRYPTION_INFO or LC_ENCRYPTION_INFO_64 load command - /// if present. - std::optional EncryptionInfoCommandIndex; BumpPtrAllocator Alloc; StringSaver NewSectionsContents; diff --git a/llvm/lib/ObjCopy/MachO/MachOReader.cpp b/llvm/lib/ObjCopy/MachO/MachOReader.cpp index ef0e0262f9395..2b344f36d8e78 100644 --- a/llvm/lib/ObjCopy/MachO/MachOReader.cpp +++ b/llvm/lib/ObjCopy/MachO/MachOReader.cpp @@ -184,10 +184,6 @@ Error MachOReader::readLoadCommands(Object &O) const { case MachO::LC_DYLD_CHAINED_FIXUPS: O.ChainedFixupsCommandIndex = O.LoadCommands.size(); break; - case MachO::LC_ENCRYPTION_INFO: - case MachO::LC_ENCRYPTION_INFO_64: - O.EncryptionInfoCommandIndex = O.LoadCommands.size(); - break; } #define HANDLE_LOAD_COMMAND(LCName, LCValue, LCStruct) \ case MachO::LCName: \ diff --git a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp index 4486cba2bf6c0..fe1fe391f5982 100644 --- a/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp +++ b/llvm/lib/Transforms/Utils/RelLookupTableConverter.cpp @@ -67,6 +67,20 @@ static bool shouldConvertToRelLookupTable(Module &M, GlobalVariable &GV) { if (!ElemType->isPointerTy() || DL.getPointerTypeSizeInBits(ElemType) != 64) return false; + SmallVector GVOps; + Triple TT(M.getTargetTriple()); + // FIXME: This should be removed in the future. + bool ShouldDropUnnamedAddr = + // Drop unnamed_addr to avoid matching pattern in + // `handleIndirectSymViaGOTPCRel`, which generates GOTPCREL relocations + // not supported by the GNU linker and LLD versions below 18 on aarch64. + TT.isAArch64() + // Apple's ld64 (and ld-prime on Xcode 15.2) miscompile something on + // x86_64-apple-darwin. See + // https://github.com/rust-lang/rust/issues/140686 and + // https://github.com/rust-lang/rust/issues/141306. + || (TT.isX86() && TT.isOSDarwin()); + for (const Use &Op : Array->operands()) { Constant *ConstOp = cast(&Op); GlobalValue *GVOp; @@ -86,8 +100,15 @@ static bool shouldConvertToRelLookupTable(Module &M, GlobalVariable &GV) { !GlovalVarOp->isDSOLocal() || !GlovalVarOp->isImplicitDSOLocal()) return false; + + if (ShouldDropUnnamedAddr) + GVOps.push_back(GlovalVarOp); } + if (ShouldDropUnnamedAddr) + for (auto *GVOp : GVOps) + GVOp->setUnnamedAddr(GlobalValue::UnnamedAddr::None); + return true; } @@ -109,24 +130,8 @@ static GlobalVariable *createRelLookupTable(Function &Func, uint64_t Idx = 0; SmallVector RelLookupTableContents(NumElts); - Triple TT(M.getTargetTriple()); - // FIXME: This should be removed in the future. - bool ShouldDropUnnamedAddr = - // Drop unnamed_addr to avoid matching pattern in - // `handleIndirectSymViaGOTPCRel`, which generates GOTPCREL relocations - // not supported by the GNU linker and LLD versions below 18 on aarch64. - TT.isAArch64() - // Apple's ld64 (and ld-prime on Xcode 15.2) miscompile something on - // x86_64-apple-darwin. See - // https://github.com/rust-lang/rust/issues/140686 and - // https://github.com/rust-lang/rust/issues/141306. - || (TT.isX86() && TT.isOSDarwin()); - for (Use &Operand : LookupTableArr->operands()) { Constant *Element = cast(Operand); - if (ShouldDropUnnamedAddr) - if (auto *GlobalElement = dyn_cast(Element)) - GlobalElement->setUnnamedAddr(GlobalValue::UnnamedAddr::None); Type *IntPtrTy = M.getDataLayout().getIntPtrType(M.getContext()); Constant *Base = llvm::ConstantExpr::getPtrToInt(RelLookupTable, IntPtrTy); Constant *Target = llvm::ConstantExpr::getPtrToInt(Element, IntPtrTy); diff --git a/llvm/test/MC/X86/gotpcrel-non-globals.ll b/llvm/test/MC/X86/gotpcrel-non-globals.ll new file mode 100644 index 0000000000000..222d2d73ff728 --- /dev/null +++ b/llvm/test/MC/X86/gotpcrel-non-globals.ll @@ -0,0 +1,36 @@ +; RUN: llc < %s | FileCheck %s + +target triple = "x86_64-unknown-linux-gnu" + +; Check that we emit the `@bar_*` symbols, and that we don't emit multiple symbols. + +; CHECK-LABEL: .Lrel_0: +; CHECK: .long foo_0@GOTPCREL+0 +; CHECK-LABEL: .Lrel_1_failed: +; CHECK: .long bar_1-foo_0 +; CHECK-LABEL: .Lrel_2: +; CHECK: .long foo_2@GOTPCREL+0 + +; CHECK: bar_0: +; CHECK: bar_1: +; CHECK: bar_2_indirect: + +@rel_0 = private unnamed_addr constant [1 x i32] [ + i32 trunc (i64 sub (i64 ptrtoint (ptr @bar_0 to i64), i64 ptrtoint (ptr @rel_0 to i64)) to i32)] +@rel_1_failed = private unnamed_addr constant [1 x i32] [ + i32 trunc (i64 sub (i64 ptrtoint (ptr @bar_1 to i64), i64 ptrtoint (ptr @foo_0 to i64)) to i32)] +@rel_2 = private unnamed_addr constant [1 x i32] [ + i32 trunc (i64 sub (i64 ptrtoint (ptr @bar_2_indirect to i64), i64 ptrtoint (ptr @rel_2 to i64)) to i32)] +@bar_0 = internal unnamed_addr constant ptr @foo_0, align 8 +@bar_1 = internal unnamed_addr constant ptr @foo_1, align 8 +@bar_2_indirect = internal unnamed_addr constant ptr @foo_2, align 8 +@foo_0 = external global ptr, align 8 +@foo_1 = external global ptr, align 8 +@foo_2 = external global ptr, align 8 + +define void @foo(ptr %arg0, ptr %arg1) { + store ptr @bar_0, ptr %arg0, align 8 + store ptr @bar_1, ptr %arg1, align 8 + store ptr getelementptr (i8, ptr @bar_2_indirect, i32 1), ptr %arg1, align 8 + ret void +} diff --git a/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll b/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll index 78b8a4aa126c9..322c38d090fe1 100644 --- a/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll +++ b/llvm/test/Transforms/RelLookupTableConverter/unnamed_addr.ll @@ -20,6 +20,14 @@ @y3 = internal unnamed_addr constant ptr @x0 @load_relative_2.table = private unnamed_addr constant [4 x ptr] [ptr @y3, ptr @y2, ptr @y1, ptr @y0] +@b0 = private unnamed_addr constant [8 x i8] c"00000000" +@b1 = private unnamed_addr constant [8 x i8] c"11111111" +@b2 = private unnamed_addr constant [8 x i8] c"22222222" +@load_relative_3.table = private unnamed_addr constant [3 x ptr] [ + ptr getelementptr inbounds (i8, ptr @b0, i64 8), + ptr getelementptr inbounds (i8, ptr @b1, i64 8), + ptr getelementptr inbounds (i8, ptr @b2, i64 8)] + ;. ; x86_64-apple-darwin: @a0 = private constant i32 0 ; x86_64-apple-darwin: @a1 = private constant i32 1 @@ -34,6 +42,10 @@ ; x86_64-apple-darwin: @y2 = internal constant ptr @x1 ; x86_64-apple-darwin: @y3 = internal constant ptr @x0 ; x86_64-apple-darwin: @load_relative_2.table.rel = private unnamed_addr constant [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @y3 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y2 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y1 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y0 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32)], align 4 +; x86_64-apple-darwin: @b0 = private constant [8 x i8] c"00000000" +; x86_64-apple-darwin: @b1 = private constant [8 x i8] c"11111111" +; x86_64-apple-darwin: @b2 = private constant [8 x i8] c"22222222" +; x86_64-apple-darwin: @load_relative_3.table.rel = private unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b0, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b1, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b2, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32)], align 4 ;. ; aarch64: @a0 = private constant i32 0 ; aarch64: @a1 = private constant i32 1 @@ -48,6 +60,10 @@ ; aarch64: @y2 = internal constant ptr @x1 ; aarch64: @y3 = internal constant ptr @x0 ; aarch64: @load_relative_2.table.rel = private unnamed_addr constant [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @y3 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y2 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y1 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y0 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32)], align 4 +; aarch64: @b0 = private constant [8 x i8] c"00000000" +; aarch64: @b1 = private constant [8 x i8] c"11111111" +; aarch64: @b2 = private constant [8 x i8] c"22222222" +; aarch64: @load_relative_3.table.rel = private unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b0, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b1, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b2, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32)], align 4 ;. ; x86_64: @a0 = private unnamed_addr constant i32 0 ; x86_64: @a1 = private unnamed_addr constant i32 1 @@ -62,6 +78,10 @@ ; x86_64: @y2 = internal unnamed_addr constant ptr @x1 ; x86_64: @y3 = internal unnamed_addr constant ptr @x0 ; x86_64: @load_relative_2.table.rel = private unnamed_addr constant [4 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr @y3 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y2 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y1 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr @y0 to i64), i64 ptrtoint (ptr @load_relative_2.table.rel to i64)) to i32)], align 4 +; x86_64: @b0 = private unnamed_addr constant [8 x i8] c"00000000" +; x86_64: @b1 = private unnamed_addr constant [8 x i8] c"11111111" +; x86_64: @b2 = private unnamed_addr constant [8 x i8] c"22222222" +; x86_64: @load_relative_3.table.rel = private unnamed_addr constant [3 x i32] [i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b0, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b1, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint (ptr getelementptr inbounds (i8, ptr @b2, i64 8) to i64), i64 ptrtoint (ptr @load_relative_3.table.rel to i64)) to i32)], align 4 ;. define ptr @load_relative_1(i64 %offset) { ; x86_64-apple-darwin-LABEL: define ptr @load_relative_1( @@ -110,6 +130,31 @@ define ptr @load_relative_2(i64 %offset) { %load = load ptr, ptr %gep ret ptr %load } + +define ptr @load_relative_3(i64 %offset) { +; x86_64-apple-darwin-LABEL: define ptr @load_relative_3( +; x86_64-apple-darwin-SAME: i64 [[OFFSET:%.*]]) { +; x86_64-apple-darwin-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2 +; x86_64-apple-darwin-NEXT: [[RELTABLE_INTRINSIC:%.*]] = call ptr @llvm.load.relative.i64(ptr @load_relative_3.table.rel, i64 [[RELTABLE_SHIFT]]) +; x86_64-apple-darwin-NEXT: ret ptr [[RELTABLE_INTRINSIC]] +; +; aarch64-LABEL: define ptr @load_relative_3( +; aarch64-SAME: i64 [[OFFSET:%.*]]) { +; aarch64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2 +; aarch64-NEXT: [[RELTABLE_INTRINSIC:%.*]] = call ptr @llvm.load.relative.i64(ptr @load_relative_3.table.rel, i64 [[RELTABLE_SHIFT]]) +; aarch64-NEXT: ret ptr [[RELTABLE_INTRINSIC]] +; +; x86_64-LABEL: define ptr @load_relative_3( +; x86_64-SAME: i64 [[OFFSET:%.*]]) { +; x86_64-NEXT: [[RELTABLE_SHIFT:%.*]] = shl i64 [[OFFSET]], 2 +; x86_64-NEXT: [[RELTABLE_INTRINSIC:%.*]] = call ptr @llvm.load.relative.i64(ptr @load_relative_3.table.rel, i64 [[RELTABLE_SHIFT]]) +; x86_64-NEXT: ret ptr [[RELTABLE_INTRINSIC]] +; + %gep = getelementptr inbounds [3 x ptr], ptr @load_relative_3.table, i64 0, i64 %offset + %load = load ptr, ptr %gep + ret ptr %load +} + ;. ; x86_64-apple-darwin: attributes #[[ATTR0:[0-9]+]] = { nocallback nofree nosync nounwind willreturn memory(argmem: read) } ;. diff --git a/llvm/test/tools/llvm-objcopy/MachO/strip-with-encryption-info.test b/llvm/test/tools/llvm-objcopy/MachO/strip-with-encryption-info.test index 2b2bd670613de..d6f6fe10d88c2 100644 --- a/llvm/test/tools/llvm-objcopy/MachO/strip-with-encryption-info.test +++ b/llvm/test/tools/llvm-objcopy/MachO/strip-with-encryption-info.test @@ -16,7 +16,11 @@ # CHECK: fileoff: 0 # The YAML below is the following code +# ``` +# static int foo = 12345; +# int bar = 4567; # int main(int argc, char **argv) { return 0; } +# ``` # Compiled on macOS against the macOS SDK and passing `-Wl,-encryptable` # Contents are removed, since they are not important for the test. We need a # small text segment (smaller than a page). @@ -26,8 +30,8 @@ FileHeader: cputype: 0x100000C cpusubtype: 0x0 filetype: 0x2 - ncmds: 15 - sizeofcmds: 696 + ncmds: 18 + sizeofcmds: 920 flags: 0x200085 reserved: 0x0 LoadCommands: @@ -69,7 +73,7 @@ LoadCommands: - sectname: __unwind_info segname: __TEXT addr: 0x100004020 - size: 4152 + size: 88 offset: 0x4020 align: 2 reloff: 0x0 @@ -79,37 +83,61 @@ LoadCommands: reserved2: 0x0 reserved3: 0x0 - cmd: LC_SEGMENT_64 - cmdsize: 72 - segname: __LINKEDIT + cmdsize: 152 + segname: __DATA vmaddr: 4295000064 - vmsize: 592 + vmsize: 16384 fileoff: 32768 - filesize: 592 + filesize: 16384 + maxprot: 3 + initprot: 3 + nsects: 1 + flags: 0 + Sections: + - sectname: __data + segname: __DATA + addr: 0x100008000 + size: 4 + offset: 0x8000 + align: 2 + reloff: 0x0 + nreloc: 0 + flags: 0x0 + reserved1: 0x0 + reserved2: 0x0 + reserved3: 0x0 + - cmd: LC_SEGMENT_64 + cmdsize: 72 + segname: __LINKEDIT + vmaddr: 4295016448 + vmsize: 16384 + fileoff: 49152 + filesize: 768 maxprot: 1 initprot: 1 nsects: 0 flags: 0 - cmd: LC_DYLD_CHAINED_FIXUPS cmdsize: 16 - dataoff: 32768 - datasize: 48 + dataoff: 49152 + datasize: 56 - cmd: LC_DYLD_EXPORTS_TRIE cmdsize: 16 - dataoff: 32816 - datasize: 48 + dataoff: 49208 + datasize: 64 - cmd: LC_SYMTAB cmdsize: 24 - symoff: 32872 - nsyms: 2 - stroff: 32904 - strsize: 32 + symoff: 49280 + nsyms: 3 + stroff: 49328 + strsize: 40 - cmd: LC_DYSYMTAB cmdsize: 80 ilocalsym: 0 nlocalsym: 0 iextdefsym: 0 - nextdefsym: 2 - iundefsym: 2 + nextdefsym: 3 + iundefsym: 3 nundefsym: 0 tocoff: 0 ntoc: 0 @@ -123,12 +151,6 @@ LoadCommands: nextrel: 0 locreloff: 0 nlocrel: 0 - - cmd: LC_ENCRYPTION_INFO_64 - cmdsize: 24 - cryptoff: 16384 - cryptsize: 16384 - cryptid: 0 - pad: 0 - cmd: LC_LOAD_DYLINKER cmdsize: 32 name: 12 @@ -136,32 +158,50 @@ LoadCommands: ZeroPadBytes: 7 - cmd: LC_UUID cmdsize: 24 - uuid: 4C4C4447-5555-3144-A18A-01E9EB7E7D92 + uuid: ADDA943C-657A-3A49-9580-168E17A40FFB - cmd: LC_BUILD_VERSION cmdsize: 32 platform: 1 minos: 983040 - sdk: 983552 + sdk: 984320 ntools: 1 Tools: - - tool: 4 - version: 1310720 + - tool: 3 + version: 76481537 + - cmd: LC_SOURCE_VERSION + cmdsize: 16 + version: 0 - cmd: LC_MAIN cmdsize: 24 entryoff: 16384 stacksize: 0 + - cmd: LC_ENCRYPTION_INFO_64 + cmdsize: 24 + cryptoff: 16384 + cryptsize: 16384 + cryptid: 0 + pad: 0 + - cmd: LC_LOAD_DYLIB + cmdsize: 56 + dylib: + name: 24 + timestamp: 2 + current_version: 88539136 + compatibility_version: 65536 + Content: '/usr/lib/libSystem.B.dylib' + ZeroPadBytes: 6 - cmd: LC_FUNCTION_STARTS cmdsize: 16 - dataoff: 32864 + dataoff: 49272 datasize: 8 - cmd: LC_DATA_IN_CODE cmdsize: 16 - dataoff: 32872 + dataoff: 49280 datasize: 0 - cmd: LC_CODE_SIGNATURE cmdsize: 16 - dataoff: 32944 - datasize: 416 + dataoff: 49376 + datasize: 544 LinkEditData: ExportTrie: TerminalSize: 0 @@ -173,51 +213,67 @@ LinkEditData: ImportName: '' Children: - TerminalSize: 0 - NodeOffset: 5 + NodeOffset: 25 Name: _ Flags: 0x0 Address: 0x0 Other: 0x0 ImportName: '' Children: + - TerminalSize: 2 + NodeOffset: 9 + Name: _mh_execute_header + Flags: 0x0 + Address: 0x0 + Other: 0x0 + ImportName: '' - TerminalSize: 4 - NodeOffset: 33 - Name: main + NodeOffset: 13 + Name: bar Flags: 0x0 - Address: 0x4000 + Address: 0x8000 Other: 0x0 ImportName: '' - - TerminalSize: 2 - NodeOffset: 39 - Name: _mh_execute_header + - TerminalSize: 4 + NodeOffset: 19 + Name: main Flags: 0x0 - Address: 0x0 + Address: 0x4000 Other: 0x0 ImportName: '' NameList: - n_strx: 2 n_type: 0xF n_sect: 1 + n_desc: 16 + n_value: 4294967296 + - n_strx: 22 + n_type: 0xF + n_sect: 3 n_desc: 0 - n_value: 4294983680 - - n_strx: 8 + n_value: 4295000064 + - n_strx: 27 n_type: 0xF n_sect: 1 - n_desc: 16 - n_value: 4294967296 + n_desc: 0 + n_value: 4294983680 StringTable: - ' ' - - _main - __mh_execute_header + - _bar + - _main + - '' + - '' + - '' - '' - '' - '' - '' FunctionStarts: [ 0x4000 ] - ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x30, 0x0, - 0x0, 0x0, 0x30, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, - 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] + ChainedFixups: [ 0x0, 0x0, 0x0, 0x0, 0x20, 0x0, 0x0, 0x0, 0x34, 0x0, + 0x0, 0x0, 0x34, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, + 0x0, 0x0, 0x0, 0x0, 0x0, 0x0 ] ... -