├── .gitignore ├── ASSIGN.h ├── AppDelegate.rb ├── English.lproj ├── InfoPlist.strings └── MainMenu.xib ├── Info.plist ├── MagicHat Tests-Info.plist ├── MagicHat.xcodeproj └── project.pbxproj ├── MagicHat_DataModel.xcdatamodel ├── elements └── layout ├── MagicHat_DataModel ├── MachOClassesSection64MO.h ├── MachOClassesSection64MO.m ├── MachOCommandMO.h ├── MachOCommandMO.m ├── MachOFileMO.h ├── MachOFileMO.m ├── MachOHeaderMO.h ├── MachOHeaderMO.m ├── MachOSection32MO.h ├── MachOSection32MO.m ├── MachOSection64MO.h ├── MachOSection64MO.m ├── MachOSectionMO.h ├── MachOSectionMO.m ├── MachOSegmentCommandMO.h ├── MachOSegmentCommandMO.m ├── _MachOClassesSection64MO.h ├── _MachOClassesSection64MO.m ├── _MachOCommandMO.h ├── _MachOCommandMO.m ├── _MachOFileMO.h ├── _MachOFileMO.m ├── _MachOHeaderMO.h ├── _MachOHeaderMO.m ├── _MachOSection32MO.h ├── _MachOSection32MO.m ├── _MachOSection64MO.h ├── _MachOSection64MO.m ├── _MachOSectionMO.h ├── _MachOSectionMO.m ├── _MachOSegmentCommandMO.h └── _MachOSegmentCommandMO.m ├── NSString+jr_stringWithUTF8StringmaxLength.h ├── NSString+jr_stringWithUTF8StringmaxLength.m ├── Tests ├── NSString+jr_stringWithUTF8StringmaxLengthTest.h └── NSString+jr_stringWithUTF8StringmaxLengthTest.m ├── cctools-750 ├── APPLE_LICENSE ├── Makefile ├── PB.project ├── RelNotes │ ├── CompilerTools.html │ ├── FatFiles.rtf │ ├── Makefile │ └── Private_CompilerTools.html ├── ar │ ├── Makefile │ ├── append.c │ ├── ar.1 │ ├── ar.5 │ ├── ar.c │ ├── archive.c │ ├── archive.h │ ├── contents.c │ ├── delete.c │ ├── extern.h │ ├── extract.c │ ├── misc.c │ ├── move.c │ ├── notes │ ├── pathnames.h │ ├── print.c │ └── replace.c ├── as │ ├── COPYING │ ├── Makefile │ ├── app.c │ ├── app.h │ ├── arch64_32.h │ ├── arm.c │ ├── as.c │ ├── as.h │ ├── atof-generic.c │ ├── atof-ieee.c │ ├── atof-ieee.h │ ├── bignum.h │ ├── cctools.plist │ ├── driver.c │ ├── dwarf2dbg.c │ ├── dwarf2dbg.h │ ├── expr.c │ ├── expr.h │ ├── filenames.h │ ├── fixes.c │ ├── fixes.h │ ├── flonum-const.c │ ├── flonum-copy.c │ ├── flonum-mult.c │ ├── flonum.h │ ├── frags.c │ ├── frags.h │ ├── hash.c │ ├── hash.h │ ├── hex-value.c │ ├── hex_value.h │ ├── hppa-aux.c │ ├── hppa-aux.h │ ├── hppa-check.c │ ├── hppa-opcode.h │ ├── hppa.c │ ├── i386-check.c │ ├── i386-opcode.h │ ├── i386.c │ ├── i386.h │ ├── i860-check.c │ ├── i860-opcode.h │ ├── i860.c │ ├── input-file.c │ ├── input-file.h │ ├── input-scrub.c │ ├── input-scrub.h │ ├── layout.c │ ├── layout.h │ ├── m68k-check.c │ ├── m68k-opcode.h │ ├── m68k.c │ ├── m88k-check.c │ ├── m88k-opcode.h │ ├── m88k.c │ ├── md.h │ ├── messages.c │ ├── messages.h │ ├── notes │ ├── obstack.c │ ├── obstack.h │ ├── ppc-check.c │ ├── ppc-opcode.h │ ├── ppc.c │ ├── read.c │ ├── read.h │ ├── relax.h │ ├── sections.c │ ├── sections.h │ ├── sparc-check.c │ ├── sparc-opcode.h │ ├── sparc.c │ ├── struc-symbol.h │ ├── symbols.c │ ├── symbols.h │ ├── write_object.c │ ├── write_object.h │ ├── xmalloc.c │ └── xmalloc.h ├── cbtlibs │ ├── Makefile │ ├── libsyminfo.c │ └── notes ├── efitools │ ├── Makefile │ ├── makerelocs.c │ ├── mtoc.c │ └── notes ├── gprof │ ├── Makefile │ ├── arcs.c │ ├── calls.c │ ├── dfn.c │ ├── getnfile.c │ ├── gprof.c │ ├── gprof.callg │ ├── gprof.flat │ ├── gprof.h │ ├── hertz.c │ ├── lookup.c │ ├── m68k.h │ ├── notes │ ├── printgprof.c │ ├── printlist.c │ ├── scatter.c │ └── vax.h ├── include │ ├── Makefile │ ├── architecture │ │ ├── i386 │ │ │ ├── fpu.h │ │ │ └── frame.h │ │ ├── m88k │ │ │ ├── fp_regs.h │ │ │ └── reg_help.h │ │ ├── nrw │ │ │ ├── macro_help.h │ │ │ └── reg_help.h │ │ └── sparc │ │ │ └── reg.h │ ├── cbt │ │ └── libsyminfo.h │ ├── coff │ │ ├── aouthdr.h │ │ ├── base_relocs.h │ │ ├── bytesex.h │ │ ├── debug_directory.h │ │ ├── filehdr.h │ │ ├── ms_dos_stub.h │ │ ├── scnhdr.h │ │ └── syment.h │ ├── elf │ │ └── dwarf2.h │ ├── gnu │ │ ├── a.out.h │ │ ├── exec.h │ │ └── symseg.h │ ├── mach-o │ │ ├── arch.h │ │ ├── arm │ │ │ └── reloc.h │ │ ├── dyld.h │ │ ├── dyld_debug.h │ │ ├── dyld_gdb.h │ │ ├── dyld_priv.h │ │ ├── fat.h │ │ ├── getsect.h │ │ ├── gmon.h │ │ ├── hppa │ │ │ ├── reloc.h │ │ │ └── swap.h │ │ ├── i386 │ │ │ └── swap.h │ │ ├── i860 │ │ │ ├── reloc.h │ │ │ └── swap.h │ │ ├── kld.h │ │ ├── ldsyms.h │ │ ├── loader.h │ │ ├── m68k │ │ │ └── swap.h │ │ ├── m88k │ │ │ ├── reloc.h │ │ │ └── swap.h │ │ ├── nlist.h │ │ ├── ppc │ │ │ ├── reloc.h │ │ │ └── swap.h │ │ ├── ranlib.h │ │ ├── redo_prebinding.h │ │ ├── reloc.h │ │ ├── rld.h │ │ ├── rld_state.h │ │ ├── sarld.h │ │ ├── sparc │ │ │ ├── reloc.h │ │ │ └── swap.h │ │ ├── stab.h │ │ ├── swap.h │ │ └── x86_64 │ │ │ └── reloc.h │ ├── mach │ │ ├── arm │ │ │ └── thread_status.h │ │ ├── hppa │ │ │ └── thread_status.h │ │ ├── i860 │ │ │ └── thread_status.h │ │ ├── m68k │ │ │ └── thread_status.h │ │ ├── m88k │ │ │ └── thread_status.h │ │ ├── machine.h │ │ └── sparc │ │ │ └── thread_status.h │ ├── notes │ ├── opcode │ │ └── arm.h │ ├── standalone │ │ └── libsa.h │ ├── stuff │ │ ├── SymLoc.h │ │ ├── allocate.h │ │ ├── arch.h │ │ ├── best_arch.h │ │ ├── bool.h │ │ ├── breakout.h │ │ ├── bytesex.h │ │ ├── crc32.h │ │ ├── dylib_roots.h │ │ ├── dylib_table.h │ │ ├── errors.h │ │ ├── execute.h │ │ ├── guess_short_name.h │ │ ├── hash_string.h │ │ ├── hppa.h │ │ ├── lto.h │ │ ├── macosx_deployment_target.h │ │ ├── ofile.h │ │ ├── openstep_mach.h │ │ ├── print.h │ │ ├── reloc.h │ │ ├── round.h │ │ ├── seg_addr_table.h │ │ ├── symbol.h │ │ ├── symbol_list.h │ │ ├── unix_standard_mode.h │ │ ├── version_number.h │ │ └── vm_flush_cache.h │ └── sys │ │ └── gmon.h ├── ld │ ├── 4byte_literals.c │ ├── 4byte_literals.h │ ├── 8byte_literals.c │ ├── 8byte_literals.h │ ├── Makefile │ ├── arm_reloc.c │ ├── arm_reloc.h │ ├── coalesced_sections.c │ ├── coalesced_sections.h │ ├── cstring_literals.c │ ├── cstring_literals.h │ ├── debugcompunit.c │ ├── debugcompunit.h │ ├── debugline.c │ ├── debugline.h │ ├── dwarf2.h │ ├── dylibs.c │ ├── dylibs.h │ ├── fvmlibs.c │ ├── fvmlibs.h │ ├── generic_reloc.c │ ├── generic_reloc.h │ ├── hash_string.h │ ├── hppa_reloc.c │ ├── hppa_reloc.h │ ├── i860_reloc.c │ ├── i860_reloc.h │ ├── indirect_sections.c │ ├── indirect_sections.h │ ├── layout.c │ ├── layout.h │ ├── ld.c │ ├── ld.h │ ├── librld.ofileList │ ├── literal_pointers.c │ ├── literal_pointers.h │ ├── live_refs.h │ ├── m88k_reloc.c │ ├── m88k_reloc.h │ ├── mod_sections.c │ ├── mod_sections.h │ ├── notes │ ├── objects.c │ ├── objects.h │ ├── pass1.c │ ├── pass1.h │ ├── pass2.c │ ├── pass2.h │ ├── ppc_reloc.c │ ├── ppc_reloc.h │ ├── rld.c │ ├── sections.c │ ├── sections.h │ ├── sets.c │ ├── sets.h │ ├── sparc_reloc.c │ ├── sparc_reloc.h │ ├── specs.c │ ├── specs.h │ ├── symbols.c │ ├── symbols.h │ ├── uuid.c │ └── uuid.h ├── libmacho │ ├── Makefile │ ├── arch.c │ ├── dylib.ofileList │ ├── get_end.c │ ├── getsecbyname.c │ ├── getsegbyname.c │ ├── hppa_swap.c │ ├── i386_swap.c │ ├── i860_swap.c │ ├── m68k_swap.c │ ├── m88k_swap.c │ ├── notes │ ├── ppc_swap.c │ ├── shlib.ofileList │ ├── sparc_swap.c │ └── swap.c ├── libstuff │ ├── Makefile │ ├── SymLoc.c │ ├── allocate.c │ ├── arch.c │ ├── arch_usage.c │ ├── best_arch.c │ ├── breakout.c │ ├── bytesex.c │ ├── checkout.c │ ├── coff_bytesex.c │ ├── crc32.c │ ├── dylib_roots.c │ ├── dylib_table.c │ ├── errors.c │ ├── execute.c │ ├── fatal_arch.c │ ├── fatals.c │ ├── get_arch_from_host.c │ ├── get_toc_byte_sex.c │ ├── guess_short_name.c │ ├── hash_string.c │ ├── hppa.c │ ├── lto.c │ ├── macosx_deployment_target.c │ ├── notes │ ├── ofile.c │ ├── ofile_error.c │ ├── ofile_get_word.c │ ├── print.c │ ├── reloc.c │ ├── round.c │ ├── seg_addr_table.c │ ├── set_arch_flag_name.c │ ├── swap_headers.c │ ├── symbol_list.c │ ├── unix_standard_mode.c │ ├── version_number.c │ ├── vm_flush_cache.c │ └── writeout.c ├── man │ ├── Mach-O.5 │ ├── Makefile │ ├── NSModule.3 │ ├── NSObjectFileImage.3 │ ├── NSObjectFileImage_priv.3 │ ├── a.out.5 │ ├── arch.3 │ ├── as.1 │ ├── check_dylib.1 │ ├── checksyms.1 │ ├── cmpdylib.1 │ ├── codesign_allocate.1 │ ├── dyld.1 │ ├── dyld.3 │ ├── dyld_debug.3 │ ├── end.3 │ ├── get_end.3 │ ├── getsectbyname.3 │ ├── getsectbynamefromheader.3 │ ├── getsectdata.3 │ ├── getsectdatafromheader.3 │ ├── getsegbyname.3 │ ├── gprof.1 │ ├── indr.1 │ ├── install_name_tool.1 │ ├── kld.3 │ ├── ld_classic.1 │ ├── libsyminfo.3 │ ├── libtool.1 │ ├── lipo.1 │ ├── mtoc.1 │ ├── nm.1 │ ├── nmedit.1 │ ├── notes │ ├── otool.1 │ ├── pagestuff.1 │ ├── ranlib.1 │ ├── ranlib.5 │ ├── redo_prebinding.1 │ ├── redo_prebinding.3 │ ├── seg_addr_table.1 │ ├── segedit.1 │ ├── size.1 │ ├── stab.5 │ ├── strings.1 │ └── strip.1 ├── misc │ ├── Info.plist │ ├── Makefile │ ├── check_dylib.c │ ├── checksyms.c │ ├── cmpdylib.c │ ├── codesign_allocate.c │ ├── indr.c │ ├── inout.c │ ├── install_name_tool.c │ ├── libtool.c │ ├── lipo.c │ ├── nm.c │ ├── notes │ ├── pagestuff.c │ ├── redo_prebinding.c │ ├── seg_addr_table.c │ ├── seg_hack.c │ ├── segedit.c │ ├── size.c │ ├── strings.c │ └── strip.c └── otool │ ├── Makefile │ ├── arm_disasm.c │ ├── arm_disasm.h │ ├── coff_print.c │ ├── hppa_disasm.c │ ├── hppa_disasm.h │ ├── i386_disasm.c │ ├── i386_disasm.h │ ├── i860_disasm.c │ ├── i860_disasm.h │ ├── m68k_disasm.c │ ├── m68k_disasm.h │ ├── m88k_disasm.c │ ├── m88k_disasm.h │ ├── main.c │ ├── notes │ ├── notify.c │ ├── notify.h │ ├── ofile_print.c │ ├── ofile_print.h │ ├── otool.h │ ├── ppc_disasm.c │ ├── ppc_disasm.h │ ├── print_objc.c │ ├── print_objc2_32bit.c │ ├── print_objc2_64bit.c │ ├── sparc_disasm.c │ └── sparc_disasm.h ├── magichat.icns ├── main.m ├── objc4-437.1 ├── APPLE_LICENSE ├── ReleaseNotes.rtf ├── libobjc.order ├── markgc.c ├── objc.sln ├── objc.suo ├── objc.vcproj ├── objc.xcodeproj │ └── project.pbxproj ├── objcrt │ └── objcrt.vcproj ├── runtests.sh ├── runtime │ ├── Accessors.subproj │ │ ├── objc-accessors.h │ │ └── objc-accessors.m │ ├── Auto.subproj │ │ ├── objc-auto-i386.s │ │ ├── objc-auto-ppc.s │ │ ├── objc-auto-ppc64.s │ │ └── objc-auto-x86_64.s │ ├── Messengers.subproj │ │ ├── objc-msg-arm.s │ │ ├── objc-msg-i386.s │ │ ├── objc-msg-ppc.s │ │ ├── objc-msg-win32.m │ │ └── objc-msg-x86_64.s │ ├── Object.h │ ├── Object.m │ ├── OldClasses.subproj │ │ ├── List.h │ │ └── List.m │ ├── Protocol.h │ ├── Protocol.m │ ├── error.h │ ├── hashtable.h │ ├── hashtable2.h │ ├── hashtable2.m │ ├── maptable.h │ ├── maptable.m │ ├── message.h │ ├── objc-api.h │ ├── objc-auto-dump.h │ ├── objc-auto-dump.m │ ├── objc-auto.h │ ├── objc-auto.m │ ├── objc-cache.m │ ├── objc-class-old.m │ ├── objc-class.h │ ├── objc-class.m │ ├── objc-config.h │ ├── objc-errors.m │ ├── objc-exception.h │ ├── objc-exception.m │ ├── objc-file.m │ ├── objc-gdb.h │ ├── objc-initialize.h │ ├── objc-initialize.m │ ├── objc-internal.h │ ├── objc-layout.m │ ├── objc-load.h │ ├── objc-load.m │ ├── objc-loadmethod.h │ ├── objc-loadmethod.m │ ├── objc-lockdebug.m │ ├── objc-os.h │ ├── objc-os.m │ ├── objc-private.h │ ├── objc-probes.d │ ├── objc-references.h │ ├── objc-references.mm │ ├── objc-rtp.h │ ├── objc-rtp.m │ ├── objc-runtime-new.h │ ├── objc-runtime-new.m │ ├── objc-runtime-old.m │ ├── objc-runtime.h │ ├── objc-runtime.m │ ├── objc-sel-set.h │ ├── objc-sel-set.m │ ├── objc-sel-table.s │ ├── objc-sel.mm │ ├── objc-selopt.h │ ├── objc-sync.h │ ├── objc-sync.m │ ├── objc-typeencoding.m │ ├── objc.h │ ├── objcrt.c │ ├── objcrt.h │ └── runtime.h ├── test │ ├── Makefile │ ├── README │ ├── accessors.m │ ├── addMethod.m │ ├── association-cf.m │ ├── cacheflush.h │ ├── cacheflush.m │ ├── cacheflush0.m │ ├── cacheflush2.m │ ├── cacheflush3.m │ ├── category.m │ ├── classgetclass.m │ ├── classname.m │ ├── classpair.m │ ├── classversion.m │ ├── concurrentcat.m │ ├── concurrentcat_category.m │ ├── copyIvarList.m │ ├── copyMethodList.m │ ├── copyPropertyList.m │ ├── createInstance.m │ ├── debuggerMode.m │ ├── definitions.m │ ├── duplicateClass.m │ ├── errcheck.pl │ ├── exc.m │ ├── exchangeImp.m │ ├── fail.m │ ├── foreach.m │ ├── forward.m │ ├── future.h │ ├── future0.m │ ├── future1.m │ ├── future2.m │ ├── gc.c │ ├── gc.m │ ├── gcenforcer.m │ ├── gcenforcer_nogc.gc.expected-stderr │ ├── gcenforcer_nogc.nogc.expected-stderr │ ├── gcenforcer_requiresgc.gc.expected-stderr │ ├── gcenforcer_requiresgc.nogc.expected-stderr │ ├── gdb-lock.m │ ├── gdb.m │ ├── getMethod.m │ ├── ignoredSelector.m │ ├── imageorder.h │ ├── imageorder.m │ ├── imageorder1.m │ ├── imageorder2.m │ ├── imageorder3.m │ ├── initialize.m │ ├── instanceSize.m │ ├── ismeta.m │ ├── ivar.m │ ├── ivarSlide.h │ ├── ivarSlide1.m │ ├── ivarSlide2.m │ ├── layout.m │ ├── load-order.m │ ├── load-order1.m │ ├── load-order2.m │ ├── load-order3.m │ ├── load-parallel.m │ ├── load-parallel0.m │ ├── load-parallel00.m │ ├── load-reentrant.m │ ├── load-reentrant2.m │ ├── load.m │ ├── main.m │ ├── methodArgs.m │ ├── method_getName.m │ ├── msgSend.m │ ├── nilAPIArgs.m │ ├── nsobject.m │ ├── property.m │ ├── protocol.m │ ├── protocol_copyMethodList.m │ ├── protocol_copyPropertyList.m │ ├── protocol_cw.m │ ├── resolve.expected-stderr │ ├── resolve.m │ ├── runtime.expected-stderr │ ├── runtime.m │ ├── sel.m │ ├── setSuper.m │ ├── super.m │ ├── synchronized-counter.m │ ├── synchronized-grid.m │ ├── synchronized.m │ ├── test.h │ ├── test.xcodeproj │ │ └── project.pbxproj │ ├── unload.h │ ├── unload.m │ ├── unload2.m │ ├── unload3.m │ ├── unload4.m │ ├── unwind.m │ ├── weakcopy.m │ └── zone.m └── unexported_symbols ├── otx ├── English.lproj │ ├── Help │ │ ├── Contents │ │ │ ├── chapter_2_section_1.html │ │ │ ├── chapter_2_section_10.html │ │ │ ├── chapter_2_section_11.html │ │ │ ├── chapter_2_section_12.html │ │ │ ├── chapter_2_section_2.html │ │ │ ├── chapter_2_section_3.html │ │ │ ├── chapter_2_section_4.html │ │ │ ├── chapter_2_section_5.html │ │ │ ├── chapter_2_section_6.html │ │ │ ├── chapter_2_section_7.html │ │ │ ├── chapter_2_section_8.html │ │ │ ├── index.html │ │ │ ├── index_last.html │ │ │ ├── toc.html │ │ │ └── toc_closed.html │ │ ├── Overview │ │ │ ├── chapter_1_section_1.html │ │ │ ├── chapter_1_section_2.html │ │ │ ├── index.html │ │ │ ├── index_last.html │ │ │ ├── toc.html │ │ │ └── toc_closed.html │ │ ├── art │ │ │ ├── iconhelpcenter.png │ │ │ ├── iconhelptoc.png │ │ │ └── otxArt.png │ │ ├── images │ │ │ ├── MainWindow.jpg │ │ │ ├── bullet.gif │ │ │ ├── dash.gif │ │ │ ├── download.gif │ │ │ ├── graydiamond.gif │ │ │ ├── hideframes.gif │ │ │ ├── larg_bullet.gif │ │ │ ├── next.gif │ │ │ ├── pdf.gif │ │ │ ├── previous.gif │ │ │ ├── showframes.gif │ │ │ ├── sm_bullet.gif │ │ │ ├── sm_dash.gif │ │ │ ├── sm_opentriangle.gif │ │ │ ├── sm_triangle.gif │ │ │ └── up.gif │ │ └── index.html │ └── MainMenu.nib │ │ ├── classes.nib │ │ ├── designable.nib │ │ ├── info.nib │ │ └── keyedobjects.nib ├── Info.plist ├── Version.plist ├── images │ ├── App Icon.icns │ ├── Main Window Background.tif │ ├── Prefs General Icon.tif │ └── Prefs Output Icon.tif ├── main.m ├── otx.xcodeproj │ └── project.pbxproj ├── otx_Prefix.pch └── source │ ├── AppController.h │ ├── AppController.m │ ├── CLIController.h │ ├── CLIController.m │ ├── Categories │ ├── Arch64Specifics.h │ ├── Arch64Specifics.m │ ├── ArchSpecifics.h │ ├── ArchSpecifics.m │ ├── List64Utils.h │ ├── List64Utils.m │ ├── ListUtils.h │ ├── ListUtils.m │ ├── Objc64Accessors.h │ ├── Objc64Accessors.m │ ├── ObjcAccessors.h │ ├── ObjcAccessors.m │ ├── Object64Loader.h │ ├── Object64Loader.m │ ├── ObjectLoader.h │ ├── ObjectLoader.m │ ├── Searchers.h │ ├── Searchers.m │ ├── Searchers64.h │ ├── Searchers64.m │ ├── SysUtils.h │ └── SysUtils.m │ ├── DropBox.h │ ├── DropBox.m │ ├── ObjcSwap.c │ ├── ObjcSwap.h │ ├── Optimizations.h │ ├── Optimizations32.h │ ├── Optimizations64.h │ ├── Processors │ ├── Exe32Processor.h │ ├── Exe32Processor.m │ ├── Exe64Processor.h │ ├── Exe64Processor.m │ ├── ExeProcessor.h │ ├── ExeProcessor.m │ ├── PPC64Processor.h │ ├── PPC64Processor.m │ ├── PPCProcessor.h │ ├── PPCProcessor.m │ ├── X8664Processor.h │ ├── X8664Processor.m │ ├── X86Processor.h │ └── X86Processor.m │ ├── Protocols │ ├── Deobfuscator.h │ ├── ErrorReporter.h │ └── ProgressReporter.h │ ├── SharedDefs.h │ ├── SmoothViewAnimation.h │ ├── SmoothViewAnimation.m │ ├── StolenDefs.h │ ├── SyscallStrings.h │ ├── SystemIncludes.h │ └── UserDefaultKeys.h └── rb_main.rb /.gitignore: -------------------------------------------------------------------------------- 1 | build 2 | 3 | *.pbxuser 4 | *.perspectivev3 5 | *.mode1v3 6 | *.mode2v3 7 | !default.pbxuser 8 | !default.perspectivev3 9 | !default.mode1v3 10 | !default.mode2v3 11 | 12 | *~.nib 13 | *~.xib 14 | 15 | .DS_Store 16 | -------------------------------------------------------------------------------- /ASSIGN.h: -------------------------------------------------------------------------------- 1 | #define ASSIGN_ATTR(RECEIVER, KEY, SOURCE) RECEIVER.KEY##Value = (SOURCE)->KEY 2 | -------------------------------------------------------------------------------- /English.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/English.lproj/InfoPlist.strings -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIconFile 10 | magichat.icns 11 | CFBundleIdentifier 12 | com.rentzsch.MagicHat 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 2.0d1 23 | NSMainNibFile 24 | MainMenu 25 | NSPrincipalClass 26 | NSApplication 27 | 28 | 29 | -------------------------------------------------------------------------------- /MagicHat Tests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.yourcompany.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /MagicHat_DataModel.xcdatamodel/elements: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/MagicHat_DataModel.xcdatamodel/elements -------------------------------------------------------------------------------- /MagicHat_DataModel.xcdatamodel/layout: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/MagicHat_DataModel.xcdatamodel/layout -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOClassesSection64MO.h: -------------------------------------------------------------------------------- 1 | #import "_MachOClassesSection64MO.h" 2 | 3 | @interface MachOClassesSection64MO : _MachOClassesSection64MO {} 4 | // Custom logic goes here. 5 | @end 6 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOClassesSection64MO.m: -------------------------------------------------------------------------------- 1 | #import "MachOClassesSection64MO.h" 2 | 3 | @implementation MachOClassesSection64MO 4 | 5 | // Custom logic goes here. 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOCommandMO.h: -------------------------------------------------------------------------------- 1 | #import "_MachOCommandMO.h" 2 | #import 3 | 4 | @interface MachOCommandMO : _MachOCommandMO {} 5 | 6 | + (id)commandWithOriginalLoadCommand:(struct load_command*)originalLoadCommand header:(MachOHeaderMO*)header; 7 | 8 | - (void)setLoadCommand:(struct load_command*)swappedLoadCommand; // Implemented by subclasses. 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOFileMO.h: -------------------------------------------------------------------------------- 1 | #import "_MachOFileMO.h" 2 | 3 | @interface MachOFileMO : _MachOFileMO {} 4 | @property (retain) NSData *fileData; 5 | 6 | - (BOOL)parseFileURL:(NSURL*)url_ error:(NSError**)error_; 7 | 8 | @end 9 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOFileMO.m: -------------------------------------------------------------------------------- 1 | #import "MachOFileMO.h" 2 | //#include "stuff/ofile.h" 3 | //#include "stuff/allocate.h" 4 | //#include "otool/ofile_print.h" 5 | #import "MachOHeaderMO.h" 6 | 7 | char *progname = "my_progname"; 8 | 9 | @interface MachOFileMO () 10 | - (void)processOFile:(struct ofile*)ofile archName:(char*)archName; 11 | @end 12 | 13 | void ofile_processor(struct ofile *ofile, char *arch_name, void *cookie) { 14 | [(MachOFileMO*)cookie processOFile:ofile archName:arch_name]; 15 | } 16 | 17 | @implementation MachOFileMO 18 | @synthesize fileData; 19 | 20 | - (BOOL)parseFileURL:(NSURL*)url_ error:(NSError**)error_ { 21 | ofile_process( 22 | (char*)[[url_ path] fileSystemRepresentation], // name 23 | NULL, // arch_flags 24 | 0, // narch_flags 25 | TRUE, // all_archs 26 | TRUE, // process_non_objects 27 | TRUE, // dylib_flat 28 | TRUE, // use_member_syntax 29 | ofile_processor, // processor 30 | self); // cookie 31 | 32 | return YES; 33 | } 34 | 35 | - (void)processOFile:(struct ofile*)ofile archName:(char*)arch_name { 36 | if(ofile->mh == NULL && ofile->mh64 == NULL) 37 | return; 38 | 39 | if (!self.fileData) { 40 | self.fileData = [[NSData alloc] initWithBytes:ofile->file_addr 41 | length:ofile->file_size]; 42 | } 43 | 44 | MachOHeaderMO *header = [MachOHeaderMO insertInManagedObjectContext:[self managedObjectContext]]; 45 | [self addHeadersObject:header]; 46 | header.archName = arch_name ? [NSString stringWithUTF8String:arch_name] : @"main arch"; 47 | 48 | [header processOFile:ofile]; 49 | } 50 | 51 | @end 52 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOHeaderMO.h: -------------------------------------------------------------------------------- 1 | #import "_MachOHeaderMO.h" 2 | #include "stuff/ofile.h" 3 | 4 | @interface MachOHeaderMO : _MachOHeaderMO {} 5 | @property BOOL swap; 6 | 7 | - (void)processOFile:(struct ofile*)ofile; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOSection32MO.h: -------------------------------------------------------------------------------- 1 | #import "_MachOSection32MO.h" 2 | #import 3 | 4 | @class MachOSegmentCommandMO; 5 | 6 | @interface MachOSection32MO : _MachOSection32MO {} 7 | 8 | + (id)sectionWithSection32:(struct section*)swappedSection segment:(MachOSegmentCommandMO*)segment; 9 | - (void)setSection32:(struct section*)swappedSection; 10 | 11 | @end 12 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOSection32MO.m: -------------------------------------------------------------------------------- 1 | #import "MachOSection32MO.h" 2 | /*#import "MachOSegmentCommandMO.h" 3 | #import "MachOClassesSectionMO.h" 4 | #import "NSString+jr_stringWithUTF8StringmaxLength.h"*/ 5 | #import "ASSIGN.h" 6 | 7 | @implementation MachOSection32MO 8 | 9 | + (id)sectionWithSection32:(struct section*)swappedSection segment:(MachOSegmentCommandMO*)segment { 10 | assert(!"TODO"); 11 | return nil; 12 | /*NSString *sectionName = [NSString jr_stringWithUTF8String:swappedSection->sectname maxLength:sizeof(swappedSection->sectname)]; 13 | Class section_class = [sectionName isEqualToString:@"__objc_classlist"] ? [MachOClassesSectionMO class] : [MachOSectionMO class]; 14 | 15 | MachOSectionMO *section = [section_class insertInManagedObjectContext:[segment managedObjectContext]]; 16 | [segment addSectionsObject:section]; 17 | [section setSection:swappedSection]; 18 | return section;*/ 19 | } 20 | 21 | - (void)setSection32:(struct section*)swappedSection { 22 | self.sectname = [NSString jr_stringWithUTF8String:swappedSection->sectname maxLength:sizeof(swappedSection->sectname)]; 23 | self.segname = [NSString jr_stringWithUTF8String:swappedSection->segname maxLength:sizeof(swappedSection->segname)]; 24 | ASSIGN_ATTR(self, addr, swappedSection); 25 | ASSIGN_ATTR(self, size, swappedSection); 26 | ASSIGN_ATTR(self, offset, swappedSection); 27 | ASSIGN_ATTR(self, align, swappedSection); 28 | ASSIGN_ATTR(self, reloff, swappedSection); 29 | ASSIGN_ATTR(self, nreloc, swappedSection); 30 | ASSIGN_ATTR(self, flags, swappedSection); 31 | ASSIGN_ATTR(self, reserved1, swappedSection); 32 | ASSIGN_ATTR(self, reserved2, swappedSection); 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOSection64MO.h: -------------------------------------------------------------------------------- 1 | #import "_MachOSection64MO.h" 2 | #import 3 | 4 | @class MachOSegmentCommandMO; 5 | 6 | @interface MachOSection64MO : _MachOSection64MO {} 7 | 8 | + (id)sectionWithSection64:(struct section_64*)swappedSection segment:(MachOSegmentCommandMO*)segment; 9 | 10 | - (void)setSection64:(struct section_64*)swappedSection; 11 | 12 | @end 13 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOSection64MO.m: -------------------------------------------------------------------------------- 1 | #import "MachOSection64MO.h" 2 | 3 | @implementation MachOSection64MO 4 | 5 | + (id)sectionWithSection64:(struct section_64*)swappedSection segment:(MachOSegmentCommandMO*)segment { 6 | NSString *sectionName = [NSString jr_stringWithUTF8String:swappedSection->sectname maxLength:sizeof(swappedSection->sectname)]; 7 | Class section_class = [sectionName isEqualToString:@"__objc_classlist"] ? [MachOClassesSectionMO class] : [MachOSectionMO class]; 8 | 9 | MachOSectionMO *section = [section_class insertInManagedObjectContext:[segment managedObjectContext]]; 10 | [segment addSectionsObject:section]; 11 | [section setSection64:swappedSection]; 12 | return section; 13 | } 14 | 15 | - (void)setSection64:(struct section_64*)swappedSection { 16 | self.sectname = [NSString jr_stringWithUTF8String:swappedSection->sectname maxLength:sizeof(swappedSection->sectname)]; 17 | self.segname = [NSString jr_stringWithUTF8String:swappedSection->segname maxLength:sizeof(swappedSection->segname)]; 18 | ASSIGN_ATTR(self, addr, swappedSection); 19 | ASSIGN_ATTR(self, size, swappedSection); 20 | ASSIGN_ATTR(self, offset, swappedSection); 21 | ASSIGN_ATTR(self, align, swappedSection); 22 | ASSIGN_ATTR(self, reloff, swappedSection); 23 | ASSIGN_ATTR(self, nreloc, swappedSection); 24 | ASSIGN_ATTR(self, flags, swappedSection); 25 | ASSIGN_ATTR(self, reserved1, swappedSection); 26 | ASSIGN_ATTR(self, reserved2, swappedSection); 27 | ASSIGN_ATTR(self, reserved3, swappedSection); // section_64-only 28 | } 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOSectionMO.h: -------------------------------------------------------------------------------- 1 | #import "_MachOSectionMO.h" 2 | 3 | @class MachOSegmentCommandMO; 4 | 5 | @interface MachOSectionMO : _MachOSectionMO {} 6 | 7 | - (NSData*)sectionData; 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOSectionMO.m: -------------------------------------------------------------------------------- 1 | #import "MachOSectionMO.h" 2 | #import "MachOSegmentCommandMO.h" 3 | #import "MachOHeaderMO.h" 4 | #import "MachOFileMO.h" 5 | 6 | @implementation MachOSectionMO 7 | 8 | - (NSData*)sectionData { 9 | const char *fileDataPtr = [self.segment.header.file.fileData bytes]; 10 | const char *sectionDataPtr = fileDataPtr + self.segment.header.offsetValue + self.offsetValue; 11 | return [NSData dataWithBytesNoCopy:(void*)sectionDataPtr length:self.sizeValue freeWhenDone:NO]; 12 | } 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /MagicHat_DataModel/MachOSegmentCommandMO.h: -------------------------------------------------------------------------------- 1 | #import "_MachOSegmentCommandMO.h" 2 | 3 | @interface MachOSegmentCommandMO : _MachOSegmentCommandMO {} 4 | // Custom logic goes here. 5 | @end 6 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOClassesSection64MO.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOClassesSection64MO.h instead. 3 | 4 | #import 5 | #import "MachOSection64MO.h" 6 | 7 | 8 | @interface MachOClassesSection64MOID : NSManagedObjectID {} 9 | @end 10 | 11 | @interface _MachOClassesSection64MO : MachOSection64MO {} 12 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_; 13 | - (MachOClassesSection64MOID*)objectID; 14 | 15 | 16 | 17 | 18 | @end 19 | 20 | @interface _MachOClassesSection64MO (CoreDataGeneratedAccessors) 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOClassesSection64MO.m: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOClassesSection64MO.m instead. 3 | 4 | #import "_MachOClassesSection64MO.h" 5 | 6 | @implementation MachOClassesSection64MOID 7 | @end 8 | 9 | @implementation _MachOClassesSection64MO 10 | 11 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_ { 12 | NSParameterAssert(moc_); 13 | return [NSEntityDescription insertNewObjectForEntityForName:@"MachOClassesSection64" inManagedObjectContext:moc_]; 14 | } 15 | 16 | - (MachOClassesSection64MOID*)objectID { 17 | return (MachOClassesSection64MOID*)[super objectID]; 18 | } 19 | 20 | 21 | 22 | 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOCommandMO.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOCommandMO.h instead. 3 | 4 | #import 5 | 6 | 7 | @class MachOHeaderMO; 8 | 9 | @interface MachOCommandMOID : NSManagedObjectID {} 10 | @end 11 | 12 | @interface _MachOCommandMO : NSManagedObject {} 13 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_; 14 | - (MachOCommandMOID*)objectID; 15 | 16 | 17 | 18 | @property (nonatomic, retain) NSString *name; 19 | 20 | //- (BOOL)validateName:(id*)value_ error:(NSError**)error_; 21 | 22 | 23 | 24 | @property (nonatomic, retain) NSNumber *cmdsize; 25 | 26 | @property int cmdsizeValue; 27 | - (int)cmdsizeValue; 28 | - (void)setCmdsizeValue:(int)value_; 29 | 30 | //- (BOOL)validateCmdsize:(id*)value_ error:(NSError**)error_; 31 | 32 | 33 | 34 | @property (nonatomic, retain) NSNumber *cmdoffset; 35 | 36 | @property long long cmdoffsetValue; 37 | - (long long)cmdoffsetValue; 38 | - (void)setCmdoffsetValue:(long long)value_; 39 | 40 | //- (BOOL)validateCmdoffset:(id*)value_ error:(NSError**)error_; 41 | 42 | 43 | 44 | @property (nonatomic, retain) NSNumber *cmd; 45 | 46 | @property int cmdValue; 47 | - (int)cmdValue; 48 | - (void)setCmdValue:(int)value_; 49 | 50 | //- (BOOL)validateCmd:(id*)value_ error:(NSError**)error_; 51 | 52 | 53 | 54 | 55 | @property (nonatomic, retain) MachOHeaderMO* header; 56 | //- (BOOL)validateHeader:(id*)value_ error:(NSError**)error_; 57 | 58 | 59 | 60 | @end 61 | 62 | @interface _MachOCommandMO (CoreDataGeneratedAccessors) 63 | 64 | @end 65 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOCommandMO.m: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOCommandMO.m instead. 3 | 4 | #import "_MachOCommandMO.h" 5 | 6 | @implementation MachOCommandMOID 7 | @end 8 | 9 | @implementation _MachOCommandMO 10 | 11 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_ { 12 | NSParameterAssert(moc_); 13 | return [NSEntityDescription insertNewObjectForEntityForName:@"MachOCommand" inManagedObjectContext:moc_]; 14 | } 15 | 16 | - (MachOCommandMOID*)objectID { 17 | return (MachOCommandMOID*)[super objectID]; 18 | } 19 | 20 | 21 | 22 | 23 | @dynamic name; 24 | 25 | 26 | 27 | 28 | 29 | 30 | @dynamic cmdsize; 31 | 32 | 33 | 34 | - (int)cmdsizeValue { 35 | NSNumber *result = [self cmdsize]; 36 | return result ? [result intValue] : 0; 37 | } 38 | 39 | - (void)setCmdsizeValue:(int)value_ { 40 | [self setCmdsize:[NSNumber numberWithInt:value_]]; 41 | } 42 | 43 | 44 | 45 | 46 | 47 | 48 | @dynamic cmdoffset; 49 | 50 | 51 | 52 | - (long long)cmdoffsetValue { 53 | NSNumber *result = [self cmdoffset]; 54 | return result ? [result longLongValue] : 0; 55 | } 56 | 57 | - (void)setCmdoffsetValue:(long long)value_ { 58 | [self setCmdoffset:[NSNumber numberWithLongLong:value_]]; 59 | } 60 | 61 | 62 | 63 | 64 | 65 | 66 | @dynamic cmd; 67 | 68 | 69 | 70 | - (int)cmdValue { 71 | NSNumber *result = [self cmd]; 72 | return result ? [result intValue] : 0; 73 | } 74 | 75 | - (void)setCmdValue:(int)value_ { 76 | [self setCmd:[NSNumber numberWithInt:value_]]; 77 | } 78 | 79 | 80 | 81 | 82 | 83 | 84 | @dynamic header; 85 | 86 | 87 | 88 | 89 | 90 | @end 91 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOFileMO.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOFileMO.h instead. 3 | 4 | #import 5 | 6 | 7 | @class MachOHeaderMO; 8 | 9 | @interface MachOFileMOID : NSManagedObjectID {} 10 | @end 11 | 12 | @interface _MachOFileMO : NSManagedObject {} 13 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_; 14 | - (MachOFileMOID*)objectID; 15 | 16 | 17 | 18 | 19 | @property (nonatomic, retain) NSSet* headers; 20 | - (NSMutableSet*)headersSet; 21 | 22 | 23 | 24 | @end 25 | 26 | @interface _MachOFileMO (CoreDataGeneratedAccessors) 27 | 28 | - (void)addHeaders:(NSSet*)value_; 29 | - (void)removeHeaders:(NSSet*)value_; 30 | - (void)addHeadersObject:(MachOHeaderMO*)value_; 31 | - (void)removeHeadersObject:(MachOHeaderMO*)value_; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOFileMO.m: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOFileMO.m instead. 3 | 4 | #import "_MachOFileMO.h" 5 | 6 | @implementation MachOFileMOID 7 | @end 8 | 9 | @implementation _MachOFileMO 10 | 11 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_ { 12 | NSParameterAssert(moc_); 13 | return [NSEntityDescription insertNewObjectForEntityForName:@"MachOFile" inManagedObjectContext:moc_]; 14 | } 15 | 16 | - (MachOFileMOID*)objectID { 17 | return (MachOFileMOID*)[super objectID]; 18 | } 19 | 20 | 21 | 22 | 23 | @dynamic headers; 24 | 25 | 26 | - (NSMutableSet*)headersSet { 27 | [self willAccessValueForKey:@"headers"]; 28 | NSMutableSet *result = [self mutableSetValueForKey:@"headers"]; 29 | [self didAccessValueForKey:@"headers"]; 30 | return result; 31 | } 32 | 33 | 34 | 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOSection32MO.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOSection32MO.h instead. 3 | 4 | #import 5 | #import "MachOSectionMO.h" 6 | 7 | 8 | @interface MachOSection32MOID : NSManagedObjectID {} 9 | @end 10 | 11 | @interface _MachOSection32MO : MachOSectionMO {} 12 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_; 13 | - (MachOSection32MOID*)objectID; 14 | 15 | 16 | 17 | 18 | @end 19 | 20 | @interface _MachOSection32MO (CoreDataGeneratedAccessors) 21 | 22 | @end 23 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOSection32MO.m: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOSection32MO.m instead. 3 | 4 | #import "_MachOSection32MO.h" 5 | 6 | @implementation MachOSection32MOID 7 | @end 8 | 9 | @implementation _MachOSection32MO 10 | 11 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_ { 12 | NSParameterAssert(moc_); 13 | return [NSEntityDescription insertNewObjectForEntityForName:@"MachOSection32" inManagedObjectContext:moc_]; 14 | } 15 | 16 | - (MachOSection32MOID*)objectID { 17 | return (MachOSection32MOID*)[super objectID]; 18 | } 19 | 20 | 21 | 22 | 23 | 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOSection64MO.h: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOSection64MO.h instead. 3 | 4 | #import 5 | #import "MachOSectionMO.h" 6 | 7 | 8 | @interface MachOSection64MOID : NSManagedObjectID {} 9 | @end 10 | 11 | @interface _MachOSection64MO : MachOSectionMO {} 12 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_; 13 | - (MachOSection64MOID*)objectID; 14 | 15 | 16 | 17 | @property (nonatomic, retain) NSNumber *reserved3; 18 | 19 | @property int reserved3Value; 20 | - (int)reserved3Value; 21 | - (void)setReserved3Value:(int)value_; 22 | 23 | //- (BOOL)validateReserved3:(id*)value_ error:(NSError**)error_; 24 | 25 | 26 | 27 | 28 | @end 29 | 30 | @interface _MachOSection64MO (CoreDataGeneratedAccessors) 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /MagicHat_DataModel/_MachOSection64MO.m: -------------------------------------------------------------------------------- 1 | // DO NOT EDIT. This file is machine-generated and constantly overwritten. 2 | // Make changes to MachOSection64MO.m instead. 3 | 4 | #import "_MachOSection64MO.h" 5 | 6 | @implementation MachOSection64MOID 7 | @end 8 | 9 | @implementation _MachOSection64MO 10 | 11 | + (id)insertInManagedObjectContext:(NSManagedObjectContext*)moc_ { 12 | NSParameterAssert(moc_); 13 | return [NSEntityDescription insertNewObjectForEntityForName:@"MachOSection64" inManagedObjectContext:moc_]; 14 | } 15 | 16 | - (MachOSection64MOID*)objectID { 17 | return (MachOSection64MOID*)[super objectID]; 18 | } 19 | 20 | 21 | 22 | 23 | @dynamic reserved3; 24 | 25 | 26 | 27 | - (int)reserved3Value { 28 | NSNumber *result = [self reserved3]; 29 | return result ? [result intValue] : 0; 30 | } 31 | 32 | - (void)setReserved3Value:(int)value_ { 33 | [self setReserved3:[NSNumber numberWithInt:value_]]; 34 | } 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /NSString+jr_stringWithUTF8StringmaxLength.h: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+jr_stringWithUTF8StringmaxLength.h 3 | // MagicHat 4 | // 5 | // Created by wolf on 12/28/09. 6 | // Copyright 2009 Red Shed Software Company. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface NSString (jr_stringWithUTF8StringmaxLength) 12 | 13 | + (id)jr_stringWithUTF8String:(const char*)bytes maxLength:(NSUInteger)length; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /NSString+jr_stringWithUTF8StringmaxLength.m: -------------------------------------------------------------------------------- 1 | // 2 | // NSString+jr_stringWithUTF8StringmaxLength.m 3 | // MagicHat 4 | // 5 | // Created by wolf on 12/28/09. 6 | // Copyright 2009 Red Shed Software Company. All rights reserved. 7 | // 8 | 9 | #ifndef CFAutorelease(cf) 10 | #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4 11 | #define CFAutorelease(cf) [NSMakeCollectable(cf) autorelease] 12 | #else 13 | #define CFAutorelease(cf) [(id)cf autorelease] 14 | #endif 15 | #endif 16 | 17 | #import "NSString+jr_stringWithUTF8StringmaxLength.h" 18 | 19 | @implementation NSString (jr_stringWithUTF8StringmaxLength) 20 | 21 | + (id)jr_stringWithUTF8String:(const char*)bytes maxLength:(NSUInteger)maxLength { 22 | NSParameterAssert(bytes); 23 | 24 | NSUInteger scannedLength = 0; 25 | for (; scannedLength < maxLength; scannedLength++) { 26 | if (0 == bytes[scannedLength]) { 27 | break; 28 | } 29 | } 30 | 31 | return CFAutorelease(CFStringCreateWithBytes(kCFAllocatorDefault, (const UInt8*)bytes, scannedLength, kCFStringEncodingUTF8, false)); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Tests/NSString+jr_stringWithUTF8StringmaxLengthTest.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface NSString_jr_stringWithUTF8StringmaxLengthTest : SenTestCase { 4 | 5 | } 6 | 7 | @end 8 | -------------------------------------------------------------------------------- /Tests/NSString+jr_stringWithUTF8StringmaxLengthTest.m: -------------------------------------------------------------------------------- 1 | #import "NSString+jr_stringWithUTF8StringmaxLengthTest.h" 2 | #import "NSString+jr_stringWithUTF8StringmaxLength.h" 3 | 4 | @implementation NSString_jr_stringWithUTF8StringmaxLengthTest 5 | 6 | - (void)testMaxLength { 7 | char *cstr = "ab"; 8 | NSString *str; 9 | 10 | str = [NSString jr_stringWithUTF8String:cstr maxLength:0]; 11 | STAssertNotNil(str, nil); 12 | STAssertEquals([str length], (NSUInteger)0, nil); 13 | STAssertEqualObjects(str, @"", nil); 14 | 15 | str = [NSString jr_stringWithUTF8String:cstr maxLength:1]; 16 | STAssertNotNil(str, nil); 17 | STAssertEquals([str length], (NSUInteger)1, nil); 18 | STAssertEqualObjects(str, @"a", nil); 19 | 20 | str = [NSString jr_stringWithUTF8String:cstr maxLength:2]; 21 | STAssertNotNil(str, nil); 22 | STAssertEquals([str length], (NSUInteger)2, nil); 23 | STAssertEqualObjects(str, @"ab", nil); 24 | 25 | str = [NSString jr_stringWithUTF8String:cstr maxLength:3]; 26 | STAssertNotNil(str, nil); 27 | STAssertEquals([str length], (NSUInteger)2, nil); 28 | STAssertEqualObjects(str, @"ab", nil); 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /cctools-750/PB.project: -------------------------------------------------------------------------------- 1 | { 2 | DYNAMIC_CODE_GEN = YES; 3 | FILESTABLE = {}; 4 | LANGUAGE = English; 5 | NEXTSTEP_BUILDTOOL = /bin/gnumake; 6 | NEXTSTEP_JAVA_COMPILER = /usr/bin/javac; 7 | NEXTSTEP_OBJCPLUS_COMPILER = /usr/bin/cc; 8 | PDO_UNIX_BUILDTOOL = $NEXT_ROOT/NextDeveloper/bin/make; 9 | PDO_UNIX_JAVA_COMPILER = "$(JDKBINDIR)/javac"; 10 | PDO_UNIX_OBJCPLUS_COMPILER = "$(NEXTDEV_BIN)/gcc"; 11 | PROJECTNAME = cctools; 12 | PROJECTTYPE = Legacy; 13 | PROJECTVERSION = 2.8; 14 | WINDOWS_BUILDTOOL = $NEXT_ROOT/NextDeveloper/Executables/make; 15 | WINDOWS_JAVA_COMPILER = "$(JDKBINDIR)/javac.exe"; 16 | WINDOWS_OBJCPLUS_COMPILER = "$(DEVDIR)/gcc"; 17 | } 18 | -------------------------------------------------------------------------------- /cctools-750/RelNotes/FatFiles.rtf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/cctools-750/RelNotes/FatFiles.rtf -------------------------------------------------------------------------------- /cctools-750/as/app.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | extern FILE *scrub_file; 4 | extern char *scrub_string; 5 | extern char *scrub_last_string; 6 | 7 | extern void do_scrub_begin( 8 | void); 9 | extern int do_scrub_next_char( 10 | FILE *fp); 11 | extern int do_scrub_next_char_from_string(); 12 | 13 | /* 14 | * typedefs and routines to save scrub context so .include can make recursive 15 | * calls to the sanitising routines. 16 | */ 17 | typedef struct scrub_context_data { 18 | FILE *last_scrub_file; 19 | int last_state; 20 | int last_old_state; 21 | char *last_out_string; 22 | char last_out_buf[20]; 23 | int last_add_newlines; 24 | } scrub_context_data; 25 | 26 | extern void save_scrub_context( 27 | scrub_context_data *save_buffer_ptr); 28 | extern void restore_scrub_context( 29 | scrub_context_data *save_buffer_ptr); 30 | -------------------------------------------------------------------------------- /cctools-750/as/arch64_32.h: -------------------------------------------------------------------------------- 1 | #ifndef _STUFF_TARGET_ARCH_H_ 2 | #define _STUFF_TARGET_ARCH_H_ 3 | #include 4 | 5 | #ifdef ARCH64 /* 64-bit architecutres */ 6 | 7 | typedef struct mach_header_64 mach_header_t; 8 | #define MH_MAGIC_VALUE MH_MAGIC_64 9 | #define swap_mach_header_t swap_mach_header_64 10 | typedef struct segment_command_64 segment_command_t; 11 | #define LC_SEGMENT_VALUE LC_SEGMENT_64 12 | #define swap_segment_command_t swap_segment_command_64 13 | typedef struct section_64 section_t; 14 | #define swap_section_t swap_section_64 15 | typedef struct nlist_64 nlist_t; 16 | #define swap_nlist_t swap_nlist_64 17 | 18 | typedef int64_t signed_target_addr_t; 19 | #define TA_DFMT "%llu" 20 | 21 | #else /* 32-bit architecutres */ 22 | 23 | typedef struct mach_header mach_header_t; 24 | #define MH_MAGIC_VALUE MH_MAGIC 25 | #define swap_mach_header_t swap_mach_header 26 | typedef struct segment_command segment_command_t; 27 | #define LC_SEGMENT_VALUE LC_SEGMENT 28 | #define swap_segment_command_t swap_segment_command 29 | typedef struct section section_t; 30 | #define swap_section_t swap_section 31 | typedef struct nlist nlist_t; 32 | #define swap_nlist_t swap_nlist 33 | 34 | typedef int32_t signed_target_addr_t; 35 | #define TA_DFMT "%u" 36 | 37 | #endif 38 | 39 | #endif /* _STUFF_TARGET_ARCH_H_ */ 40 | -------------------------------------------------------------------------------- /cctools-750/as/atof-ieee.h: -------------------------------------------------------------------------------- 1 | #import "flonum.h" 2 | 3 | extern char *atof_ieee( 4 | char *str, 5 | char what_kind, 6 | LITTLENUM_TYPE *words); 7 | 8 | extern int gen_to_words( 9 | LITTLENUM_TYPE *words, 10 | int precision, 11 | int exponent_bits); 12 | 13 | extern void int_to_gen( 14 | int x); 15 | -------------------------------------------------------------------------------- /cctools-750/as/cctools.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | OpenSourceImportDate 7 | 1988-01-01 8 | OpenSourceLicense 9 | GPL 10 | OpenSourceLicenseFile 11 | cctools.txt 12 | OpenSourceProject 13 | gas 14 | OpenSourceWebsiteURL 15 | http://www.gnu.org/home.html 16 | OpenSourceVersion 17 | 1.38.1 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /cctools-750/as/hex_value.h: -------------------------------------------------------------------------------- 1 | extern char hex_value[]; 2 | -------------------------------------------------------------------------------- /cctools-750/as/input-scrub.h: -------------------------------------------------------------------------------- 1 | extern int doing_include; 2 | 3 | extern char *physical_input_file; 4 | extern char *logical_input_file; 5 | extern char *layout_file; 6 | 7 | /* 1-origin line number in a source file. */ 8 | typedef unsigned int line_numberT; 9 | 10 | extern line_numberT physical_input_line; 11 | extern line_numberT logical_input_line; 12 | extern line_numberT layout_line; 13 | /* 14 | * Supplies sanitised buffers to read.c. 15 | * Also understands printing line-number part of error messages. 16 | */ 17 | 18 | /* Line number things. */ 19 | extern int seen_at_least_1_file( 20 | void); 21 | extern void bump_line_counters( 22 | void); 23 | extern void new_logical_line( 24 | char *fname, 25 | int line_number); 26 | extern void as_where( 27 | void); 28 | extern void as_file_and_line( 29 | char **file_ret, 30 | unsigned int *line_ret); 31 | extern void as_where_ProjectBuilder( 32 | char **fileName, 33 | char **directory, 34 | int *line); 35 | extern void as_perror( 36 | char *gripe, 37 | char *filename); 38 | 39 | /* Sanitising things. */ 40 | extern void input_scrub_begin( 41 | void); 42 | extern void input_scrub_end( 43 | void); 44 | extern char *input_scrub_new_file( 45 | char *filename); 46 | extern char *input_scrub_next_buffer( 47 | char **bufp); 48 | extern void read_an_include_file( 49 | char *no_path_name); 50 | -------------------------------------------------------------------------------- /cctools-750/as/layout.h: -------------------------------------------------------------------------------- 1 | extern void add_last_frags_to_sections( 2 | void); 3 | extern void layout_addresses( 4 | void); 5 | -------------------------------------------------------------------------------- /cctools-750/as/messages.h: -------------------------------------------------------------------------------- 1 | #ifndef MESSAGES_H_ 2 | #define MESSAGES_H_ 3 | 4 | #include "as.h" 5 | #include "expr.h" 6 | #include "struc-symbol.h" 7 | 8 | extern int bad_error; 9 | extern int arch_multiple; 10 | 11 | extern void as_warn( 12 | const char *format, 13 | ...) __attribute__ ((format (printf, 1, 2))); 14 | 15 | extern void as_warn_where( 16 | char *file, 17 | unsigned int line, 18 | const char *format, 19 | ...) __attribute__ ((format (printf, 3, 4))); 20 | 21 | extern void as_warn_where_with_column( 22 | char *file, 23 | unsigned int line, 24 | unsigned int column, 25 | const char *format, 26 | ...) __attribute__ ((format (printf, 4, 5))); 27 | 28 | extern void as_bad( 29 | const char *format, 30 | ...) __attribute__ ((format (printf, 1, 2))); 31 | 32 | extern void as_fatal( 33 | const char *format, 34 | ...) __attribute__ ((format (printf, 1, 2))); 35 | 36 | extern void sprint_value( 37 | char *, signed_expr_t); 38 | 39 | #endif /* MESSAGES_H_ */ 40 | -------------------------------------------------------------------------------- /cctools-750/as/write_object.h: -------------------------------------------------------------------------------- 1 | extern void write_object( 2 | char *out_file_name); 3 | 4 | /* FROM line 196 */ 5 | extern void number_to_chars_littleendian (char *, signed_expr_t, int); 6 | extern void number_to_chars_bigendian (char *, signed_expr_t, int); 7 | -------------------------------------------------------------------------------- /cctools-750/as/xmalloc.c: -------------------------------------------------------------------------------- 1 | /* xmalloc.c - get memory or bust 2 | Copyright (C) 1987 Free Software Foundation, Inc. 3 | 4 | This file is part of GAS, the GNU Assembler. 5 | 6 | GAS is free software; you can redistribute it and/or modify 7 | it under the terms of the GNU General Public License as published by 8 | the Free Software Foundation; either version 1, or (at your option) 9 | any later version. 10 | 11 | GAS is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU General Public License for more details. 15 | 16 | You should have received a copy of the GNU General Public License 17 | along with GAS; see the file COPYING. If not, write to 18 | the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ 19 | 20 | #include 21 | #include "xmalloc.h" 22 | #include "messages.h" 23 | 24 | void * 25 | xmalloc( 26 | size_t n) 27 | { 28 | void *retval; 29 | 30 | if(!(retval = malloc((unsigned)n))){ 31 | as_fatal("virtual memory exceeded"); 32 | } 33 | return(retval); 34 | } 35 | 36 | void * 37 | xrealloc( 38 | void *ptr, 39 | size_t n) 40 | { 41 | if((ptr = realloc(ptr, (unsigned)n)) == 0) 42 | as_fatal("virtual memory exceeded"); 43 | return(ptr); 44 | } 45 | -------------------------------------------------------------------------------- /cctools-750/as/xmalloc.h: -------------------------------------------------------------------------------- 1 | extern void * xmalloc( 2 | size_t n); 3 | extern void *xrealloc( 4 | void *ptr, 5 | size_t n); 6 | #define xfree free 7 | -------------------------------------------------------------------------------- /cctools-750/gprof/gprof.flat: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | flat profile: 5 | 6 | % the percentage of the total running time of the 7 | time program used by this function. 8 | 9 | cumulative a running sum of the number of seconds accounted 10 | seconds for by this function and those listed above it. 11 | 12 | self the number of seconds accounted for by this 13 | seconds function alone. This is the major sort for this 14 | listing. 15 | 16 | calls the number of times this function was invoked, if 17 | this function is profiled, else blank. 18 | 19 | self the average number of milliseconds spent in this 20 | ms/call function per call, if this function is profiled, 21 | else blank. 22 | 23 | total the average number of milliseconds spent in this 24 | ms/call function and its descendents per call, if this 25 | function is profiled, else blank. 26 | 27 | name the name of the function. This is the minor sort 28 | for this listing. The index shows the location of 29 | the function in the gprof listing. If the index is 30 | in parenthesis it shows where it would appear in 31 | the gprof listing if it were to be printed. 32 | 33 | -------------------------------------------------------------------------------- /cctools-750/include/coff/bytesex.h: -------------------------------------------------------------------------------- 1 | #ifndef _COFF_BYTESEX_H 2 | #define _COFF_BYTESEX_H 3 | 4 | #include "stuff/bytesex.h" 5 | #include "coff/base_relocs.h" 6 | #include "coff/ms_dos_stub.h" 7 | #include "coff/filehdr.h" 8 | #include "coff/aouthdr.h" 9 | #include "coff/scnhdr.h" 10 | #include "coff/syment.h" 11 | #include "coff/debug_directory.h" 12 | 13 | __private_extern__ void swap_base_relocation_block_header( 14 | struct base_relocation_block_header *h, 15 | enum byte_sex target_byte_sex); 16 | 17 | __private_extern__ void swap_base_relocation_entry( 18 | struct base_relocation_entry *b, 19 | uint32_t n, 20 | enum byte_sex target_byte_sex); 21 | 22 | __private_extern__ void swap_ms_dos_stub( 23 | struct ms_dos_stub *m, 24 | enum byte_sex target_byte_sex); 25 | 26 | __private_extern__ void swap_filehdr( 27 | struct filehdr *f, 28 | enum byte_sex target_byte_sex); 29 | 30 | __private_extern__ void swap_aouthdr( 31 | struct aouthdr *a, 32 | enum byte_sex target_byte_sex); 33 | 34 | __private_extern__ void swap_aouthdr_64( 35 | struct aouthdr_64 *a, 36 | enum byte_sex target_byte_sex); 37 | 38 | __private_extern__ void swap_scnhdr( 39 | struct scnhdr *s, 40 | uint32_t n, 41 | enum byte_sex target_byte_sex); 42 | 43 | __private_extern__ void swap_syment( 44 | struct syment *s, 45 | uint32_t n, 46 | enum byte_sex target_byte_sex); 47 | 48 | __private_extern__ void swap_debug_directory_entry( 49 | struct debug_directory_entry *d, 50 | enum byte_sex target_byte_sex); 51 | 52 | __private_extern__ void swap_mtoc_debug_info( 53 | struct mtoc_debug_info *m, 54 | enum byte_sex target_byte_sex); 55 | 56 | #endif /* _COFF_BYTESEX_H */ 57 | -------------------------------------------------------------------------------- /cctools-750/include/mach-o/hppa/swap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #import 24 | #import 25 | 26 | extern void swap_hppa_integer_thread_state( 27 | struct hp_pa_integer_thread_state *regs, 28 | enum NXByteOrder target_byte_order); 29 | 30 | extern void swap_hppa_frame_thread_state( 31 | struct hp_pa_frame_thread_state *frame, 32 | enum NXByteOrder target_byte_order); 33 | 34 | extern void swap_hppa_fp_thread_state( 35 | struct hp_pa_fp_thread_state *fp, 36 | enum NXByteOrder target_byte_order); 37 | -------------------------------------------------------------------------------- /cctools-750/include/mach-o/i860/swap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #import 24 | #import 25 | 26 | extern void swap_i860_thread_state_regs( 27 | struct i860_thread_state_regs *cpu, 28 | enum NXByteOrder target_byte_sex); 29 | -------------------------------------------------------------------------------- /cctools-750/include/mach-o/m68k/swap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #import 24 | #import 25 | 26 | extern void swap_m68k_thread_state_regs( 27 | struct m68k_thread_state_regs *cpu, 28 | enum NXByteOrder target_byte_order); 29 | 30 | extern void swap_m68k_thread_state_68882( 31 | struct m68k_thread_state_68882 *fpu, 32 | enum NXByteOrder target_byte_order); 33 | 34 | extern void swap_m68k_thread_state_user_reg( 35 | struct m68k_thread_state_user_reg *user_reg, 36 | enum NXByteOrder target_byte_order); 37 | -------------------------------------------------------------------------------- /cctools-750/include/mach-o/m88k/swap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #import 24 | #import 25 | 26 | extern void swap_m88k_thread_state_grf_t( 27 | m88k_thread_state_grf_t *cpu, 28 | enum NXByteOrder target_byte_sex); 29 | 30 | extern void swap_m88k_thread_state_xrf_t( 31 | m88k_thread_state_xrf_t *fpu, 32 | enum NXByteOrder target_byte_sex); 33 | 34 | extern void swap_m88k_thread_state_user_t( 35 | m88k_thread_state_user_t *user, 36 | enum NXByteOrder target_byte_sex); 37 | 38 | 39 | extern void swap_m88110_thread_state_impl_t( 40 | m88110_thread_state_impl_t *spu, 41 | enum NXByteOrder target_byte_sex); 42 | -------------------------------------------------------------------------------- /cctools-750/include/mach-o/ppc/swap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #include 24 | #include 25 | 26 | extern void swap_ppc_thread_state_t( 27 | ppc_thread_state_t *cpu, 28 | enum NXByteOrder target_byte_sex); 29 | 30 | extern void swap_ppc_float_state_t( 31 | ppc_float_state_t *fpu, 32 | enum NXByteOrder target_byte_sex); 33 | 34 | extern void swap_ppc_exception_state_t( 35 | ppc_exception_state_t *state, 36 | enum NXByteOrder target_byte_sex); 37 | -------------------------------------------------------------------------------- /cctools-750/include/mach-o/sparc/swap.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #import 24 | #import 25 | 26 | void swap_sparc_thread_state_regs( 27 | struct sparc_thread_state_regs *cpu, 28 | enum NXByteOrder target_byte_sex); 29 | 30 | void swap_sparc_thread_state_fpu( 31 | struct sparc_thread_state_fpu *fpu, 32 | enum NXByteOrder target_byte_sex); 33 | -------------------------------------------------------------------------------- /cctools-750/include/mach/arm/thread_status.h: -------------------------------------------------------------------------------- 1 | #ifndef _ARM_THREAD_STATUS_H_ 2 | #define _ARM_THREAD_STATUS_H_ 3 | 4 | #define ARM_THREAD_STATE 1 5 | 6 | typedef struct arm_thread_state { 7 | unsigned int r0; 8 | unsigned int r1; 9 | unsigned int r2; 10 | unsigned int r3; 11 | unsigned int r4; 12 | unsigned int r5; 13 | unsigned int r6; 14 | unsigned int r7; 15 | unsigned int r8; 16 | unsigned int r9; 17 | unsigned int r10; 18 | unsigned int r11; 19 | unsigned int r12; 20 | unsigned int r13; 21 | unsigned int r14; 22 | unsigned int r15; 23 | unsigned int r16; 24 | } arm_thread_state_t; 25 | 26 | #define ARM_THREAD_STATE_COUNT \ 27 | (sizeof(struct arm_thread_state) / sizeof(int)) 28 | 29 | #endif /* _ARM_THREAD_STATUS_H_ */ 30 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/SymLoc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #include "bool.h" 24 | 25 | extern const char * symLocForDylib( 26 | const char *installName, 27 | const char *releaseName, 28 | enum bool *found_project, 29 | enum bool disablewarnings, 30 | enum bool no_error_if_missing); 31 | 32 | extern const char * dstLocForDylib( 33 | const char *installName, 34 | const char *releaseName, 35 | enum bool *found_project, 36 | enum bool disablewarnings, 37 | enum bool no_error_if_missing); 38 | 39 | const char * LocForDylib( 40 | const char *installName, 41 | const char *releaseName, 42 | const char *dirname, 43 | enum bool *found_project, 44 | enum bool disablewarnings, 45 | enum bool no_error_if_missing); 46 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/allocate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | /* defined in allocate.c */ 28 | 29 | __private_extern__ void *allocate( 30 | size_t size); 31 | 32 | __private_extern__ void *reallocate( 33 | void *, 34 | size_t size); 35 | 36 | __private_extern__ char *savestr( 37 | const char *s); 38 | 39 | __private_extern__ char *makestr( 40 | const char *args, ...); 41 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/crc32.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | __private_extern__ uint32_t crc32( 24 | const void *buf, 25 | uint32_t len); 26 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/dylib_roots.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | extern char * get_symfile_for_dylib( 24 | char *install_name, 25 | char *release_name, 26 | enum bool *found_project, 27 | enum bool disablewarnings, 28 | enum bool no_error_if_missing); 29 | 30 | extern char * get_dstfile_for_dylib( 31 | char *install_name, 32 | char *release_name, 33 | enum bool *found_project, 34 | enum bool disablewarnings, 35 | enum bool no_error_if_missing); 36 | 37 | extern char * find_dylib_in_root( 38 | char *install_name, 39 | const char *root); 40 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/dylib_table.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | /* 24 | * The table of known dynamic library names and addresses they are linked at. 25 | * This is loaded from a -dylib_table option or from the default file: 26 | * ~rc/Data/DylibTable . 27 | */ 28 | struct dylib_table { 29 | uint32_t seg1addr; 30 | char *name; 31 | }; 32 | 33 | extern struct dylib_table * parse_dylib_table( 34 | char *file_name, 35 | char *flag, 36 | char *argument); 37 | 38 | extern struct dylib_table * parse_default_dylib_table( 39 | char **file_name); 40 | 41 | extern struct dylib_table *search_dylib_table( 42 | struct dylib_table *dylib_table, 43 | char *name); 44 | 45 | extern char * guess_dylib_install_name( 46 | char *name); 47 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/execute.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | /* 28 | * execute() does an execvp using the argv passed to it. If the parameter 29 | * verbose is non-zero the command is printed to stderr. A non-zero return 30 | * value indicates success zero indicates failure. 31 | */ 32 | __private_extern__ int execute( 33 | char **argv, 34 | int verbose); 35 | 36 | __private_extern__ void add_execute_list( 37 | char *str); 38 | 39 | __private_extern__ void reset_execute_list( 40 | void); 41 | 42 | __private_extern__ int execute_list( 43 | int verbose); 44 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/guess_short_name.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #include "stuff/bool.h" 24 | 25 | __private_extern__ char * guess_short_name( 26 | char *name, 27 | enum bool *is_framework, 28 | char **return_suffix); 29 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/hash_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | __private_extern__ int32_t hash_string( 28 | char *key); 29 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/lto.h: -------------------------------------------------------------------------------- 1 | #ifndef _STUFF_LTO_H_ 2 | #define _STUFF_LTO_H_ 3 | 4 | #ifdef LTO_SUPPORT 5 | 6 | #include "stuff/ofile.h" 7 | 8 | __private_extern__ int is_llvm_bitcode( 9 | struct ofile *ofile, 10 | char *addr, 11 | size_t size); 12 | 13 | __private_extern__ uint32_t lto_get_nsyms( 14 | void *mod); 15 | 16 | __private_extern__ int lto_toc_symbol( 17 | void *mod, 18 | uint32_t symbol_index, 19 | int commons_in_toc); 20 | 21 | __private_extern__ void lto_get_nlist_64( 22 | struct nlist_64 *nl, 23 | void *mod, 24 | uint32_t symbol_index); 25 | 26 | __private_extern__ char * lto_symbol_name( 27 | void *mod, 28 | uint32_t symbol_index); 29 | 30 | __private_extern__ void lto_free( 31 | void *mod); 32 | 33 | #endif /* LTO_SUPPORT */ 34 | 35 | #endif /* _STUFF_LTO_H_ */ 36 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/macosx_deployment_target.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #include 24 | 25 | struct macosx_deployment_target { 26 | uint32_t major; /* major version */ 27 | uint32_t minor; /* minor version (if any or zero) */ 28 | char *name; /* name for printing */ 29 | }; 30 | 31 | __private_extern__ void get_macosx_deployment_target( 32 | struct macosx_deployment_target *value); 33 | 34 | __private_extern__ void put_macosx_deployment_target( 35 | char *target); 36 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/print.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | #import 28 | 29 | __private_extern__ void print( 30 | const char *format, ...) 31 | #ifdef __GNUC__ 32 | __attribute__ ((format (printf, 1, 2))) 33 | #endif 34 | ; 35 | __private_extern__ void vprint( 36 | const char *format, va_list ap); 37 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | #import 28 | #import "stuff/bool.h" 29 | 30 | __private_extern__ uint32_t reloc_pair_r_type( 31 | cpu_type_t cputype); 32 | __private_extern__ enum bool reloc_has_pair( 33 | cpu_type_t cputype, 34 | uint32_t r_type); 35 | __private_extern__ enum bool reloc_is_sectdiff( 36 | cpu_type_t cputype, 37 | uint32_t r_type); 38 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/symbol.h: -------------------------------------------------------------------------------- 1 | #ifndef _STUFF_SYMBOL_H_ 2 | #define _STUFF_SYMBOL_H_ 3 | 4 | #include 5 | 6 | struct symbol { 7 | char *name; 8 | char *indr_name; 9 | uint64_t n_value; 10 | int is_thumb; 11 | }; 12 | 13 | #endif /* _STUFF_SYMBOL_H_ */ 14 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/symbol_list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2003 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #include 24 | #include 25 | 26 | /* 27 | * Data structures to perform selective stripping of symbol table entries. 28 | */ 29 | struct symbol_list { 30 | char *name; /* name of the global symbol */ 31 | void *sym; /* pointer to the nlist structure for this symbol */ 32 | enum bool seen; /* set if the symbol is seen in the input file */ 33 | }; 34 | 35 | __private_extern__ void setup_symbol_list( 36 | char *file, 37 | struct symbol_list **list, 38 | uint32_t *size); 39 | 40 | __private_extern__ int symbol_list_bsearch( 41 | const char *name, 42 | const struct symbol_list *sym); 43 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/unix_standard_mode.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #include "stuff/bool.h" 24 | 25 | __private_extern__ enum bool get_unix_standard_mode( 26 | void); 27 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/version_number.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | __private_extern__ enum bool get_version_number( 24 | char *flag, 25 | char *argument, 26 | uint32_t *value); 27 | -------------------------------------------------------------------------------- /cctools-750/include/stuff/vm_flush_cache.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | #import 28 | __private_extern__ kern_return_t vm_flush_cache( 29 | mach_port_t target_task, 30 | vm_address_t address, 31 | vm_size_t size); 32 | -------------------------------------------------------------------------------- /cctools-750/ld/arm_reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | /* 28 | * Global types, variables and routines declared in the file arm_reloc.c. 29 | * 30 | * The following include file need to be included before this file: 31 | * #include 32 | * #include "section.h" 33 | */ 34 | __private_extern__ void arm_reloc( 35 | char *contents, 36 | struct relocation_info *relocs, 37 | struct section_map *section_map, 38 | struct live_refs *refs, 39 | unsigned long reloc_index); 40 | -------------------------------------------------------------------------------- /cctools-750/ld/coalesced_sections.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | __private_extern__ void coalesced_section_merge( 28 | void *data, 29 | struct merged_section *ms, 30 | struct section *s, 31 | struct section_map *section_map, 32 | enum bool redo_live); 33 | 34 | __private_extern__ void coalesced_section_order( 35 | void *data, 36 | struct merged_section *ms); 37 | 38 | __private_extern__ void coalesced_section_reset_live( 39 | void *data, 40 | struct merged_section *ms); 41 | -------------------------------------------------------------------------------- /cctools-750/ld/hash_string.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | /* 24 | * hash_string() compute a hash code for the specified null terminated string. 25 | * The caller can then mod it with the size of the hash table. 26 | */ 27 | static 28 | inline 29 | unsigned long 30 | hash_string( 31 | char *key, 32 | unsigned long *len) 33 | { 34 | char *cp; 35 | long k; 36 | 37 | cp = key; 38 | k = 0; 39 | while(*cp) 40 | k = (((k << 1) + (k >> 14)) ^ (*cp++)) & 0x3fff; 41 | if(len != NULL) 42 | *len = cp - key; 43 | return(k); 44 | } 45 | -------------------------------------------------------------------------------- /cctools-750/ld/hppa_reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | /* 28 | * Global types, variables and routines declared in the file hppa_reloc.c. 29 | * 30 | * The following include file need to be included before this file: 31 | * #include 32 | * #include "section.h" 33 | */ 34 | __private_extern__ void hppa_reloc( 35 | char *contents, 36 | struct relocation_info *relocs, 37 | struct section_map *map); 38 | -------------------------------------------------------------------------------- /cctools-750/ld/i860_reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | /* 28 | * Global types, variables and routines declared in the file i860_reloc.c. 29 | * 30 | * The following include file need to be included before this file: 31 | * #include 32 | * #include "section.h" 33 | */ 34 | __private_extern__ void i860_reloc( 35 | char *contents, 36 | struct relocation_info *relocs, 37 | struct section_map *map); 38 | -------------------------------------------------------------------------------- /cctools-750/ld/librld.ofileList: -------------------------------------------------------------------------------- 1 | librld.o 2 | -------------------------------------------------------------------------------- /cctools-750/ld/m88k_reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | /* 28 | * Global types, variables and routines declared in the file m88k_reloc.c. 29 | * 30 | * The following include file need to be included before this file: 31 | * #include 32 | * #include "section.h" 33 | */ 34 | __private_extern__ void m88k_reloc( 35 | char *contents, 36 | struct relocation_info *relocs, 37 | struct section_map *map); 38 | -------------------------------------------------------------------------------- /cctools-750/ld/ppc_reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | /* 28 | * Global types, variables and routines declared in the file ppc_reloc.c. 29 | * 30 | * The following include file need to be included before this file: 31 | * #include 32 | * #include "section.h" 33 | */ 34 | __private_extern__ void ppc_reloc( 35 | char *contents, 36 | struct relocation_info *relocs, 37 | struct section_map *section_map, 38 | struct live_refs *refs, 39 | unsigned long reloc_index); 40 | -------------------------------------------------------------------------------- /cctools-750/ld/sparc_reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | /* 28 | * Global types, variables and routines declared in the file sparc_reloc.c. 29 | * 30 | * The following include file need to be included before this file: 31 | * #include 32 | * #include "section.h" 33 | */ 34 | __private_extern__ void sparc_reloc( 35 | char *contents, 36 | struct relocation_info *relocs, 37 | struct section_map *map); 38 | 39 | -------------------------------------------------------------------------------- /cctools-750/ld/uuid.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #if defined(__MWERKS__) && !defined(__private_extern__) 24 | #define __private_extern__ __declspec(private_extern) 25 | #endif 26 | 27 | #include 28 | #include 29 | #if !(defined(KLD) && defined(__STATIC__)) 30 | #include 31 | #else 32 | #include 33 | #endif /* !(defined(KLD) && defined(__STATIC__)) */ 34 | 35 | /* 36 | * uuid() is called to set the uuid[] bytes for the uuid load command. 37 | */ 38 | __private_extern__ 39 | void 40 | uuid( 41 | uint8_t *uuid) 42 | { 43 | #if defined(KLD) && defined(__STATIC__) 44 | memset(uuid, '\0', sizeof(struct uuid_command)); 45 | #else 46 | uuid_generate_random((void *)uuid); 47 | #endif 48 | } 49 | -------------------------------------------------------------------------------- /cctools-750/ld/uuid.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* 25 | * uuid() is called to set the uuid[] bytes for the uuid load command. 26 | */ 27 | __private_extern__ void uuid( 28 | uint8_t *uuid); 29 | -------------------------------------------------------------------------------- /cctools-750/libmacho/dylib.ofileList: -------------------------------------------------------------------------------- 1 | arch.o 2 | getsecbyname.o 3 | getsegbyname.o 4 | get_end.o 5 | swap.o 6 | i386_swap.o 7 | m68k_swap.o 8 | sparc_swap.o 9 | ppc_swap.o 10 | -------------------------------------------------------------------------------- /cctools-750/libmacho/shlib.ofileList: -------------------------------------------------------------------------------- 1 | arch.o 2 | getmachhead.o 3 | getsecbyname.o 4 | getsegbyname.o 5 | get_end.o 6 | swap.o 7 | -------------------------------------------------------------------------------- /cctools-750/libstuff/arch_usage.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #ifndef RLD 24 | #include /* first to get rid of pre-comp warning */ 25 | #include 26 | #include "stuff/arch.h" 27 | #include "stuff/errors.h" 28 | 29 | /* 30 | * arch_usage() is called when an unknown architecture flag is encountered. 31 | * It prints the currently know architecture flags on stderr. 32 | */ 33 | __private_extern__ 34 | void 35 | arch_usage(void) 36 | { 37 | unsigned long i; 38 | const struct arch_flag *arch_flags; 39 | 40 | arch_flags = get_arch_flags(); 41 | fprintf(stderr, "%s: known architecture flags are:", progname); 42 | for(i = 0; arch_flags[i].name != NULL; i++){ 43 | fprintf(stderr, " %s", arch_flags[i].name); 44 | } 45 | fprintf(stderr, "\n"); 46 | } 47 | #endif /* !defined(RLD) */ 48 | -------------------------------------------------------------------------------- /cctools-750/libstuff/hash_string.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #include 24 | #include "stuff/hash_string.h" 25 | /* 26 | * A hash function used for converting a string into a single number. It is 27 | * then usually mod'ed with the hash table size to get an index into the hash 28 | * table. 29 | */ 30 | __private_extern__ 31 | int32_t 32 | hash_string( 33 | char *key) 34 | { 35 | char *cp; 36 | int32_t k; 37 | 38 | cp = key; 39 | k = 0; 40 | while(*cp) 41 | k = (((k << 1) + (k >> 14)) ^ (*cp++)) & 0x3fff; 42 | return(k); 43 | } 44 | -------------------------------------------------------------------------------- /cctools-750/libstuff/print.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #ifndef RLD 24 | #include 25 | #include 26 | #include "stuff/print.h" 27 | 28 | /* 29 | * All printing of all messages for ofile functions goes through this function. 30 | * It is broken out here so it can be overridden for some uses. 31 | */ 32 | __private_extern__ 33 | void 34 | vprint( 35 | const char *format, 36 | va_list ap) 37 | { 38 | vfprintf(stderr, format, ap); 39 | } 40 | 41 | /* 42 | * The print function that just calls the above vprint() function. 43 | */ 44 | __private_extern__ 45 | void 46 | print( 47 | const char *format, 48 | ...) 49 | { 50 | va_list ap; 51 | 52 | va_start(ap, format); 53 | vprint(format, ap); 54 | va_end(ap); 55 | } 56 | #endif /* !defined(RLD) */ 57 | -------------------------------------------------------------------------------- /cctools-750/man/NSObjectFileImage_priv.3: -------------------------------------------------------------------------------- 1 | .TH NSObjectFileImage 3 "July 9, 2003" "Apple Computer, Inc." 2 | .SH NAME 3 | NSObjectFileImage_priv \- programmatic interface for working with Mach-O files 4 | .SH SYNOPSIS 5 | .nf 6 | .PP 7 | #include 8 | .sp .5 9 | extern enum DYLD_BOOL 10 | NSFindSectionAndOffsetInObjectFileImage( 11 | NSObjectFileImage objectFileImage, 12 | unsigned long imageOffset, 13 | const char** segmentName, /* can be NULL */ 14 | const char** sectionName, /* can be NULL */ 15 | unsigned long* sectionOffset) /* can be NULL */ 16 | .sp .5 17 | extern enum DYLD_BOOL 18 | NSHasModInitObjectFileImage( 19 | NSObjectFileImage objectFileImage); 20 | .fi 21 | .SH DESCRIPTION 22 | .PP 23 | These routines are the programmatic interface for working with Mach-O files. 24 | They bring the Mach-O file into memory and the API allows the file to 25 | be inspected or loaded into the program. On creation of an object file image 26 | it is checked to insure it is a valid format and it is compatible with the host 27 | machine's cpu architecture. 28 | .PP 29 | .PP 30 | .I NSFindSectionAndOffsetInObjectFileImage 31 | is supplied an imageOffset into an ObjectFileImage and returns 32 | via parameters the segment/section name and offset into that section of 33 | that imageOffset. It returns FALSE if the imageOffset is not 34 | in any section, otherwise TRUE. You can used the resulting sectionOffset to 35 | index into the data returned by NSGetSectionDataInObjectFileImage. 36 | .PP 37 | .I NSHasModInitObjectFileImage 38 | returns TRUE if the NSObjectFileImage has any module initialization routines 39 | and FALSE otherwise. 40 | 41 | .SH ALSO SEE 42 | NSObjectFileImage(3), NSModule(3), dyld(3) 43 | -------------------------------------------------------------------------------- /cctools-750/man/a.out.5: -------------------------------------------------------------------------------- 1 | .so man5/Mach-O.5 2 | -------------------------------------------------------------------------------- /cctools-750/man/check_dylib.1: -------------------------------------------------------------------------------- 1 | .TH CHECK_DYLIB l "September 10, 2001" "Apple Computer, Inc." 2 | .SH NAME 3 | check_dylib \- perform checks on a dynamic library file 4 | .SH SYNOPSIS 5 | .B check_dylib 6 | filename \-install_name 7 | .I install_name 8 | \-seg_addr_table 9 | .I seg_addr_table 10 | \-seg_addr_table_filename 11 | .I path_name 12 | .sp .5 13 | .SH DESCRIPTION 14 | .I Check_dylib 15 | is a tool used by Apple's Build and Integration team to perform checks on a 16 | Mach-O dynamic library as part of the build process. The checks are performed 17 | and 18 | .IR check_dylib (l) 19 | returns the status of the checks as exit values. 20 | .PP 21 | The checks are performed in the following order: 22 | .PP 23 | If the install name of the dynamic library does not start with @executable_path 24 | check the install name of the dynamic library file against the specified 25 | .B \-install_name 26 | argument and if it does not match it exit with a value of 2. 27 | .PP 28 | Check the segment address table specified by 29 | .B \-seg_addr_table 30 | for an entry with the 31 | .I path_name 32 | argument of the 33 | .B \-seg_addr_table_filename 34 | and if one is not found in the table exit with a value of 3. 35 | .PP 36 | Check the dynamic library file's address against the address in the matching 37 | entry in the segment address table specified by 38 | .B \-seg_addr_table 39 | and 40 | .B \-seg_addr_table_filename 41 | and if it does not match exit with a value of 4. 42 | .PP 43 | Check the address of the dynamic library and if it is zero exit with a value 44 | of 5. 45 | .PP 46 | If there is any other errors 47 | .IR check_dylib (l) 48 | exits with a value of 1. If no checks fail then 49 | .IR check_dylib (l) 50 | exits with a value of 0. 51 | .SH "SEE ALSO" 52 | seg_addr_table(l), doug(0) 53 | -------------------------------------------------------------------------------- /cctools-750/man/codesign_allocate.1: -------------------------------------------------------------------------------- 1 | .TH CODESIGN_ALLOCATE 1 "January 11, 2008" "Apple, Inc." 2 | .SH NAME 3 | codesign_allocate \- add code signing data to a Mach-O file 4 | .SH SYNOPSIS 5 | .B codesign_allocate 6 | \-i oldfile [ \-a arch size ]... [ \-A cputype cpusubtype size ]... \-o newfile 7 | .SH DESCRIPTION 8 | .I codesign_allocate 9 | sets up a Mach-O file used by the dynamic linker so space for code signing data 10 | of the specified size for the specified architecture is embed in the Mach-O 11 | file. The program must be passed one \-a argument or one \-A argument for each 12 | architecture in a universal file, or exactly one \-a or \-A for a thin file. 13 | .TP 14 | .BI \-i " oldfile" 15 | specifies the input file as 16 | .I oldfile. 17 | .TP 18 | .BI \-o " newfile" 19 | specifies the output file as 20 | .I newfile. 21 | .TP 22 | .BI \-a " arch size" 23 | specifies for the architecture 24 | .I arch 25 | that the size of the code signing data is to be 26 | .I size. 27 | The value of 28 | .I size 29 | must be a multiple of 16. 30 | .TP 31 | .BI \-a " cputype cpusubtype size" 32 | specifies for the architecture as a pair of decimal integers for the cputype and 33 | cpusubtype that the size of the code signing data is to be 34 | .I size. 35 | The value of 36 | .I size 37 | must be a multiple of 16. 38 | -------------------------------------------------------------------------------- /cctools-750/man/end.3: -------------------------------------------------------------------------------- 1 | .so man3/get_end.3 2 | -------------------------------------------------------------------------------- /cctools-750/man/getsectbynamefromheader.3: -------------------------------------------------------------------------------- 1 | .so man3/getsectbyname.3 2 | -------------------------------------------------------------------------------- /cctools-750/man/getsectdata.3: -------------------------------------------------------------------------------- 1 | .so man3/getsectbyname.3 2 | -------------------------------------------------------------------------------- /cctools-750/man/getsectdatafromheader.3: -------------------------------------------------------------------------------- 1 | .so man3/getsectbyname.3 2 | -------------------------------------------------------------------------------- /cctools-750/man/getsegbyname.3: -------------------------------------------------------------------------------- 1 | .TH GETSEGBYNAME 3 "October 3, 2008" "Apple, Inc." 2 | .SH NAME 3 | getsegbyname \- get the segment command for the named segment 4 | .SH SYNOPSIS 5 | .nf 6 | \fB#include \fR 7 | .PP 8 | const struct segment_command *\fBgetsegbyname\fR(const char *\fIsegname\fR); 9 | .fi 10 | .SH DESCRIPTION 11 | This routine returns the segment_command structure for the named segment if it 12 | exists in the Mach-O (Mach object) executable 13 | .IR getsegbyname (3) 14 | is linked into. Otherwise 15 | .IR getsegbyname (3) 16 | returns 17 | .SM NULL. 18 | It uses the link editor defined symbol _mh_execute_header and 19 | just looks through the load commands. Since these are mapped into the 20 | .SM \_\|\_TEXT 21 | segment they are read-only and thus 22 | .I const 23 | by default. 24 | If this is to be used in executables linked with 25 | .B \-pie 26 | then the value return by the call to 27 | .IR _dyld_get_image_vmaddr_slide (0) 28 | will need to be added to the 29 | .B vmaddr 30 | field of the segment_command struct. 31 | .SH "SEE ALSO" 32 | end(3), getsectbyname(3) 33 | -------------------------------------------------------------------------------- /cctools-750/man/mtoc.1: -------------------------------------------------------------------------------- 1 | .TH MTOC 1 "September 12, 2008" "Apple, Inc." 2 | .SH NAME 3 | mtoc \- convert a Mach-O file to a PECOFF file 4 | .SH SYNOPSIS 5 | .B mtoc 6 | [ \-subsystem type ] [ \-section_alignment value ] [ \-align value ] [ \-d filename ] input output 7 | .SH DESCRIPTION 8 | .I mtoc 9 | converts the 10 | .I input 11 | EFI file built as a Mach-O file into an 12 | .I output 13 | PEFOFF file. 14 | .TP 15 | .BI \-subsystem " type" 16 | specifies the EFI subsystem 17 | .I type 18 | which can be 19 | .IR application , 20 | .I boot 21 | or 22 | .I runtime. 23 | The default is 24 | .IR application . 25 | .TP 26 | .BI "\-section_alignment" " value" 27 | Specifies the PECOFF section alignment. 28 | .I value 29 | is a hexadecimal number that must be an integral power of 2. 30 | The default is the Mac OS X target pagesize (1000 hex). This value should 31 | match the value used for 32 | .B "\-segalign" 33 | when linking the Mach-O file. 34 | .TP 35 | .BI "\-align" " value" 36 | Specifies the PECOFF file and section alignment. 37 | .I value 38 | is a hexadecimal number that must be an integral power of 2. 39 | The default is 400 hex. This value should match the value used for 40 | .B "\-segalign" 41 | when linking the Mach-O file. 42 | .TP 43 | .BI "\-d " filename" 44 | Specifies the filename to be used to create a debug directory entry with. 45 | -------------------------------------------------------------------------------- /cctools-750/man/pagestuff.1: -------------------------------------------------------------------------------- 1 | .TH PAGESTUFF 1 "January 3, 2001" "Apple Computer, Inc." 2 | .SH NAME 3 | pagestuff \- Mach-O file page analysis tool 4 | .SH SYNOPSIS 5 | pagestuff file [-a] [-p] [pagenumber...] 6 | .SH DESCRIPTION 7 | pagestuff displays information about the specified logical pages of a 8 | file conforming to the Mach-O executable format. For each specified 9 | page of code, symbols (function and static data structure names) are 10 | displayed. If no pages are specified, symbols for all pages in the 11 | __TEXT, __text section are displayed. 12 | .PP 13 | The options to 14 | .IR pagestuff (1) 15 | are: 16 | .TP 17 | .BI \-a 18 | Displays all pages. All other arguments are ignored. 19 | .TP 20 | .BI \-p 21 | Print a list of the sections of the specified Mach-O file, with offsets and 22 | lengths. All other arguments are ignored. Note that the size(1) tool given 23 | arguments "-m -l -x" displays a much more concise listing. 24 | .SH "SEE ALSO" 25 | Mach-O(5), size(1) 26 | -------------------------------------------------------------------------------- /cctools-750/man/ranlib.1: -------------------------------------------------------------------------------- 1 | .so man1/libtool.1 2 | -------------------------------------------------------------------------------- /cctools-750/misc/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | English 7 | CFBundleIdentifier 8 | com.apple.tool.codesign_allocate.standard 9 | CFBundleInfoDictionaryVersion 10 | 6.0 11 | CFBundleName 12 | codesign_allocate 13 | CFBundleVersion 14 | 0.3 15 | Application-Group 16 | com.apple.tool.codesign_allocate 17 | 18 | 19 | -------------------------------------------------------------------------------- /cctools-750/otool/hppa_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #import 24 | #import 25 | #import 26 | #import 27 | #include "stuff/symbol.h" 28 | 29 | extern uint32_t hppa_disassemble( 30 | char *sect, 31 | uint32_t left, 32 | uint32_t addr, 33 | uint32_t sect_addr, 34 | enum byte_sex object_byte_sex, 35 | struct relocation_info *sorted_relocs, 36 | uint32_t nsorted_relocs, 37 | struct nlist *symbols, 38 | uint32_t nsymbols, 39 | struct symbol *sorted_symbols, 40 | uint32_t nsorted_symbols, 41 | char *strings, 42 | uint32_t strings_size, 43 | enum bool verbose); 44 | -------------------------------------------------------------------------------- /cctools-750/otool/i860_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #import 24 | #import 25 | #import 26 | #import 27 | #include "stuff/symbol.h" 28 | 29 | extern uint32_t i860_disassemble( 30 | char *sect, 31 | uint32_t left, 32 | uint32_t addr, 33 | uint32_t sect_addr, 34 | enum byte_sex object_byte_sex, 35 | struct relocation_info *sorted_relocs, 36 | uint32_t nsorted_relocs, 37 | struct nlist *symbols, 38 | uint32_t nsymbols, 39 | struct symbol *sorted_symbols, 40 | uint32_t nsorted_symbols, 41 | char *strings, 42 | uint32_t strings_size, 43 | enum bool verbose); 44 | -------------------------------------------------------------------------------- /cctools-750/otool/m88k_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | #import 24 | #import 25 | #import 26 | #import 27 | #include "stuff/symbol.h" 28 | 29 | extern uint32_t m88k_disassemble( 30 | char *sect, 31 | uint32_t left, 32 | uint32_t addr, 33 | uint32_t sect_addr, 34 | enum byte_sex object_byte_sex, 35 | struct relocation_info *sorted_relocs, 36 | uint32_t nsorted_relocs, 37 | struct nlist *symbols, 38 | uint32_t nsymbols, 39 | struct symbol *sorted_symbols, 40 | uint32_t nsorted_symbols, 41 | char *strings, 42 | uint32_t strings_size, 43 | enum bool verbose); 44 | -------------------------------------------------------------------------------- /magichat.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/magichat.icns -------------------------------------------------------------------------------- /main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // MagicHat 4 | // 5 | // Created by wolf on 12/27/09. 6 | // Copyright Red Shed Software Company 2009. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | int main(int argc, char *argv[]) 12 | { 13 | return macruby_main("rb_main.rb", argc, argv); 14 | } 15 | -------------------------------------------------------------------------------- /objc4-437.1/objc.suo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/objc4-437.1/objc.suo -------------------------------------------------------------------------------- /objc4-437.1/runtests.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Simple script to run the libclosure tests 3 | # Note: to build the testing root, the makefile will ask to authenticate with sudo 4 | # Use the RootsDirectory environment variable to direct the build to somewhere other than /tmp/ 5 | 6 | RootsDirectory=${RootsDirectory:-/tmp/} 7 | StartingDir="$PWD" 8 | ObjcDir="`dirname $0`" 9 | TestsDir="test/" 10 | cd "$ObjcDir" 11 | # ER: option to not require extra privileges (-nosudo or somesuch) 12 | Buildit="/Network/Servers/xs1/release/bin/buildit -rootsDirectory ${RootsDirectory} -arch i386 -arch ppc -arch x86_64 -project objc4 ." 13 | echo Sudoing for buildit: 14 | sudo $Buildit 15 | XIT=$? 16 | if [[ $XIT == 0 ]]; then 17 | cd "$TestsDir" 18 | ObjcRootPath="$RootsDirectory/objc4.roots/objc4~dst/usr/lib/libobjc.A.dylib" 19 | make HALT=YES OBJC_LIB="$ObjcRootPath" 20 | XIT=$? 21 | make clean 22 | fi 23 | cd "$StartingDir" 24 | exit $XIT -------------------------------------------------------------------------------- /objc4-437.1/runtime/Auto.subproj/objc-auto-ppc64.s: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | #ifdef __ppc64__ 25 | 26 | #warning ppc64 version needs to be implemented. 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/hashtable.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-class.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-initialize.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2005-2006 Apple Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | #ifndef _OBJC_INITIALIZE_H 25 | #define _OBJC_INITIALIZE_H 26 | 27 | #include "objc.h" 28 | 29 | __BEGIN_DECLS 30 | 31 | struct _objc_initializing_classes; 32 | 33 | extern BOOL _class_isInitializing(Class cls); 34 | BOOL _class_isInitialized(Class cls); 35 | 36 | extern void _class_initialize(Class cls); 37 | 38 | extern void _destroyInitializingClassList(struct _objc_initializing_classes *list); 39 | 40 | __END_DECLS 41 | 42 | #endif 43 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-internal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Apple Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | 25 | #ifndef _OBJC_INTERNAL_H 26 | #define _OBJC_INTERNAL_H 27 | 28 | /* 29 | * WARNING DANGER HAZARD BEWARE EEK 30 | * 31 | * Everything in this file is for Apple Internal use only. 32 | * These will change in arbitrary OS updates and in unpredictable ways. 33 | * When your program breaks, you get to keep both pieces. 34 | */ 35 | 36 | #include 37 | #include 38 | 39 | OBJC_EXPORT id objc_constructInstance(Class cls, void *bytes) 40 | __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA); 41 | OBJC_EXPORT void *objc_destructInstance(id obj) 42 | __OSX_AVAILABLE_STARTING(__MAC_10_6,__IPHONE_NA); 43 | 44 | #endif 45 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-loadmethod.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004-2006 Apple Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /*********************************************************************** 25 | * objc-loadmethod.h 26 | * Support for +load methods. 27 | **********************************************************************/ 28 | 29 | #include "objc-private.h" 30 | 31 | extern void add_class_to_loadable_list(Class cls); 32 | extern void add_category_to_loadable_list(Category cat); 33 | extern void remove_class_from_loadable_list(Class cls); 34 | extern void remove_category_from_loadable_list(Category cat); 35 | 36 | extern void call_load_methods(void); 37 | 38 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-probes.d: -------------------------------------------------------------------------------- 1 | provider objc_runtime 2 | { 3 | probe objc_exception_throw(void *id); 4 | probe objc_exception_rethrow(); 5 | }; 6 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-references.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2008 Apple Inc. All Rights Reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | /* 24 | * objc-references.h 25 | */ 26 | 27 | #if !defined(_OBJC_REFERENCES_H_) 28 | #define _OBJC_REFERENCES_H_ 29 | 30 | #include "objc-api.h" 31 | #include "objc-config.h" 32 | 33 | __BEGIN_DECLS 34 | 35 | extern void _object_set_associative_reference(id object, void *key, id value, uintptr_t policy); 36 | extern id _object_get_associative_reference(id object, void *key); 37 | extern void _object_remove_assocations(id object); 38 | 39 | __END_DECLS 40 | 41 | #endif 42 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-runtime.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-sel-set.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * This file contains Original Code and/or Modifications of Original Code 7 | * as defined in and that are subject to the Apple Public Source License 8 | * Version 2.0 (the 'License'). You may not use this file except in 9 | * compliance with the License. Please obtain a copy of the License at 10 | * http://www.opensource.apple.com/apsl/ and read it before using this 11 | * file. 12 | * 13 | * The Original Code and all software distributed under the License are 14 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 15 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 16 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 17 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 18 | * Please see the License for the specific language governing rights and 19 | * limitations under the License. 20 | * 21 | * @APPLE_LICENSE_HEADER_END@ 22 | */ 23 | 24 | /* 25 | * objc-sel-set.h 26 | * A set of SELs used for SEL uniquing. 27 | */ 28 | 29 | #include 30 | #include "objc-os.h" 31 | 32 | __BEGIN_DECLS 33 | 34 | struct __objc_sel_set; 35 | 36 | extern struct __objc_sel_set *__objc_sel_set_create(uint32_t capacity); 37 | extern SEL __objc_sel_set_get(struct __objc_sel_set *sset, SEL candidate); 38 | extern void __objc_sel_set_add(struct __objc_sel_set *sset, SEL value); 39 | 40 | __END_DECLS 41 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objc-sel-table.s: -------------------------------------------------------------------------------- 1 | /* This file is automatically generated. Do not edit. */ 2 | .section __TEXT,__objc_selopt 3 | .private_extern __objc_selopt_data 4 | __objc_selopt_data: 5 | .long 3 /* table.version */ 6 | .long 4 /* table.capacity */ 7 | .long 4 /* table.occupied */ 8 | .long 63 /* table.shift */ 9 | .long 3 /* table.mask */ 10 | .long 0 /* table.zero */ 11 | .quad 0 /* table.salt */ 12 | .quad 0 /* table.base */ 13 | .space 256*4 /* table.scramble */ 14 | .long 0 /* table.tab */ 15 | .long 20 /* table.offsets */ 16 | .long 20 17 | .long 20 18 | .long 20 19 | /* space for smax/capacity=131072, blen/mask=65535+1 */ 20 | .space 65536 21 | .space 131072*4 22 | -------------------------------------------------------------------------------- /objc4-437.1/runtime/objcrt.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | 4 | typedef struct { 5 | int count; // number of pointer pairs that follow 6 | void *modStart; 7 | void *modEnd; 8 | void *protoStart; 9 | void *protoEnd; 10 | void *iiStart; 11 | void *iiEnd; 12 | void *selrefsStart; 13 | void *selrefsEnd; 14 | void *clsrefsStart; 15 | void *clsrefsEnd; 16 | } objc_sections; 17 | 18 | OBJC_EXPORT void *_objc_init_image(HMODULE image, const objc_sections *sects); 19 | OBJC_EXPORT void _objc_load_image(HMODULE image, void *hinfo); 20 | OBJC_EXPORT void _objc_unload_image(HMODULE image, void *hinfo); 21 | -------------------------------------------------------------------------------- /objc4-437.1/test/README: -------------------------------------------------------------------------------- 1 | objc4 test suite README 2 | 3 | To run the tests: 4 | `make` in this directory, or `make test` in the top-level directory 5 | 6 | Correct test output consists of 'PASS: testname' for each test. 7 | No other output should be seen. 8 | 9 | Other options: 10 | `make` tests the installed libobjc 11 | `make buildit` tests the libobjc in /tmp/objc4-roots/objc4~sym/ 12 | `make local` tests the libobjc in .. 13 | 14 | `make GC=YES` runs with garbage collection on 15 | `make ARCHS=cpu` tests with the specified architecture (only one allowed) 16 | `make VALGRIND=YES` runs with valgrind on (memcheck and leak detection) 17 | `make GUARDMALLOC=YES` runs with GuardMalloc on 18 | 19 | `make OBJC_LIB=/path/to/libobjc.A.dylib` tests a specific objc4 build 20 | `make OTHER_CFLAGS=x` tests with specified flags 21 | 22 | `make VERBOSE=` logs progress of some tests 23 | -------------------------------------------------------------------------------- /objc4-437.1/test/association-cf.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "test.h" 5 | 6 | int main() 7 | { 8 | // rdar://6164781 setAssociatedObject on pure-CF object crashes LP64 9 | 10 | id obj; 11 | CFArrayRef array = CFArrayCreate(0, 0, 0, 0); 12 | testassert(array); 13 | 14 | testassert(! objc_getClass("NSCFArray")); 15 | 16 | objc_setAssociatedObject((id)array, (void*)1, (id)array, OBJC_ASSOCIATION_ASSIGN); 17 | 18 | obj = objc_getAssociatedObject((id)array, (void*)1); 19 | testassert(obj == (id)array); 20 | 21 | CFRelease(array); 22 | 23 | succeed(__FILE__); 24 | } 25 | -------------------------------------------------------------------------------- /objc4-437.1/test/cacheflush.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | @interface Super { id isa; } 4 | +class; 5 | +(int)classMethod; 6 | -(int)instanceMethod; 7 | @end 8 | -------------------------------------------------------------------------------- /objc4-437.1/test/cacheflush.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | 5 | #include "cacheflush.h" 6 | 7 | @interface Sub : Super @end 8 | @implementation Sub @end 9 | 10 | 11 | int main() 12 | { 13 | uintptr_t buf[10]; 14 | uintptr_t buf2[10]; 15 | buf[0] = (uintptr_t)[Super class]; 16 | buf2[0] = (uintptr_t)[Sub class]; 17 | 18 | // Fill method cache 19 | testassert(1 == [Super classMethod]); 20 | testassert(1 == [(Super *)buf instanceMethod]); 21 | testassert(1 == [Super classMethod]); 22 | testassert(1 == [(Super *)buf instanceMethod]); 23 | 24 | testassert(1 == [Sub classMethod]); 25 | testassert(1 == [(Sub *)buf2 instanceMethod]); 26 | testassert(1 == [Sub classMethod]); 27 | testassert(1 == [(Sub *)buf2 instanceMethod]); 28 | 29 | // Dynamically load a category 30 | dlopen("cacheflush2.out", 0); 31 | 32 | // Make sure old cache results are gone 33 | testassert(2 == [Super classMethod]); 34 | testassert(2 == [(Super *)buf instanceMethod]); 35 | 36 | testassert(2 == [Sub classMethod]); 37 | testassert(2 == [(Sub *)buf2 instanceMethod]); 38 | 39 | // Dynamically load another category 40 | dlopen("cacheflush3.out", 0); 41 | 42 | // Make sure old cache results are gone 43 | testassert(3 == [Super classMethod]); 44 | testassert(3 == [(Super *)buf instanceMethod]); 45 | 46 | testassert(3 == [Sub classMethod]); 47 | testassert(3 == [(Sub *)buf2 instanceMethod]); 48 | 49 | // fixme test subclasses 50 | 51 | // fixme test objc_flush_caches(), class_addMethod(), class_addMethods() 52 | 53 | succeed(__FILE__); 54 | } 55 | -------------------------------------------------------------------------------- /objc4-437.1/test/cacheflush0.m: -------------------------------------------------------------------------------- 1 | #include "cacheflush.h" 2 | 3 | @implementation Super 4 | +(void)initialize { } 5 | +class { return self; } 6 | +(int)classMethod { return 1; } 7 | -(int)instanceMethod { return 1; } 8 | @end 9 | -------------------------------------------------------------------------------- /objc4-437.1/test/cacheflush2.m: -------------------------------------------------------------------------------- 1 | #include "cacheflush.h" 2 | 3 | @implementation Super (Category2) 4 | +(int)classMethod { return 2; } 5 | -(int)instanceMethod { return 2; } 6 | @end 7 | -------------------------------------------------------------------------------- /objc4-437.1/test/cacheflush3.m: -------------------------------------------------------------------------------- 1 | #include "cacheflush.h" 2 | 3 | @implementation Super (Category3) 4 | +(int)classMethod { return 3; } 5 | -(int)instanceMethod { return 3; } 6 | @end 7 | -------------------------------------------------------------------------------- /objc4-437.1/test/classgetclass.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #import 4 | 5 | @interface Foo:NSObject 6 | @end 7 | @implementation Foo 8 | @end 9 | 10 | extern Class gdb_class_getClass(Class cls); 11 | 12 | int main() 13 | { 14 | #if __OBJC2__ 15 | testassert(gdb_class_getClass([Foo class]) == [Foo class]); 16 | #endif 17 | 18 | succeed(__FILE__); 19 | } 20 | -------------------------------------------------------------------------------- /objc4-437.1/test/classname.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | 5 | @interface Super { @public id isa; } @end 6 | @implementation Super 7 | +(void)initialize { } 8 | +class { return self; } 9 | @end 10 | 11 | @interface Fake { @public id isa; } @end 12 | @implementation Fake 13 | +(void)initialize { } 14 | +class { return self; } 15 | @end 16 | 17 | int main() 18 | { 19 | id buf[10]; 20 | Super *obj = (Super *)buf; 21 | buf[0] = [Fake class]; 22 | 23 | testassert(obj->isa == [Fake class]); 24 | testassert(object_setClass(obj, [Super class]) == [Fake class]); 25 | testassert(obj->isa == [Super class]); 26 | testassert(object_setClass(nil, [Super class]) == nil); 27 | 28 | testassert(object_getClass(obj) == buf[0]); 29 | testassert(object_getClass([Super class]) == [Super class]->isa); 30 | testassert(object_getClass(nil) == Nil); 31 | 32 | testassert(0 == strcmp(object_getClassName(obj), "Super")); 33 | testassert(0 == strcmp(object_getClassName([Super class]), "Super")); 34 | testassert(0 == strcmp(object_getClassName(nil), "nil")); 35 | 36 | testassert(0 == strcmp(class_getName([Super class]), "Super")); 37 | testassert(0 == strcmp(class_getName([Super class]->isa), "Super")); 38 | testassert(0 == strcmp(class_getName(nil), "nil")); 39 | 40 | succeed(__FILE__); 41 | } 42 | -------------------------------------------------------------------------------- /objc4-437.1/test/classversion.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | 4 | @interface Super { id isa; } @end 5 | @implementation Super 6 | +class { return self; } 7 | +(void)initialize { } 8 | @end 9 | 10 | int main() 11 | { 12 | Class cls = [Super class]; 13 | testassert(class_getVersion(cls) == 0); 14 | testassert(class_getVersion(cls->isa) > 5); 15 | class_setVersion(cls, 100); 16 | testassert(class_getVersion(cls) == 100); 17 | 18 | testassert(class_getVersion(Nil) == 0); 19 | class_setVersion(Nil, 100); 20 | 21 | succeed(__FILE__); 22 | } 23 | -------------------------------------------------------------------------------- /objc4-437.1/test/concurrentcat_category.m: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #import 4 | 5 | @interface TargetClass : NSObject 6 | @end 7 | 8 | @interface TargetClass(LoadedMethods) 9 | - (void) m0; 10 | - (void) m1; 11 | - (void) m2; 12 | - (void) m3; 13 | - (void) m4; 14 | - (void) m5; 15 | - (void) m6; 16 | - (void) m7; 17 | - (void) m8; 18 | - (void) m9; 19 | - (void) m10; 20 | - (void) m11; 21 | - (void) m12; 22 | - (void) m13; 23 | - (void) m14; 24 | - (void) m15; 25 | @end 26 | 27 | @interface TN:TargetClass 28 | @end 29 | 30 | @implementation TN 31 | - (void) m1; { [super m1]; } 32 | - (void) m3; { [self m1]; } 33 | 34 | - (void) m2 35 | { 36 | [self willChangeValueForKey: @"m4"]; 37 | [self didChangeValueForKey: @"m4"]; 38 | } 39 | 40 | - (void)observeValueForKeyPath:(NSString *) keyPath 41 | ofObject:(id)object 42 | change:(NSDictionary *)change 43 | context:(void *)context 44 | { 45 | // suppress warning 46 | keyPath = nil; 47 | object = nil; 48 | change = nil; 49 | context = NULL; 50 | } 51 | @end 52 | 53 | @implementation TargetClass(LoadedMethods) 54 | - (void) m0;{ ; } 55 | - (void) m1;{ ; } 56 | - (void) m2;{ ; } 57 | - (void) m3;{ ; } 58 | - (void) m4;{ ; } 59 | - (void) m5;{ ; } 60 | - (void) m6;{ ; } 61 | - (void) m7;{ ; } 62 | - (void) m8;{ ; } 63 | - (void) m9;{ ; } 64 | - (void) m10;{ ; } 65 | - (void) m11;{ ; } 66 | - (void) m12;{ ; } 67 | - (void) m13;{ ; } 68 | - (void) m14;{ ; } 69 | - (void) m15;{ ; } 70 | @end 71 | -------------------------------------------------------------------------------- /objc4-437.1/test/definitions.m: -------------------------------------------------------------------------------- 1 | // DO NOT include anything else here 2 | #include 3 | // DO NOT include anything else here 4 | Class c = Nil; 5 | SEL s; 6 | IMP i; 7 | id o = nil; 8 | BOOL b = YES; 9 | BOOL b2 = NO; 10 | __strong void *p; 11 | 12 | 13 | #include "test.h" 14 | 15 | int main() 16 | { 17 | testassert(YES); 18 | testassert(!NO); 19 | testassert(!nil); 20 | testassert(!Nil); 21 | 22 | succeed(__FILE__); 23 | } 24 | -------------------------------------------------------------------------------- /objc4-437.1/test/fail.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | int main() 4 | { 5 | fail("always fails"); 6 | } 7 | -------------------------------------------------------------------------------- /objc4-437.1/test/future.h: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | @interface Super { id isa; } 4 | +class; 5 | @end 6 | 7 | @interface Sub1 : Super 8 | +(int)method; 9 | +(Class)classref; 10 | @end 11 | 12 | @interface Sub2 : Super 13 | +(int)method; 14 | +(Class)classref; 15 | @end 16 | 17 | @interface SubSub1 : Sub1 @end 18 | 19 | @interface SubSub2 : Sub2 @end 20 | -------------------------------------------------------------------------------- /objc4-437.1/test/future0.m: -------------------------------------------------------------------------------- 1 | #include "future.h" 2 | 3 | @implementation Super 4 | +class { return self; } 5 | +(void)initialize { } 6 | @end 7 | 8 | -------------------------------------------------------------------------------- /objc4-437.1/test/future2.m: -------------------------------------------------------------------------------- 1 | #include "future.h" 2 | 3 | 4 | @implementation Sub1 5 | +(Class)classref { 6 | return [Sub1 class]; 7 | } 8 | +(int)method { 9 | return 1; 10 | } 11 | @end 12 | 13 | @implementation SubSub1 14 | +(int)method { 15 | return 1 + [super method]; 16 | } 17 | @end 18 | -------------------------------------------------------------------------------- /objc4-437.1/test/gc.c: -------------------------------------------------------------------------------- 1 | int GC(void) { return 42; } 2 | -------------------------------------------------------------------------------- /objc4-437.1/test/gc.m: -------------------------------------------------------------------------------- 1 | @interface GC @end 2 | @implementation GC @end 3 | -------------------------------------------------------------------------------- /objc4-437.1/test/gcenforcer.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | 5 | int main() 6 | { 7 | int i; 8 | for (i = 0; i < 1000; i++) { 9 | testassert(dlopen_preflight("libsupportsgc.dylib")); 10 | testassert(dlopen_preflight("libnoobjc.dylib")); 11 | 12 | if (objc_collecting_enabled()) { 13 | testassert(dlopen_preflight("librequiresgc.dylib")); 14 | testassert(! dlopen_preflight("libnogc.dylib")); 15 | } else { 16 | testassert(! dlopen_preflight("librequiresgc.dylib")); 17 | testassert(dlopen_preflight("libnogc.dylib")); 18 | } 19 | } 20 | 21 | succeed(__FILE__); 22 | } 23 | -------------------------------------------------------------------------------- /objc4-437.1/test/gcenforcer_nogc.gc.expected-stderr: -------------------------------------------------------------------------------- 1 | objc\[\d+\]: '.*libnogc.dylib' was not compiled with -fobjc-gc or -fobjc-gc-only, but the application requires GC 2 | objc\[\d+\]: \*\*\* GC capability of application and some libraries did not match 3 | -------------------------------------------------------------------------------- /objc4-437.1/test/gcenforcer_nogc.nogc.expected-stderr: -------------------------------------------------------------------------------- 1 | OK: gcenforcer_nogc.out 2 | -------------------------------------------------------------------------------- /objc4-437.1/test/gcenforcer_requiresgc.gc.expected-stderr: -------------------------------------------------------------------------------- 1 | OK: gcenforcer_requiresgc.out 2 | -------------------------------------------------------------------------------- /objc4-437.1/test/gcenforcer_requiresgc.nogc.expected-stderr: -------------------------------------------------------------------------------- 1 | objc\[\d+\]: '.*librequiresgc.dylib' was compiled with -fobjc-gc-only, but the application does not support GC 2 | objc\[\d+\]: \*\*\* GC capability of application and some libraries did not match 3 | -------------------------------------------------------------------------------- /objc4-437.1/test/gdb-lock.m: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | 4 | #include "test.h" 5 | 6 | // gcc -arch ppc -arch i386 -arch x86_64 -x objective-c gdb-lock.m -framework Foundation 7 | // CONFIG GC RR 8 | 9 | #if __cplusplus 10 | extern "C" 11 | #endif 12 | BOOL gdb_objc_isRuntimeLocked(); 13 | 14 | @interface Foo : NSObject 15 | @end 16 | @implementation Foo 17 | - (void) foo; 18 | { 19 | } 20 | 21 | - (void) test: __attribute__((unused)) sender 22 | { 23 | unsigned int x = 0; 24 | Method foo = class_getInstanceMethod([Foo class], @selector(foo)); 25 | IMP fooIMP = method_getImplementation(foo); 26 | const char *fooTypes = method_getTypeEncoding(foo); 27 | while(1) { 28 | NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init]; 29 | char newSELName[100]; 30 | sprintf(newSELName, "a%u", x++); 31 | SEL newSEL = sel_registerName(newSELName); 32 | class_addMethod([Foo class], newSEL, fooIMP, fooTypes); 33 | [self performSelector: newSEL]; 34 | [p drain]; 35 | } 36 | } 37 | @end 38 | 39 | int main() { 40 | NSAutoreleasePool *p = [[NSAutoreleasePool alloc] init]; 41 | [NSThread detachNewThreadSelector: @selector(test:) toTarget: [Foo new] withObject: nil]; 42 | unsigned int x = 0; 43 | unsigned int lockCount = 0; 44 | while(1) { 45 | if (gdb_objc_isRuntimeLocked()) 46 | lockCount++; 47 | x++; 48 | if (x > 1000000) 49 | break; 50 | } 51 | if (lockCount < 10) { 52 | fail("Runtime not locked very much."); 53 | } 54 | [p drain]; 55 | 56 | succeed(__FILE__); 57 | 58 | return 0; 59 | } -------------------------------------------------------------------------------- /objc4-437.1/test/gdb.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | 5 | @interface Super { @public id isa; } @end 6 | @implementation Super 7 | +(void)initialize { } 8 | +class { return self; } 9 | @end 10 | 11 | 12 | int main() 13 | { 14 | // Class hashes 15 | #if __OBJC2__ 16 | 17 | Class result; 18 | 19 | // Class should not be realized yet 20 | // fixme not true during class hash rearrangement 21 | // result = NXMapGet(gdb_objc_realized_classes, "Super"); 22 | // testassert(!result); 23 | 24 | [Super class]; 25 | // Now class should be realized 26 | 27 | result = NXMapGet(gdb_objc_realized_classes, "Super"); 28 | testassert(result); 29 | testassert(result == [Super class]); 30 | 31 | result = NXMapGet(gdb_objc_realized_classes, "DoesNotExist"); 32 | testassert(!result); 33 | 34 | #else 35 | 36 | struct objc_class query; 37 | struct objc_class *result; 38 | 39 | query.name = "Super"; 40 | result = NXHashGet(_objc_debug_class_hash, &query); 41 | testassert(result); 42 | testassert(result == [Super class]); 43 | 44 | query.name = "DoesNotExist"; 45 | result = NXHashGet(_objc_debug_class_hash, &query); 46 | testassert(!result); 47 | 48 | #endif 49 | 50 | succeed(__FILE__); 51 | } 52 | -------------------------------------------------------------------------------- /objc4-437.1/test/imageorder.h: -------------------------------------------------------------------------------- 1 | extern int state; 2 | extern int cstate; 3 | 4 | @interface Super { id isa; } 5 | +(void) method; 6 | +(void) method0; 7 | @end 8 | 9 | @interface Super (cat1) 10 | +(void) method1; 11 | @end 12 | 13 | @interface Super (cat2) 14 | +(void) method2; 15 | @end 16 | 17 | @interface Super (cat3) 18 | +(void) method3; 19 | @end 20 | -------------------------------------------------------------------------------- /objc4-437.1/test/imageorder.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include "imageorder.h" 3 | #include 4 | #include 5 | 6 | int main() 7 | { 8 | // +load methods and C static initializers 9 | testassert(state == 3); 10 | testassert(cstate == 3); 11 | 12 | Class cls = objc_getClass("Super"); 13 | testassert(cls); 14 | 15 | // make sure all categories arrived 16 | state = -1; 17 | [Super method0]; 18 | testassert(state == 0); 19 | [Super method1]; 20 | testassert(state == 1); 21 | [Super method2]; 22 | testassert(state == 2); 23 | [Super method3]; 24 | testassert(state == 3); 25 | 26 | // make sure imageorder3.out is the last category to attach 27 | state = 0; 28 | [Super method]; 29 | testassert(state == 3); 30 | 31 | succeed(__FILE__); 32 | } 33 | -------------------------------------------------------------------------------- /objc4-437.1/test/imageorder1.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include "imageorder.h" 3 | 4 | int state = -1; 5 | int cstate = 0; 6 | 7 | static void c1(void) __attribute__((constructor)); 8 | static void c1(void) 9 | { 10 | testassert(state == 1); // +load before C/C++ 11 | testassert(cstate == 0); 12 | cstate = 1; 13 | } 14 | 15 | @implementation Super (cat1) 16 | +(void) method { 17 | fail("+[Super(cat1) method] not replaced!"); 18 | } 19 | +(void) method1 { 20 | state = 1; 21 | } 22 | +(void) load { 23 | testassert(state == 0); 24 | state = 1; 25 | } 26 | @end 27 | 28 | @implementation Super 29 | +(void) initialize { } 30 | +(void) method { 31 | fail("+[Super method] not replaced!"); 32 | } 33 | +(void) method0 { 34 | state = 0; 35 | } 36 | +(void) load { 37 | testassert(state == -1); 38 | state = 0; 39 | } 40 | @end 41 | 42 | -------------------------------------------------------------------------------- /objc4-437.1/test/imageorder2.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include "imageorder.h" 3 | 4 | static void c2(void) __attribute__((constructor)); 5 | static void c2(void) 6 | { 7 | testassert(state == 2); // +load before C/C++ 8 | testassert(cstate == 1); 9 | cstate = 2; 10 | } 11 | 12 | @implementation Super (cat2) 13 | +(void) method { 14 | fail("+[Super(cat2) method] not replaced!"); 15 | } 16 | +(void) method2 { 17 | state = 2; 18 | } 19 | +(void) load { 20 | testassert(state == 1); 21 | state = 2; 22 | } 23 | @end 24 | -------------------------------------------------------------------------------- /objc4-437.1/test/imageorder3.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include "imageorder.h" 3 | 4 | static void c3(void) __attribute__((constructor)); 5 | static void c3(void) 6 | { 7 | testassert(state == 3); // +load before C/C++ 8 | testassert(cstate == 2); 9 | cstate = 3; 10 | } 11 | 12 | @implementation Super (cat3) 13 | +(void) method { 14 | state = 3; 15 | } 16 | +(void) method3 { 17 | state = 3; 18 | } 19 | +(void) load { 20 | testassert(state == 2); 21 | state = 3; 22 | } 23 | @end 24 | -------------------------------------------------------------------------------- /objc4-437.1/test/ismeta.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | 4 | @interface Super { id isa; } @end 5 | @implementation Super 6 | +(void)initialize { } 7 | +class { return self; } 8 | @end 9 | 10 | int main() 11 | { 12 | testassert(!class_isMetaClass([Super class])); 13 | testassert(class_isMetaClass([Super class]->isa)); 14 | testassert(!class_isMetaClass(nil)); 15 | succeed(__FILE__); 16 | } 17 | -------------------------------------------------------------------------------- /objc4-437.1/test/ivarSlide1.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | 5 | #define OLD 0 6 | #include "ivarSlide.h" 7 | 8 | @implementation Base 9 | +(void)initialize { } 10 | +class { return self; } 11 | +new { return class_createInstance(self, 0); } 12 | -(void)dealloc { object_dispose(self); } 13 | -(void)finalize { } 14 | @end 15 | 16 | @implementation Super @end 17 | 18 | @implementation ShrinkingSuper @end 19 | 20 | @implementation MoreStrongSuper @end 21 | @implementation LessStrongSuper @end 22 | @implementation MoreWeakSuper @end 23 | @implementation MoreWeak2Super @end 24 | @implementation LessWeakSuper @end 25 | @implementation LessWeak2Super @end 26 | @implementation NoGCChangeSuper @end 27 | @implementation RunsOf15 @end 28 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-order.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | extern int state1, state2, state3; 4 | 5 | int main() 6 | { 7 | testassert(state1 == 1 && state2 == 2 && state3 == 3); 8 | succeed(__FILE__); 9 | } 10 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-order1.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | extern int state2, state3; 4 | 5 | int state1 = 0; 6 | 7 | @interface One @end 8 | @implementation One 9 | +(void)load 10 | { 11 | testassert(state2 == 2 && state3 == 3); 12 | state1 = 1; 13 | } 14 | @end 15 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-order2.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | extern int state3; 4 | 5 | int state2 = 0; 6 | 7 | @interface Two @end 8 | @implementation Two 9 | +(void)load 10 | { 11 | testassert(state3 == 3); 12 | state2 = 2; 13 | } 14 | @end 15 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-order3.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | int state3 = 0; 4 | 5 | @interface Three @end 6 | @implementation Three 7 | +(void)load 8 | { 9 | state3 = 3; 10 | } 11 | @end 12 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-parallel.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | #include 4 | #include 5 | 6 | #ifndef COUNT 7 | #error -DCOUNT=c missing 8 | #endif 9 | 10 | extern int state; 11 | 12 | void *thread(void *arg) 13 | { 14 | uintptr_t num = (uintptr_t)arg; 15 | char *buf; 16 | 17 | objc_registerThreadWithCollector(); 18 | 19 | asprintf(&buf, "load-parallel%lu.out", (unsigned long)num); 20 | testprintf("%s\n", buf); 21 | void *dlh = dlopen(buf, RTLD_LAZY); 22 | if (!dlh) { 23 | fail("dlopen failed: %s", dlerror()); 24 | } 25 | 26 | return NULL; 27 | } 28 | 29 | int main() 30 | { 31 | pthread_t t[COUNT]; 32 | uintptr_t i; 33 | 34 | for (i = 0; i < COUNT; i++) { 35 | pthread_create(&t[i], NULL, thread, (void *)i); 36 | } 37 | 38 | for (i = 0; i < COUNT; i++) { 39 | pthread_join(t[i], NULL); 40 | } 41 | 42 | testprintf("loaded %d/%d\n", state, COUNT*26); 43 | testassert(state == COUNT*26); 44 | 45 | succeed(__FILE__); 46 | } 47 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-parallel0.m: -------------------------------------------------------------------------------- 1 | #ifndef N 2 | #error -DN=n missing 3 | #endif 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | extern int state; 10 | 11 | #define CLASS0(n,nn) \ 12 | @interface C_##n##_##nn @end \ 13 | @implementation C_##n##_##nn \ 14 | +(void)load { OSAtomicIncrement32(&state); usleep(10); } \ 15 | @end 16 | 17 | #define CLASS(n,nn) CLASS0(n,nn) 18 | 19 | CLASS(a,N) 20 | CLASS(b,N) 21 | CLASS(c,N) 22 | CLASS(d,N) 23 | CLASS(e,N) 24 | CLASS(f,N) 25 | CLASS(g,N) 26 | CLASS(h,N) 27 | CLASS(i,N) 28 | CLASS(j,N) 29 | CLASS(k,N) 30 | CLASS(l,N) 31 | CLASS(m,N) 32 | CLASS(n,N) 33 | CLASS(o,N) 34 | CLASS(p,N) 35 | CLASS(q,N) 36 | CLASS(r,N) 37 | CLASS(s,N) 38 | CLASS(t,N) 39 | CLASS(u,N) 40 | CLASS(v,N) 41 | CLASS(w,N) 42 | CLASS(x,N) 43 | CLASS(y,N) 44 | CLASS(z,N) 45 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-parallel00.m: -------------------------------------------------------------------------------- 1 | int state = 0; 2 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-reentrant.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | 4 | int state1 = 0; 5 | int *state2_p; 6 | 7 | @interface One @end 8 | @implementation One 9 | +(void)load 10 | { 11 | state1 = 111; 12 | 13 | // Re-entrant +load doesn't get to complete until we do 14 | void *dlh = dlopen("libload-reentrant2.dylib", RTLD_LAZY); 15 | testassert(dlh); 16 | state2_p = (int *)dlsym(dlh, "state2"); 17 | testassert(state2_p); 18 | testassert(*state2_p == 0); 19 | 20 | state1 = 1; 21 | } 22 | @end 23 | 24 | int main() 25 | { 26 | testassert(state1 == 1 && state2_p && *state2_p == 2); 27 | succeed(__FILE__); 28 | } 29 | -------------------------------------------------------------------------------- /objc4-437.1/test/load-reentrant2.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | int state2 = 0; 4 | extern int state1; 5 | 6 | static void ctor(void) __attribute__((constructor)); 7 | static void ctor(void) 8 | { 9 | // should be called during One's dlopen(), before Two's +load 10 | testassert(state1 == 111); 11 | testassert(state2 == 0); 12 | } 13 | 14 | @interface Two @end 15 | @implementation Two 16 | +(void) load 17 | { 18 | // Does not run until One's +load completes 19 | testassert(state1 == 1); 20 | state2 = 2; 21 | } 22 | @end 23 | -------------------------------------------------------------------------------- /objc4-437.1/test/main.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | @interface Main @end 4 | @implementation Main @end 5 | 6 | int main(int argc __attribute__((unused)), char **argv) 7 | { 8 | succeed(basename(argv[0])); 9 | } 10 | -------------------------------------------------------------------------------- /objc4-437.1/test/method_getName.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | #include "../runtime/objc-rtp.h" 5 | 6 | int main() { 7 | unsigned i; 8 | Class c = [NSObject class]; 9 | unsigned numMethods; 10 | Method *methods = class_copyMethodList(c, &numMethods); 11 | 12 | for (i=0; i method_getName crash on NSObject method when GC is enabled 14 | SEL aMethod = method_getName(methods[i]); 15 | if (aMethod == (SEL)kIgnore) 16 | fail(__FILE__); 17 | } 18 | 19 | succeed(__FILE__); 20 | } 21 | -------------------------------------------------------------------------------- /objc4-437.1/test/nilAPIArgs.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | #import 4 | 5 | int main() { 6 | // ensure various bits of API don't crash when tossed nil parameters 7 | class_conformsToProtocol(nil, nil); 8 | method_setImplementation(nil, NULL); 9 | 10 | succeed(__FILE__); 11 | } 12 | -------------------------------------------------------------------------------- /objc4-437.1/test/nsobject.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | #import 4 | 5 | @interface Sub : NSObject { } @end 6 | @implementation Sub 7 | +allocWithZone:(NSZone *)zone { 8 | testprintf("in +[Sub alloc]\n"); 9 | return [super allocWithZone:zone]; 10 | } 11 | -(void)dealloc { 12 | testprintf("in -[Sub dealloc]\n"); 13 | [super dealloc]; 14 | } 15 | @end 16 | 17 | int main() 18 | { 19 | NSAutoreleasePool *pool = [NSAutoreleasePool new]; 20 | [[Sub new] autorelease]; 21 | [pool release]; 22 | 23 | succeed(__FILE__); 24 | } 25 | -------------------------------------------------------------------------------- /objc4-437.1/test/property.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | #include 5 | 6 | @interface Super { 7 | @public 8 | id isa; 9 | char superIvar; 10 | } 11 | 12 | @property(readonly) char superProp; 13 | @end 14 | 15 | @implementation Super 16 | @synthesize superProp = superIvar; 17 | +(void)initialize { } 18 | +class { return self; } 19 | @end 20 | 21 | 22 | @interface Sub : Super { 23 | @public 24 | uintptr_t subIvar; 25 | } 26 | @property(readonly) uintptr_t subProp; 27 | @end 28 | 29 | @implementation Sub 30 | @synthesize subProp = subIvar; 31 | @end 32 | 33 | 34 | int main() 35 | { 36 | /* 37 | Runtime layout of Sub: 38 | [0] isa 39 | [1] superIvar 40 | [2] subIvar 41 | */ 42 | 43 | objc_property_t prop; 44 | 45 | prop = class_getProperty([Sub class], "subProp"); 46 | testassert(prop); 47 | 48 | prop = class_getProperty([Super class], "superProp"); 49 | testassert(prop); 50 | testassert(prop == class_getProperty([Sub class], "superProp")); 51 | 52 | prop = class_getProperty([Super class], "subProp"); 53 | testassert(!prop); 54 | 55 | prop = class_getProperty([Sub class]->isa, "subProp"); 56 | testassert(!prop); 57 | 58 | 59 | testassert(NULL == class_getProperty(NULL, "foo")); 60 | testassert(NULL == class_getProperty([Sub class], NULL)); 61 | testassert(NULL == class_getProperty(NULL, NULL)); 62 | 63 | succeed(__FILE__); 64 | return 0; 65 | } 66 | -------------------------------------------------------------------------------- /objc4-437.1/test/protocol_cw.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | 3 | #if __OBJC2__ 4 | 5 | int main() 6 | { 7 | succeed(__FILE__); 8 | } 9 | 10 | #else 11 | 12 | // rdar://4951638 13 | 14 | #include 15 | #include 16 | 17 | char Protocol_name[] __attribute__((section("__OBJC,__class_names"))) = "Protocol"; 18 | 19 | struct { 20 | void *isa; 21 | char *protocol_name; 22 | void *protocol_list; 23 | void *instance_methods; 24 | void *class_methods; 25 | } Foo_protocol __attribute__((section("__OBJC,__protocol"))) = { Protocol_name, "Foo", 0, 0, 0 }; 26 | 27 | int main() 28 | { 29 | Protocol *foo = objc_getProtocol("Foo"); 30 | 31 | testassert(foo == (Protocol *)&Foo_protocol); 32 | testassert(0 == strcmp("Foo", [foo name])); 33 | succeed(__FILE__); 34 | } 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /objc4-437.1/test/resolve.expected-stderr: -------------------------------------------------------------------------------- 1 | objc\[\d+\]: \+\[Sub resolveClassMethod:lyingClassMethod\] returned YES, but no new implementation of \+\[Sub lyingClassMethod\] was found 2 | objc\[\d+\]: \+\[Sub resolveInstanceMethod:lyingInstanceMethod\] returned YES, but no new implementation of -\[Sub lyingInstanceMethod\] was found 3 | OK: resolve\.m 4 | -------------------------------------------------------------------------------- /objc4-437.1/test/runtime.expected-stderr: -------------------------------------------------------------------------------- 1 | objc\[\d+\]: class `DoesNotExist\' not linked into application 2 | OK: runtime.m 3 | -------------------------------------------------------------------------------- /objc4-437.1/test/sel.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | #include 5 | 6 | int main() 7 | { 8 | // Make sure @selector values are correctly fixed up 9 | testassert(@selector(foo) == sel_registerName("foo")); 10 | 11 | // sel_getName recognizes the zero SEL 12 | testassert(0 == strcmp("", sel_getName(0))); 13 | 14 | // sel_getName recognizes GC-ignored SELs 15 | if (objc_collecting_enabled()) { 16 | testassert(0 == strcmp("", 17 | sel_getName(@selector(retain)))); 18 | } else { 19 | testassert(0 == strcmp("retain", 20 | sel_getName(@selector(retain)))); 21 | } 22 | 23 | // _objc_search_builtins() shouldn't crash on GC-ignored SELs 24 | union { 25 | SEL sel; 26 | const char *ptr; 27 | } u; 28 | u.sel = @selector(retain); 29 | testassert(@selector(retain) == sel_registerName(u.ptr)); 30 | 31 | succeed(__FILE__); 32 | } 33 | -------------------------------------------------------------------------------- /objc4-437.1/test/setSuper.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | 4 | @interface Super1 { id isa; } @end 5 | @implementation Super1 6 | +class { return self; } 7 | +(void)initialize { } 8 | +(int)classMethod { return 1; } 9 | -(int)instanceMethod { return 10000; } 10 | @end 11 | 12 | @interface Super2 { id isa; } @end 13 | @implementation Super2 14 | +class { return self; } 15 | +(void)initialize { } 16 | +(int)classMethod { return 2; } 17 | -(int)instanceMethod { return 20000; } 18 | @end 19 | 20 | @interface Sub : Super1 @end 21 | @implementation Sub 22 | +new { return class_createInstance(self, 0); } 23 | +(int)classMethod { return [super classMethod] + 100; } 24 | -(int)instanceMethod { return [super instanceMethod] + 1000000; } 25 | @end 26 | 27 | int main() 28 | { 29 | Class cls; 30 | Sub *obj = [Sub new]; 31 | 32 | testassert(101 == [[Sub class] classMethod]); 33 | testassert(1010000 == [obj instanceMethod]); 34 | 35 | cls = class_setSuperclass([Sub class], [Super2 class]); 36 | 37 | testassert(cls == [Super1 class]); 38 | testassert(cls->isa == [Super1 class]->isa); 39 | 40 | testassert(102 == [[Sub class] classMethod]); 41 | testassert(1020000 == [obj instanceMethod]); 42 | 43 | succeed(__FILE__); 44 | } 45 | -------------------------------------------------------------------------------- /objc4-437.1/test/super.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | 4 | @interface Super { id isa; } @end 5 | @implementation Super 6 | +class { return self; } 7 | +(void)initialize { } 8 | @end 9 | 10 | @interface Sub : Super @end 11 | @implementation Sub @end 12 | 13 | int main() 14 | { 15 | id buf[10]; 16 | buf[0] = [Sub class]; 17 | 18 | // [super ...] messages are tested in msgSend.m 19 | 20 | testassert(class_getSuperclass([Sub class]) == [Super class]); 21 | testassert(class_getSuperclass([Sub class]->isa) == [Super class]->isa); 22 | testassert(class_getSuperclass([Super class]) == Nil); 23 | testassert(class_getSuperclass([Super class]->isa) == [Super class]); 24 | testassert(class_getSuperclass(Nil) == Nil); 25 | 26 | succeed(__FILE__); 27 | } 28 | -------------------------------------------------------------------------------- /objc4-437.1/test/unload.h: -------------------------------------------------------------------------------- 1 | @interface SmallClass { id isa; } 2 | +(id)new; 3 | -(void)free; 4 | @end 5 | 6 | @interface BigClass { id isa; } 7 | +(id)new; 8 | -(void)free; 9 | @end 10 | 11 | -------------------------------------------------------------------------------- /objc4-437.1/test/unload2.m: -------------------------------------------------------------------------------- 1 | #include "unload.h" 2 | #include 3 | 4 | 5 | @implementation SmallClass 6 | +(void)initialize { } 7 | +(id)new { 8 | return class_createInstance(self, 0); 9 | } 10 | -(void)free { object_dispose(self); } 11 | -(void)unload2_instance_method { } 12 | -(void)finalize { } 13 | @end 14 | 15 | 16 | @implementation BigClass 17 | +(void)initialize { } 18 | +(id)new { 19 | return class_createInstance(self, 0); 20 | } 21 | -(void)free { object_dispose(self); } 22 | -(void)finalize { } 23 | -(void)forward:(int)a1:(int)a2 { a1 = a2; } 24 | @end 25 | 26 | 27 | @interface UnusedClass { id isa; } @end 28 | @implementation UnusedClass @end 29 | 30 | 31 | @implementation SmallClass (Category) 32 | -(void)unload2_category_method { } 33 | @end 34 | -------------------------------------------------------------------------------- /objc4-437.1/test/unload3.m: -------------------------------------------------------------------------------- 1 | // unload3: contains imageinfo but no other objc metadata 2 | // libobjc must not keep it open 3 | 4 | #if __OBJC2__ 5 | int fake __attribute__((section("__DATA,__objc_imageinfo"))) = 0; 6 | #else 7 | int fake __attribute__((section("__OBJC,__image_info"))) = 0; 8 | #endif 9 | -------------------------------------------------------------------------------- /objc4-437.1/test/unload4.m: -------------------------------------------------------------------------------- 1 | // unload4: contains some objc metadata other than imageinfo 2 | // libobjc must keep it open 3 | 4 | #if __OBJC2__ 5 | int fake2 __attribute__((section("__DATA,__objc_foo"))) = 0; 6 | #else 7 | int fake2 __attribute__((section("__OBJC,__foo"))) = 0; 8 | #endif 9 | -------------------------------------------------------------------------------- /objc4-437.1/test/weakcopy.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | #include 5 | 6 | @interface Base { 7 | @public 8 | id isa; 9 | } 10 | @end 11 | @implementation Base 12 | +(void)initialize { } 13 | +class { return self; } 14 | @end 15 | 16 | @interface Weak : Base { 17 | @public 18 | __weak id value; 19 | } 20 | @end 21 | @implementation Weak 22 | @end 23 | 24 | int main() 25 | { 26 | Base *value = class_createInstance([Base class], 0); 27 | Weak *oldObject = class_createInstance([Weak class], 0); 28 | oldObject->value = value; 29 | Weak *newObject = object_copy(oldObject, 0); 30 | testassert(newObject->value == oldObject->value); 31 | newObject->value = nil; 32 | succeed(__FILE__); 33 | return 0; 34 | } 35 | -------------------------------------------------------------------------------- /objc4-437.1/test/zone.m: -------------------------------------------------------------------------------- 1 | #include "test.h" 2 | #include 3 | #include 4 | 5 | // Look for malloc zone "ObjC" iff OBJC_USE_INTERNAL_ZONE is set. 6 | // This fails if objc tries to allocate before checking its own 7 | // environment variables (rdar://6688423) 8 | 9 | int main() 10 | { 11 | kern_return_t kr; 12 | vm_address_t *zones; 13 | unsigned int count, i; 14 | BOOL has_objc = NO, want_objc = NO; 15 | 16 | want_objc = (getenv("OBJC_USE_INTERNAL_ZONE") != NULL) ? YES : NO; 17 | testprintf("want objc %s\n", want_objc ? "YES" : "NO"); 18 | 19 | kr = malloc_get_all_zones(mach_task_self(), NULL, &zones, &count); 20 | testassert(!kr); 21 | for (i = 0; i < count; i++) { 22 | const char *name = malloc_get_zone_name((malloc_zone_t *)zones[i]); 23 | if (name) { 24 | BOOL is_objc = (0 == strcmp(name, "ObjC")) ? YES : NO; 25 | if (is_objc) has_objc = YES; 26 | testprintf("zone %s\n", name); 27 | } 28 | } 29 | 30 | testassert(want_objc == has_objc); 31 | 32 | succeed(__FILE__); 33 | } 34 | -------------------------------------------------------------------------------- /objc4-437.1/unexported_symbols: -------------------------------------------------------------------------------- 1 | __ZSt11lower_boundIPKmmET_S2_S2_RKT0_ 2 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_10.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Filename 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Filename

17 |

otx 18 | can use the name of the executable when creating the output file, or 19 | you may specify a name to use for all output files. You may also 20 | specify a filename extension, or let otx use the default "txt". These 21 | text fields are only starting points; they can always be overridden by 22 | the "Output:" text field in the main window.

23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_11.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Location 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Location

17 |

This 18 | option instructs otx to place the output file in the same folder as the 19 | executable(or the .app package) or to ask you where to save the output 20 | file.

21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_12.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Open file with application 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Open file with application

17 |

If 18 | you would like otx to open the output file immediately after it is created, enter the name of your preferred viewer in this text field. Capitalization is ignored.

19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Show local offsets 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Show local offsets

17 |

Displays the distance in bytes from the beginning of a function to each instruction.

18 |

19 | +196  00002c44  3c5f0002  addis    r2,r31,0x2 20 |
or
21 | 00002c44  3c5f0002  addis    r2,r31,0x2 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Show data sections 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Show data sections

17 |

Prints the contents of all data sections at the end of the output file.

18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | otx Help: Entab output 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |

Entab output

18 |

Replaces 19 | multiple spaces with tabs where possible. This option reduces the 20 | output file size, but may look strange depending on the application 21 | used to view the output.

22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Show md5 checksum 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Show md5 checksum

17 |

Includes the md5 checksum of the executable file at the beginning of the output file.

18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Demangle names 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Demangle names

17 |

Attempts to revert mangled C++ symbols to their original form.

18 |

19 | _Znwm 20 |
or
21 | operator new(unsigned long) 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Show method types 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Show method types

17 |

Displays the data type of the return value of ObjC methods.

18 |

19 | -(unsigned int)[CDropBox draggingEntered:] 20 |
or
21 | -[CDropBox draggingEntered:] 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/chapter_2_section_8.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Show variable types 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Show variable types

17 |

Displays the data type of ObjC member variables.

18 |

19 | +100  00003564  807f0068  lwz      r3,0x68(r31)     (NSString)mOutputFileName 20 |
or
21 | +100  00003564  807f0068  lwz      r3,0x68(r31)     mOutputFileName 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | otx Help: Preferences 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 | 33 | 34 | <body bgcolor="#e6e6e6"> 35 | <h2>This document set is best viewed in a browser that supports frames. To access the first page <a href="chapter_2_section_1.html">Click here</a></h2> 36 | </body> 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Contents/index_last.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | otx Help: Open file with application 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 | 33 | 34 | <body bgcolor="#e6e6e6"> 35 | <h2>This document set is best viewed in a browser that supports frames. To access the first page <a href="chapter_2_section_12.html">Click here</a></h2> 36 | </body> 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Overview/chapter_1_section_2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | otx Help: Specifying files to analyze. 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |

Specifying files to analyze.

17 |

There 18 | are several ways to open an executable file in otx. You can drop a file 19 | onto the main window, or onto otx's icon either in the Finder or Dock. 20 | You can also use the "Open" command in otx's File menu. If you drop an 21 | application package(.app) onto otx, it will attempt to open the 22 | application's main executable file. In some cases, the application 23 | package and executable file have different names, and you must locate 24 | the executable file manually (Show Package Contents) and open it directly. 25 | Similarly, if you want to open secondary executable files inside an 26 | application package, such as frameworks, these must be located and 27 | opened manually.

28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Overview/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | otx Help 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 | 33 | 34 | <body bgcolor="#e6e6e6"> 35 | <h2>This document set is best viewed in a browser that supports frames. To access the first page <a href="chapter_1_section_1.html">Click here</a></h2> 36 | </body> 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/Overview/index_last.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | otx Help: Specifying files to analyze. 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 | 33 | 34 | <body bgcolor="#e6e6e6"> 35 | <h2>This document set is best viewed in a browser that supports frames. To access the first page <a href="chapter_1_section_2.html">Click here</a></h2> 36 | </body> 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /otx/English.lproj/Help/art/iconhelpcenter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/art/iconhelpcenter.png -------------------------------------------------------------------------------- /otx/English.lproj/Help/art/iconhelptoc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/art/iconhelptoc.png -------------------------------------------------------------------------------- /otx/English.lproj/Help/art/otxArt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/art/otxArt.png -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/MainWindow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/MainWindow.jpg -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/bullet.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/dash.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/dash.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/download.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/download.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/graydiamond.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/graydiamond.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/hideframes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/hideframes.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/larg_bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/larg_bullet.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/next.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/next.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/pdf.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/pdf.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/previous.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/previous.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/showframes.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/showframes.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/sm_bullet.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/sm_bullet.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/sm_dash.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/sm_dash.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/sm_opentriangle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/sm_opentriangle.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/sm_triangle.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/sm_triangle.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/images/up.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/Help/images/up.gif -------------------------------------------------------------------------------- /otx/English.lproj/Help/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | otx Help 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 24 | 25 | 26 | 27 | 33 | 34 | <body bgcolor="#e6e6e6"> 35 | <h2>This document set is best viewed in a browser that supports frames. To access the first page <a href="Overview/chapter_1_section_1.html">Click here</a></h2> 36 | </body> 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /otx/English.lproj/MainMenu.nib/info.nib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IBFramework Version 6 | 644 7 | IBLastKnownRelativeProjectPath 8 | ../otx.xcodeproj 9 | IBOldestOS 10 | 5 11 | IBOpenObjects 12 | 13 | 1123 14 | 15 | IBSystem Version 16 | 9C2016 17 | targetFramework 18 | IBCocoaFramework 19 | 20 | 21 | -------------------------------------------------------------------------------- /otx/English.lproj/MainMenu.nib/keyedobjects.nib: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/English.lproj/MainMenu.nib/keyedobjects.nib -------------------------------------------------------------------------------- /otx/Version.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | BuildVersion 6 | 17 7 | ProjectName 8 | NibPBTemplates 9 | SourceVersion 10 | 1150000 11 | 12 | 13 | -------------------------------------------------------------------------------- /otx/images/App Icon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/images/App Icon.icns -------------------------------------------------------------------------------- /otx/images/Main Window Background.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/images/Main Window Background.tif -------------------------------------------------------------------------------- /otx/images/Prefs General Icon.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/images/Prefs General Icon.tif -------------------------------------------------------------------------------- /otx/images/Prefs Output Icon.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/images/Prefs Output Icon.tif -------------------------------------------------------------------------------- /otx/main.m: -------------------------------------------------------------------------------- 1 | /* 2 | main.m 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #import 8 | 9 | #ifdef OTX_CLI 10 | #import "CLIController.h" 11 | #else 12 | #import 13 | #endif 14 | 15 | BOOL gCancel = NO; 16 | 17 | int main( 18 | int argc, 19 | char* argv[]) 20 | { 21 | if (OS_IS_PRE_TIGER) 22 | { 23 | fprintf(stderr, "otx requires Mac OS X 10.4 or higher.\n"); 24 | return -1; 25 | } 26 | 27 | int result = 1; 28 | 29 | #ifdef OTX_CLI 30 | NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; 31 | CLIController* controller = 32 | [[CLIController alloc] initWithArgs: argv count: argc]; 33 | 34 | if (controller) 35 | { 36 | [controller processFile]; 37 | [controller release]; 38 | result = noErr; 39 | } 40 | else 41 | result = -1; 42 | 43 | [pool release]; 44 | #else 45 | result = NSApplicationMain(argc, (const char**)argv); 46 | #endif 47 | 48 | return result; 49 | } 50 | -------------------------------------------------------------------------------- /otx/otx_Prefix.pch: -------------------------------------------------------------------------------- 1 | /* 2 | otx_Prefix.pch 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #ifdef __OBJC__ 8 | #import 9 | extern BOOL gCancel; 10 | #endif 11 | 12 | #ifndef NSAppKitVersionNumber10_4 13 | #define NSAppKitVersionNumber10_4 824 14 | #endif 15 | 16 | #ifndef NSAppKitVersionNumber10_6 17 | #define NSAppKitVersionNumber10_6 1038 18 | #endif 19 | 20 | #define OS_IS_PRE_TIGER NSAppKitVersionNumber < NSAppKitVersionNumber10_4 21 | #define OS_IS_POST_TIGER floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_4 22 | #define OS_IS_TIGER (!OS_IS_PRE_TIGER) && (!OS_IS_POST_TIGER) 23 | #define OS_IS_PRE_SNOW NSAppKitVersionNumber < NSAppKitVersionNumber10_6 24 | -------------------------------------------------------------------------------- /otx/source/AppController.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/source/AppController.m -------------------------------------------------------------------------------- /otx/source/CLIController.h: -------------------------------------------------------------------------------- 1 | /* 2 | CLIController.h 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #import 8 | 9 | #import "SharedDefs.h" 10 | #import "ErrorReporter.h" 11 | #import "ProgressReporter.h" 12 | 13 | // Default ProcOptions values 14 | #define SHOW_LOCAL_OFFSETS YES 15 | #define DONT_ENTAB_OUTPUT NO 16 | #define DONT_SHOW_DATA_SECTIONS NO 17 | #define SHOW_CHECKSUM YES 18 | #define SHOW_VERBOSE_MSGSENDS YES 19 | #define DONT_SEPARATE_LOGICAL_BLOCKS NO 20 | #define DEMANGLE_CPP_NAMES YES 21 | #define SHOW_METHOD_RETURN_TYPES YES 22 | #define SHOW_VARIABLE_TYPES YES 23 | #define SHOW_RETURN_STATEMENTS YES 24 | 25 | // ============================================================================ 26 | 27 | @interface CLIController : NSObject 28 | { 29 | @private 30 | NSURL* iOFile; 31 | cpu_type_t iArchSelector; 32 | uint32_t iFileArchMagic; 33 | NSString* iExeName; 34 | BOOL iVerify; 35 | BOOL iShowProgress; 36 | ProcOptions iOpts; 37 | } 38 | 39 | - (id)initWithArgs: (char**)argv 40 | count: (SInt32)argc; 41 | - (void)usage; 42 | - (void)processFile; 43 | - (void)verifyNops; 44 | - (void)newPackageFile: (NSURL*)inPackageFile; 45 | - (void)newOFile: (NSURL*)inOFile 46 | needsPath: (BOOL)inNeedsPath; 47 | 48 | @end 49 | -------------------------------------------------------------------------------- /otx/source/Categories/Arch64Specifics.h: -------------------------------------------------------------------------------- 1 | /* 2 | Arch64Specifics.h 3 | 4 | A category on Exe64Processor that contains most of the 5 | architecture-specific methods. 6 | 7 | This file is in the public domain. 8 | */ 9 | 10 | #import 11 | 12 | #import "Exe64Processor.h" 13 | 14 | @interface Exe64Processor(Arch64Specifics) 15 | 16 | - (void)gatherFuncInfos; 17 | - (void)postProcessCodeLine: (Line64**)ioLine; 18 | - (BOOL)lineIsFunction: (Line64*)inLine; 19 | - (BOOL)codeIsBlockJump: (UInt8*)inCode; 20 | - (void)codeFromLine: (Line64*)inLine; 21 | - (void)checkThunk: (Line64*)inLine; 22 | - (BOOL)getThunkInfo: (ThunkInfo*)outInfo 23 | forLine: (Line64*)inLine; 24 | 25 | - (void)commentForLine: (Line64*)inLine; 26 | - (void)commentForSystemCall; 27 | - (void)commentForMsgSend: (char*)ioComment 28 | fromLine: (Line64*)inLine; 29 | 30 | - (void)resetRegisters: (Line64*)inLine; 31 | - (void)updateRegisters: (Line64*)inLine; 32 | - (BOOL)restoreRegisters: (Line64*)inLine; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /otx/source/Categories/ArchSpecifics.h: -------------------------------------------------------------------------------- 1 | /* 2 | ArchSpecifics.h 3 | 4 | A category on Exe32Processor that contains most of the 5 | architecture-specific methods. 6 | 7 | This file is in the public domain. 8 | */ 9 | 10 | #import 11 | 12 | #import "Exe32Processor.h" 13 | 14 | @interface Exe32Processor(ArchSpecifics) 15 | 16 | - (void)gatherFuncInfos; 17 | - (void)postProcessCodeLine: (Line**)ioLine; 18 | - (BOOL)lineIsFunction: (Line*)inLine; 19 | - (BOOL)codeIsBlockJump: (UInt8*)inCode; 20 | - (void)codeFromLine: (Line*)inLine; 21 | - (void)checkThunk: (Line*)inLine; 22 | - (BOOL)getThunkInfo: (ThunkInfo*)outInfo 23 | forLine: (Line*)inLine; 24 | 25 | - (void)commentForLine: (Line*)inLine; 26 | - (void)commentForSystemCall; 27 | - (void)commentForMsgSend: (char*)ioComment 28 | fromLine: (Line*)inLine; 29 | 30 | - (void)resetRegisters: (Line*)inLine; 31 | - (void)updateRegisters: (Line*)inLine; 32 | - (BOOL)restoreRegisters: (Line*)inLine; 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /otx/source/Categories/List64Utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | List64Utils.h 3 | 4 | A category on Exe64Processor that contains the linked list 5 | manipulation methods. 6 | 7 | This file is in the public domain. 8 | */ 9 | 10 | #import 11 | 12 | #import "Exe64Processor.h" 13 | 14 | @interface Exe64Processor(List64Utils) 15 | 16 | - (void)insertLine: (Line64*)inLine 17 | before: (Line64*)nextLine 18 | inList: (Line64**)listHead; 19 | - (void)insertLine: (Line64*)inLine 20 | after: (Line64*)prevLine 21 | inList: (Line64**)listHead; 22 | - (void)replaceLine: (Line64*)inLine 23 | withLine: (Line64*)newLine 24 | inList: (Line64**)listHead; 25 | - (BOOL)printLinesFromList: (Line64*)listHead; 26 | - (void)deleteLinesFromList: (Line64*)listHead; 27 | - (void)deleteLinesBefore: (Line64*)inLine 28 | fromList: (Line64**)listHead; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /otx/source/Categories/ListUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | ListUtils.h 3 | 4 | A category on Exe32Processor that contains the linked list 5 | manipulation methods. 6 | 7 | This file is in the public domain. 8 | */ 9 | 10 | #import 11 | 12 | #import "Exe32Processor.h" 13 | 14 | @interface Exe32Processor(ListUtils) 15 | 16 | - (void)insertLine: (Line*)inLine 17 | before: (Line*)nextLine 18 | inList: (Line**)listHead; 19 | - (void)insertLine: (Line*)inLine 20 | after: (Line*)prevLine 21 | inList: (Line**)listHead; 22 | - (void)replaceLine: (Line*)inLine 23 | withLine: (Line*)newLine 24 | inList: (Line**)listHead; 25 | - (BOOL)printLinesFromList: (Line*)listHead; 26 | - (void)deleteLinesFromList: (Line*)listHead; 27 | - (void)deleteLinesBefore: (Line*)inLine 28 | fromList: (Line**)listHead; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /otx/source/Categories/Objc64Accessors.h: -------------------------------------------------------------------------------- 1 | /* 2 | Objc64Accessors.h 3 | 4 | What the filename says. 5 | 6 | This file is in the public domain. 7 | */ 8 | 9 | #import 10 | 11 | #import "Exe64Processor.h" 12 | 13 | @interface Exe64Processor(ObjcAccessors) 14 | 15 | - (BOOL)getObjcClassPtr: (objc2_class_t**)outClass 16 | fromMethod: (UInt64)inAddress; 17 | - (BOOL)getObjcMethod: (Method64Info**)outMI 18 | fromAddress: (UInt64)inAddress; 19 | - (BOOL)getObjcMethodList: (objc2_method_list_t*)outList 20 | methods: (objc2_method_t**)outMethods 21 | fromAddress: (UInt64)inAddress; 22 | - (BOOL)getObjcDescription: (char**)outDescription 23 | fromObject: (const char*)inObject 24 | type: (UInt8)inType; 25 | - (BOOL)getObjcClass: (objc2_class_t*)outClass 26 | fromName: (const char*)inName; 27 | - (BOOL)getObjcClassPtr: (objc2_class_t**)outClassPtr 28 | fromName: (const char*)inName; 29 | - (BOOL)getObjcMetaClass: (objc2_class_t*)outClass 30 | fromClass: (objc2_class_t*)inClass; 31 | 32 | @end 33 | -------------------------------------------------------------------------------- /otx/source/Categories/ObjcAccessors.h: -------------------------------------------------------------------------------- 1 | /* 2 | ObjcAccessors.h 3 | 4 | What the filename says. 5 | 6 | This file is in the public domain. 7 | */ 8 | 9 | #import 10 | 11 | #import "Exe32Processor.h" 12 | 13 | @interface Exe32Processor(ObjcAccessors) 14 | 15 | - (BOOL)getObjcClassPtr: (objc_class**)outClass 16 | fromMethod: (uint32_t)inAddress; 17 | - (BOOL)getObjcCatPtr: (objc_category**)outCat 18 | fromMethod: (uint32_t)inAddress; 19 | - (BOOL)getObjcMethod: (MethodInfo**)outMI 20 | fromAddress: (uint32_t)inAddress; 21 | - (BOOL)getObjcMethodList: (objc_method_list*)outList 22 | methods: (objc_method**)outMethods 23 | fromAddress: (uint32_t)inAddress; 24 | - (BOOL)getObjcDescription: (char**)outDescription 25 | fromObject: (const char*)inObject 26 | type: (UInt8)inType; 27 | - (BOOL)getObjcSymtab: (objc_symtab*)outSymTab 28 | defs: (void***)outDefs 29 | fromModule: (objc_module*)inModule; 30 | - (BOOL)getObjcClass: (objc_class*)outClass 31 | fromDef: (uint32_t)inDef; 32 | - (BOOL)getObjcCategory: (objc_category*)outCat 33 | fromDef: (uint32_t)inDef; 34 | - (BOOL)getObjcClass: (objc_class*)outClass 35 | fromName: (const char*)inName; 36 | - (BOOL)getObjcClassPtr: (objc_class**)outClassPtr 37 | fromName: (const char*)inName; 38 | - (BOOL)getObjcMetaClass: (objc_class*)outClass 39 | fromClass: (objc_class*)inClass; 40 | 41 | @end 42 | -------------------------------------------------------------------------------- /otx/source/Categories/ObjectLoader.h: -------------------------------------------------------------------------------- 1 | /* 2 | ObjectLoader.h 3 | 4 | A category on Exe32Processor that contains all the loadXXX methods. 5 | 6 | This file is in the public domain. 7 | */ 8 | 9 | #import 10 | 11 | #import "Exe32Processor.h" 12 | 13 | @interface Exe32Processor(ObjectLoader) 14 | 15 | - (BOOL)loadMachHeader; 16 | - (void)loadLCommands; 17 | - (void)loadSegment: (segment_command*)inSegPtr; 18 | - (void)loadSymbols: (symtab_command*)inSymPtr; 19 | - (void)loadObjcSection: (section*)inSect; 20 | - (void)loadObjcModules; 21 | - (void)loadCStringSection: (section*)inSect; 22 | - (void)loadNSStringSection: (section*)inSect; 23 | - (void)loadClassSection: (section*)inSect; 24 | - (void)loadMetaClassSection: (section*)inSect; 25 | - (void)loadIVarSection: (section*)inSect; 26 | - (void)loadObjcModSection: (section*)inSect; 27 | - (void)loadObjcSymSection: (section*)inSect; 28 | - (void)loadLit4Section: (section*)inSect; 29 | - (void)loadLit8Section: (section*)inSect; 30 | - (void)loadTextSection: (section*)inSect; 31 | - (void)loadCoalTextSection: (section*)inSect; 32 | - (void)loadCoalTextNTSection: (section*)inSect; 33 | - (void)loadConstTextSection: (section*)inSect; 34 | - (void)loadDataSection: (section*)inSect; 35 | - (void)loadCoalDataSection: (section*)inSect; 36 | - (void)loadCoalDataNTSection: (section*)inSect; 37 | - (void)loadConstDataSection: (section*)inSect; 38 | - (void)loadDyldDataSection: (section*)inSect; 39 | - (void)loadCFStringSection: (section*)inSect; 40 | - (void)loadNonLazySymbolSection: (section*)inSect; 41 | - (void)loadImpPtrSection: (section*)inSect; 42 | 43 | @end 44 | -------------------------------------------------------------------------------- /otx/source/Categories/Searchers.h: -------------------------------------------------------------------------------- 1 | /* 2 | Searchers.h 3 | 4 | A category on Exe32Processor that contains the various binary search 5 | methods. 6 | 7 | This file is in the public domain. 8 | */ 9 | 10 | #import 11 | 12 | #import "Exe32Processor.h" 13 | 14 | @interface Exe32Processor(Searchers) 15 | 16 | - (char*)findSymbolByAddress: (uint32_t)inAddress; 17 | - (BOOL)findClassMethod: (MethodInfo**)outMI 18 | byAddress: (uint32_t)inAddress; 19 | - (BOOL)findCatMethod: (MethodInfo**)outMI 20 | byAddress: (uint32_t)inAddress; 21 | - (BOOL)findIvar: (objc_ivar*)outIvar 22 | inClass: (objc_class*)inClass 23 | withOffset: (uint32_t)inOffset; 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /otx/source/Categories/Searchers64.h: -------------------------------------------------------------------------------- 1 | /* 2 | Searchers64.h 3 | 4 | A category on Exe64Processor that contains the various binary search 5 | methods. 6 | 7 | This file is in the public domain. 8 | */ 9 | 10 | #import 11 | 12 | #import "Exe64Processor.h" 13 | 14 | @interface Exe64Processor(Searchers64) 15 | 16 | - (char*)findSymbolByAddress: (uint64_t)inAddress; 17 | - (BOOL)findClassMethod: (Method64Info**)outMI 18 | byAddress: (UInt64)inAddress; 19 | - (BOOL)findIvar: (objc2_ivar_t**)outIvar 20 | inClass: (objc2_class_t*)inClass 21 | withOffset: (UInt64)inOffset; 22 | 23 | @end 24 | -------------------------------------------------------------------------------- /otx/source/Categories/SysUtils.h: -------------------------------------------------------------------------------- 1 | /* 2 | SysUtils.h 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #import 8 | 9 | @interface NSObject(SysUtils) 10 | 11 | - (BOOL)checkOtool: (NSString*)filePath; 12 | - (NSString*)pathForTool: (NSString*)toolName; 13 | 14 | @end -------------------------------------------------------------------------------- /otx/source/ObjcSwap.h: -------------------------------------------------------------------------------- 1 | /* 2 | ObjcSwap.h 3 | 4 | Functions adapted from cctools-590/otool/print_objc.c 5 | 6 | This file is in the public domain. 7 | */ 8 | 9 | void swap_objc_module(objc_module* module); 10 | void swap_objc_symtab(objc_symtab* symtab); 11 | void swap_objc_class(objc_class* oc); 12 | void swap_objc_ivar(objc_ivar* oi); 13 | void swap_objc_category(objc_category* oc); 14 | void swap_objc_method_list(objc_method_list* ml); 15 | void swap_objc_method(objc_method* m); 16 | -------------------------------------------------------------------------------- /otx/source/Processors/ExeProcessor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/source/Processors/ExeProcessor.h -------------------------------------------------------------------------------- /otx/source/Processors/ExeProcessor.m: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rentzsch/MagicHat/410b8840c1fec54b6db0bd438fc8af4943298324/otx/source/Processors/ExeProcessor.m -------------------------------------------------------------------------------- /otx/source/Processors/PPC64Processor.h: -------------------------------------------------------------------------------- 1 | /* 2 | PPC64Processor.h 3 | 4 | A subclass of Exe64Processor that handles PPC64-specific issues. 5 | 6 | This file is in the public domain. 7 | */ 8 | 9 | #import 10 | 11 | #import "Exe64Processor.h" 12 | 13 | #define MB64(x) ((((x) >> 6) & 0x1f) | (x) & 0x20) // bits 5 - 10, split 14 | #define SH(x) ((((x) >> 12) & 0x0f) | ((x) >> 7) & 0x10) // bits 11 - 15, split 15 | #define DS(x) (SInt64)(BD((x))) // bits 2 - 15 16 | 17 | // ============================================================================ 18 | 19 | @interface PPC64Processor : Exe64Processor 20 | { 21 | GP64RegisterInfo iRegInfos[32]; 22 | GP64RegisterInfo iLR; 23 | GP64RegisterInfo iCTR; 24 | 25 | Var64Info* iLocalSelves; // 'self' copied to local variables 26 | uint32_t iNumLocalSelves; 27 | Var64Info* iLocalVars; 28 | uint32_t iNumLocalVars; 29 | } 30 | 31 | @end 32 | -------------------------------------------------------------------------------- /otx/source/Processors/X8664Processor.h: -------------------------------------------------------------------------------- 1 | /* 2 | X8664Processor.h 3 | 4 | A subclass of Exe64Processor that handles x86_64-specific issues. 5 | 6 | This file is in the public domain. 7 | */ 8 | 9 | #import 10 | 11 | #import "Exe64Processor.h" 12 | #import "Deobfuscator.h" 13 | 14 | #define REX_BIT_ON (1 << 3) 15 | #define REX_BIT_OFF 0 16 | 17 | /*#define REX_W(r) ((r) >> 3 & 0x1) 18 | #define REX_R(r) ((r) >> 2 & 0x1) // extends "REG1" 19 | #define REX_X(r) ((r) >> 1 & 0x1) 20 | #define REX_B(r) ((r) & 0x1) // extends "REG2"*/ 21 | 22 | #define REX_W(x) ((x) & 0x8) 23 | #define REX_R(x) ((x) & 0x4) // extends "REG1" 24 | #define REX_X(x) ((x) & 0x2) 25 | #define REX_B(x) ((x) & 0x1) // extends "REG2" 26 | 27 | #define XREG1(n, x) (REG1((n)) | (REX_R((x)) << 1)) 28 | #define XREG2(n, x) (REG2((n)) | (REX_B(x) << 3)) 29 | 30 | // Extended register identifiers in r/m field of mod r/m byte 31 | enum { 32 | R8 = 8, 33 | R9, 34 | R10, 35 | R11, 36 | R12, 37 | R13, 38 | R14, 39 | R15 40 | }; 41 | 42 | // ============================================================================ 43 | 44 | @interface X8664Processor : Exe64Processor 45 | { 46 | GP64RegisterInfo iStack[MAX_STACK_SIZE]; 47 | GP64RegisterInfo iRegInfos[16]; 48 | 49 | Var64Info* iLocalSelves; // 'self' copied to local variables 50 | uint32_t iNumLocalSelves; 51 | Var64Info* iLocalVars; 52 | uint32_t iNumLocalVars; 53 | UInt64 iHighestJumpTarget; 54 | } 55 | 56 | @end 57 | -------------------------------------------------------------------------------- /otx/source/Protocols/Deobfuscator.h: -------------------------------------------------------------------------------- 1 | /* 2 | Deobfuscator.h 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #import 8 | 9 | /* NopList 10 | 11 | 'list' is a 'count'-sized array of addresses at which an obfuscated 12 | sequence of nops was found. 13 | */ 14 | typedef struct NopList 15 | { 16 | unsigned char** list; 17 | uint32_t count; 18 | } 19 | NopList; 20 | 21 | // ============================================================================ 22 | 23 | @protocol Deobfuscator 24 | 25 | - (BOOL)verifyNops: (unsigned char***)outList 26 | numFound: (uint32_t*)outFound; 27 | - (unsigned char**)searchForNopsIn: (unsigned char*)inHaystack 28 | ofLength: (uint32_t)inHaystackLength 29 | numFound: (uint32_t*)outFound; 30 | - (NSURL*)fixNops: (NopList*)inList 31 | toPath: (NSString*)inOutputFilePath; 32 | 33 | @end 34 | -------------------------------------------------------------------------------- /otx/source/Protocols/ErrorReporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ErrorReporter.h 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #import 8 | 9 | @protocol ErrorReporter 10 | 11 | - (void)reportError: (NSString*)inMessageText 12 | suggestion: (NSString*)inInformativeText; 13 | 14 | @end -------------------------------------------------------------------------------- /otx/source/Protocols/ProgressReporter.h: -------------------------------------------------------------------------------- 1 | /* 2 | ProgressReporter.h 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #import 8 | 9 | #define PRValueKey @"PRValueKey" // NSNumber* (double) 10 | #define PRIndeterminateKey @"PRIndeterminateKey" // NSNumber* (BOOL) 11 | #define PRNewLineKey @"PRNewLineKey" // NSNumber* (BOOL) 12 | #define PRCompleteKey @"PRCompleteKey" // NSNumber* (BOOL) 13 | #define PRDescriptionKey @"PRDescriptionKey" // NSString* 14 | 15 | @protocol ProgressReporter 16 | 17 | - (void)reportProgress: (NSDictionary*)inState; 18 | 19 | @end 20 | -------------------------------------------------------------------------------- /otx/source/SharedDefs.h: -------------------------------------------------------------------------------- 1 | /* 2 | SharedDefs.h 3 | 4 | Definitions shared by GUI and CLI targets. 5 | 6 | This file is in the public domain. 7 | */ 8 | 9 | /* ProcOptions 10 | 11 | Options for processing executables. GUI target sets these using 12 | NSUserDefaults, CLI target sets them with command line arguments. This 13 | is necessary for the CLI target to behave consistently across 14 | invocations, and to keep it from altering the GUI target's prefs. 15 | */ 16 | typedef struct 17 | { // CLI flags 18 | BOOL localOffsets; // l 19 | BOOL entabOutput; // e 20 | BOOL dataSections; // d 21 | BOOL checksum; // c 22 | BOOL verboseMsgSends; // m 23 | BOOL separateLogicalBlocks; // b 24 | BOOL demangleCppNames; // n 25 | BOOL returnTypes; // r 26 | BOOL variableTypes; // v 27 | BOOL returnStatements; // R 28 | } 29 | ProcOptions; 30 | -------------------------------------------------------------------------------- /otx/source/SmoothViewAnimation.h: -------------------------------------------------------------------------------- 1 | /* 2 | SmoothViewAnimation.h 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #import 8 | 9 | @interface SmoothViewAnimation : NSViewAnimation 10 | { 11 | @private 12 | NSWindow* iWindow; 13 | } 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /otx/source/UserDefaultKeys.h: -------------------------------------------------------------------------------- 1 | /* 2 | UserDefaultKeys.h 3 | 4 | This file is in the public domain. 5 | */ 6 | 7 | #define AskOutputDirKey @"AskOutputDir" 8 | #define DemangleCppNamesKey @"DemangleCppNames" 9 | #define EntabOutputKey @"EntabOutput" 10 | #define OpenOutputFileKey @"OpenOutputFile" 11 | #define OutputAppKey @"OutputApp" 12 | #define OutputFileExtensionKey @"OutputFileExtension" 13 | #define OutputFileNameKey @"OutputFileName" 14 | #define SeparateLogicalBlocksKey @"SeparateLogicalBlocks" 15 | #define ShowDataSectionKey @"ShowDataSection" 16 | #define ShowIvarTypesKey @"ShowIvarTypes" 17 | #define ShowLocalOffsetsKey @"ShowLocalOffsets" 18 | #define ShowMD5Key @"ShowMD5" 19 | #define ShowMethodReturnTypesKey @"ShowMethodReturnTypes" 20 | #define ShowReturnStatementsKey @"ShowReturnStatements" 21 | #define UseCustomNameKey @"UseCustomName" 22 | #define VerboseMsgSendsKey @"VerboseMsgSends" 23 | -------------------------------------------------------------------------------- /rb_main.rb: -------------------------------------------------------------------------------- 1 | # 2 | # rb_main.rb 3 | # MagicHat 4 | # 5 | # Created by wolf on 12/27/09. 6 | # Copyright Red Shed Software Company 2009. All rights reserved. 7 | # 8 | 9 | # Loading the Cocoa framework. If you need to load more frameworks, you can 10 | # do that here too. 11 | framework 'Cocoa' 12 | framework 'CoreData' 13 | 14 | # Loading all the Ruby project files. 15 | dir_path = NSBundle.mainBundle.resourcePath.fileSystemRepresentation 16 | Dir.entries(dir_path).each do |path| 17 | if path != File.basename(__FILE__) and path[-3..-1] == '.rb' 18 | require(path) 19 | end 20 | end 21 | 22 | # Starting the Cocoa main loop. 23 | NSApplicationMain(0, nil) 24 | --------------------------------------------------------------------------------