├── APPLE_LICENSE ├── Makefile ├── PB.project ├── 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 ├── pathnames.h ├── print.c └── replace.c ├── as ├── COPYING ├── Makefile ├── app.c ├── app.h ├── arch64_32.h ├── arm-check.c ├── arm.c ├── arm_reloc.h ├── 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 ├── 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 ├── efitools ├── Makefile ├── makerelocs.c └── mtoc.c ├── gprof ├── Makefile ├── arcs.c ├── calls.c ├── dfn.c ├── getnfile.c ├── gprof.c ├── gprof.callg ├── gprof.flat ├── gprof.h ├── hertz.c ├── lookup.c ├── m68k.h ├── 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 ├── i386 │ └── eflags.h ├── llvm-c │ └── Disassembler.h ├── mach-o │ ├── arch.h │ ├── arm │ │ └── reloc.h │ ├── arm64 │ │ └── 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 │ │ ├── _structs.h │ │ ├── thread_state.h │ │ └── thread_status.h │ ├── hppa │ │ └── thread_status.h │ ├── i386 │ │ ├── _structs.h │ │ ├── fp_reg.h │ │ ├── thread_state.h │ │ └── thread_status.h │ ├── i860 │ │ └── thread_status.h │ ├── m68k │ │ └── thread_status.h │ ├── m88k │ │ └── thread_status.h │ ├── machine.h │ ├── ppc │ │ ├── _structs.h │ │ └── thread_status.h │ └── sparc │ │ └── thread_status.h ├── 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 │ ├── llvm.h │ ├── lto.h │ ├── macosx_deployment_target.h │ ├── ofile.h │ ├── openstep_mach.h │ ├── print.h │ ├── reloc.h │ ├── rnd.h │ ├── seg_addr_table.h │ ├── symbol.h │ ├── symbol_list.h │ ├── unix_standard_mode.h │ ├── version_number.h │ └── vm_flush_cache.h ├── sys │ └── gmon.h └── xar │ └── xar.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 ├── 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 ├── ppc_swap.c ├── shlib.ofileList ├── slot_name.c ├── 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 ├── llvm.c ├── lto.c ├── macosx_deployment_target.c ├── ofile.c ├── ofile_error.c ├── ofile_get_word.c ├── print.c ├── reloc.c ├── rnd.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 ├── bitcode_strip.1 ├── check_dylib.1 ├── checksyms.1 ├── cmpdylib.1 ├── codesign_allocate.1 ├── ctf_insert.1 ├── dyld.1 ├── dyld.3 ├── dyld_debug.3 ├── end.3 ├── get_end.3 ├── getsectbyname.3 ├── getsectbynamefromheader.3 ├── getsectdata.3 ├── getsectdatafromheader.3 ├── getsegbyname.3 ├── indr.1 ├── install_name_tool.1 ├── kld.3 ├── libsyminfo.3 ├── libtool.1 ├── lipo.1 ├── mtoc.1 ├── nm.1 ├── nmedit.1 ├── 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 ├── bitcode_strip.c ├── check_dylib.c ├── checksyms.c ├── cmpdylib.c ├── codesign_allocate.c ├── ctf_insert.c ├── indr.c ├── inout.c ├── install_name_tool.c ├── libtool.c ├── lipo.c ├── nm.c ├── pagestuff.c ├── redo_prebinding.c ├── seg_addr_table.c ├── seg_hack.c ├── segedit.c ├── size.c ├── strings.c └── strip.c └── otool ├── Makefile ├── arm64_disasm.c ├── arm64_disasm.h ├── arm_disasm.c ├── arm_disasm.h ├── coff_print.c ├── cxa_demangle.h ├── dyld_bind_info.c ├── dyld_bind_info.h ├── 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 ├── notify.c ├── notify.h ├── ofile_print.c ├── ofile_print.h ├── otool.h ├── ppc_disasm.c ├── ppc_disasm.h ├── print_bitcode.c ├── print_objc.c ├── print_objc2_32bit.c ├── print_objc2_64bit.c ├── sparc_disasm.c └── sparc_disasm.h /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 | -------------------------------------------------------------------------------- /ar/Makefile: -------------------------------------------------------------------------------- 1 | ifneq "" "$(SDKROOT)" 2 | SDK = -isysroot $(SDKROOT) 3 | CC = $(shell xcrun -find -sdk $(SDKROOT) cc) 4 | DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) 5 | else 6 | DSYMUTIL = dsymutil 7 | endif 8 | 9 | OFLAG = -Os 10 | CFLAGS = -g $(OFLAG) -Wall -I$(SRCROOT)/../include $(SDK) 11 | LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff 12 | MKDIRS = /bin/mkdir -p 13 | SRCROOT = . 14 | OBJROOT = . 15 | SYMROOT = . 16 | OFILE_DIR = $(OBJROOT) 17 | VPATH = $(OFILE_DIR) 18 | 19 | BINDIR = /usr/bin 20 | MANDIR = /usr/share/man 21 | DSTDIRS = $(DSTROOT)$(BINDIR) $(DSTROOT)$(MANDIR)/man1 $(DSTROOT)$(MANDIR)/man5 22 | 23 | HFILES = archive.h extern.h pathnames.h 24 | CFILES = append.c ar.c archive.c contents.c delete.c extract.c misc.c move.c \ 25 | print.c replace.c 26 | MAN1 = ar.1 27 | MAN5 = ar.5 28 | OBJS = $(CFILES:.c=.o) 29 | INSTALL_FILES = $(CFILES) $(HFILES) $(MAN1) $(MAN5) Makefile notes 30 | 31 | PRODUCT = ar 32 | 33 | all: $(OFILE_DIR) $(SYMROOT) $(PRODUCT).NEW 34 | 35 | $(PRODUCT).NEW: $(OFILE_DIR) $(SYMROOT) $(OBJS) 36 | $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/$@ $(OBJS) $(LIBSTUFF) 37 | $(DSYMUTIL) $(SYMROOT)/$@ 38 | 39 | .c.o: 40 | $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c -o $(OFILE_DIR)/$*.o $< 41 | 42 | clean: shlib_clean 43 | -rm -f $(SYMROOT)/$(PRODUCT).NEW 44 | -rm -r -f *dSYM 45 | 46 | shlib_clean: 47 | -cd $(OFILE_DIR); rm -f $(OBJS) 48 | -rm -f make.out 49 | 50 | install: all $(DSTDIRS) 51 | install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ 52 | $(DSTROOT)$(BINDIR)/$(PRODUCT) 53 | install -c -m 444 $(MAN1) $(DSTROOT)$(MANDIR)/man1 54 | install -c -m 444 $(MAN5) $(DSTROOT)$(MANDIR)/man5 55 | 56 | installsrc: 57 | $(MKDIRS) $(SRCROOT) 58 | chmod 755 $(SRCROOT) 59 | gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) 60 | chmod 444 $(SRCROOT)/* 61 | 62 | $(OFILE_DIR) $(SYMROOT) $(DSTDIRS): 63 | $(MKDIRS) $@ 64 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /as/arm_reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * These #defines are needed in arm.c and write_object.c to create the 3 | * the mach-o arm relocation r_types ARM_RELOC_HALF and ARM_RELOC_HALF_SECTDIFF. 4 | * The values are internal but can't over lap any of the 4 bit r_type values 5 | * they they are outside that 4 bit range. But they are picked so we can use 6 | * the low two bits for the r_length encoding. 7 | */ 8 | 9 | /* internal assembler value for BFD_RELOC_ARM_MOVW */ 10 | #define ARM_RELOC_LO16 0x70 11 | /* r_length - low bit is 0 for :lower16:, high bit is 0 for arm instruction */ 12 | 13 | /* internal assembler value for BFD_RELOC_ARM_MOVT */ 14 | #define ARM_RELOC_HI16 0x71 15 | /* r_length - low bit is 1 for :upper16:, high bit is 0 for arm instruction */ 16 | 17 | /* internal assembler value for BFD_RELOC_ARM_THUMB_MOVW */ 18 | #define ARM_THUMB_RELOC_LO16 0x72 19 | /* r_length - low bit is 0 for :lower16:, high bit is 1 for thumb instruction */ 20 | 21 | /* internal assembler value for BFD_RELOC_ARM_THUMB_MOVT */ 22 | #define ARM_THUMB_RELOC_HI16 0x73 23 | /* r_length - low bit is 1 for :upper16:, high bit is 1 for thumb instruction */ 24 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /as/bignum.h: -------------------------------------------------------------------------------- 1 | /* bignum.h-arbitrary precision integers 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 | /***********************************************************************\ 21 | * * 22 | * Arbitrary-precision integer arithmetic. * 23 | * For speed, we work in groups of bits, even though this * 24 | * complicates algorithms. * 25 | * Each group of bits is called a 'littlenum'. * 26 | * A bunch of littlenums representing a (possibly large) * 27 | * integer is called a 'bignum'. * 28 | * Bignums are >= 0. * 29 | * * 30 | \***********************************************************************/ 31 | 32 | #define LITTLENUM_NUMBER_OF_BITS (16) 33 | #define LITTLENUM_RADIX (1 << LITTLENUM_NUMBER_OF_BITS) 34 | #define LITTLENUM_MASK (0xFFFF) 35 | #define LITTLENUM_SHIFT (1) 36 | #define CHARS_PER_LITTLENUM (1 << LITTLENUM_SHIFT) 37 | #ifndef BITS_PER_CHAR 38 | #define BITS_PER_CHAR (8) 39 | #endif 40 | 41 | typedef unsigned short int LITTLENUM_TYPE; 42 | 43 | 44 | /* JF truncated this to get around a problem with GCC */ 45 | #define LOG_TO_BASE_2_OF_10 (3.3219280948873623478703194294893901758651) 46 | /* WARNING: I haven't checked that the trailing digits are correct! */ 47 | -------------------------------------------------------------------------------- /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 | OpenSourceURL 19 | http://ftp.gnu.org/gnu/binutils/binutils-1.38.1.tar.gz 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /as/filenames.h: -------------------------------------------------------------------------------- 1 | /* Macros for taking apart, interpreting and processing file names. 2 | 3 | These are here because some non-Posix (a.k.a. DOSish) systems have 4 | drive letter brain-damage at the beginning of an absolute file name, 5 | use forward- and back-slash in path names interchangeably, and 6 | some of them have case-insensitive file names. 7 | 8 | Copyright 2000, 2001, 2007 Free Software Foundation, Inc. 9 | 10 | This file is part of BFD, the Binary File Descriptor library. 11 | 12 | This program is free software; you can redistribute it and/or modify 13 | it under the terms of the GNU General Public License as published by 14 | the Free Software Foundation; either version 2 of the License, or 15 | (at your option) any later version. 16 | 17 | This program is distributed in the hope that it will be useful, 18 | but WITHOUT ANY WARRANTY; without even the implied warranty of 19 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 | GNU General Public License for more details. 21 | 22 | You should have received a copy of the GNU General Public License 23 | along with this program; if not, write to the Free Software 24 | Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ 25 | 26 | #ifndef FILENAMES_H 27 | #define FILENAMES_H 28 | 29 | #if defined(__MSDOS__) || defined(_WIN32) || defined(__OS2__) || defined (__CYGWIN__) 30 | 31 | #ifndef HAVE_DOS_BASED_FILE_SYSTEM 32 | #define HAVE_DOS_BASED_FILE_SYSTEM 1 33 | #endif 34 | 35 | #define IS_DIR_SEPARATOR(c) ((c) == '/' || (c) == '\\') 36 | /* Note that IS_ABSOLUTE_PATH accepts d:foo as well, although it is 37 | only semi-absolute. This is because the users of IS_ABSOLUTE_PATH 38 | want to know whether to prepend the current working directory to 39 | a file name, which should not be done with a name like d:foo. */ 40 | #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0]) || (((f)[0]) && ((f)[1] == ':'))) 41 | 42 | #else /* not DOSish */ 43 | 44 | #define IS_DIR_SEPARATOR(c) ((c) == '/') 45 | #define IS_ABSOLUTE_PATH(f) (IS_DIR_SEPARATOR((f)[0])) 46 | 47 | #endif /* not DOSish */ 48 | 49 | extern int filename_cmp (const char *s1, const char *s2); 50 | #define FILENAME_CMP(s1, s2) filename_cmp(s1, s2) 51 | 52 | #endif /* FILENAMES_H */ 53 | -------------------------------------------------------------------------------- /as/flonum-copy.c: -------------------------------------------------------------------------------- 1 | /* flonum_copy.c - copy a flonum 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 "flonum.h" 22 | 23 | void 24 | flonum_copy( 25 | FLONUM_TYPE *in, 26 | FLONUM_TYPE *out) 27 | { 28 | int in_length; /* 0 origin */ 29 | int out_length; /* 0 origin */ 30 | 31 | out -> sign = in -> sign; 32 | in_length = in -> leader - in -> low; 33 | if (in_length < 0) 34 | { 35 | out -> leader = out -> low - 1; /* 0.0 case */ 36 | } 37 | else 38 | { 39 | out_length = out -> high - out -> low; 40 | /* 41 | * Assume no GAPS in packing of littlenums. 42 | * I.e. sizeof(array) == sizeof(element) * number_of_elements. 43 | */ 44 | if (in_length <= out_length) 45 | { 46 | { 47 | /* 48 | * For defensive programming, zero any high-order littlenums we don't need. 49 | * This is destroying evidence and wasting time, so why bother??? 50 | */ 51 | if (in_length < out_length) 52 | { 53 | memset((char *)(out->low + in_length + 1), '\0', 54 | out_length - in_length); 55 | } 56 | } 57 | memcpy((char *)(out->low), (char *)(in->low), 58 | (int)((in_length + 1) * sizeof(LITTLENUM_TYPE))); 59 | out -> exponent = in -> exponent; 60 | out -> leader = in -> leader - in -> low + out -> low; 61 | } 62 | else 63 | { 64 | int shorten; /* 1-origin. Number of littlenums we drop. */ 65 | 66 | shorten = in_length - out_length; 67 | /* Assume out_length >= 0 ! */ 68 | memcpy((char *)(out->low), (char *)(in->low + shorten), 69 | (int)((out_length + 1) * sizeof(LITTLENUM_TYPE))); 70 | out -> leader = out -> high; 71 | out -> exponent = in -> exponent + shorten; 72 | } 73 | } /* if any significant bits */ 74 | } 75 | 76 | /* end: flonum_copy.c */ 77 | -------------------------------------------------------------------------------- /as/hex-value.c: -------------------------------------------------------------------------------- 1 | /* hex_value.c - char=>radix-value - 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 | /* 21 | * Export: Hex_value[]. Converts digits to their radix-values. 22 | * As distributed assumes 8 bits per char (256 entries) and ASCII. 23 | */ 24 | 25 | #define __ (42) /* blatently illegal digit value */ 26 | /* exceeds any normal radix */ 27 | char 28 | hex_value [256] = { /* for fast ASCII -> binary */ 29 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 30 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 31 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 32 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, __, __, __, __, __, __, 33 | __, 10, 11, 12, 13, 14, 15, __, __, __, __, __, __, __, __, __, 34 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 35 | __, 10, 11, 12, 13, 14, 15, __, __, __, __, __, __, __, __, __, 36 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 37 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 38 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 39 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 40 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 41 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 42 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 43 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, 44 | __, __, __, __, __, __, __, __, __, __, __, __, __, __, __, __ 45 | }; 46 | 47 | /* end:hex_value.c */ 48 | -------------------------------------------------------------------------------- /as/hex_value.h: -------------------------------------------------------------------------------- 1 | extern char hex_value[]; 2 | -------------------------------------------------------------------------------- /as/input-file.h: -------------------------------------------------------------------------------- 1 | /* input_file.h header for input-file.c 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 | /*"input_file.c":Operating-system dependant functions to read source files.*/ 21 | 22 | 23 | /* 24 | * No matter what the operating system, this module must provide the 25 | * following services to its callers. 26 | * 27 | * input_file_begin() Call once before anything else. 28 | * 29 | * input_file_end() Call once after everything else. 30 | * 31 | * input_file_buffer_size() Call anytime. Returns largest possible 32 | * delivery from 33 | * input_file_give_next_buffer(). 34 | * 35 | * input_file_open(name) Call once for each input file. 36 | * 37 | * input_file_give_next_buffer(where, Call once to get each new buffer. 38 | * give_next_size) Return 0: no more chars left in file, 39 | * the file has already been closed. 40 | * Otherwise: return a pointer to just 41 | * after the last character we read 42 | * into the buffer. 43 | * If we can only read 0 characters, then 44 | * end-of-file is faked. 45 | * give_next_size is the BUFFER_SIZE it 46 | * will use next. 47 | * 48 | * All errors are reported (using as_perror) so caller doesn't have to think 49 | * about I/O errors. No I/O errors are fatal: an end-of-file may be faked. 50 | */ 51 | extern FILE *f_in; 52 | extern char *file_name; 53 | 54 | #ifdef SUSPECT 55 | extern int preprocess; 56 | #endif 57 | 58 | extern void input_file_begin( 59 | void); 60 | extern void input_file_end( 61 | void); 62 | extern int input_file_buffer_size( 63 | void); 64 | extern int input_file_is_open( 65 | void); 66 | extern void input_file_open( 67 | char *filename, 68 | int pre); 69 | extern char *input_file_give_next_buffer( 70 | char *where, 71 | int *give_next_size); 72 | -------------------------------------------------------------------------------- /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 char *find_an_include_file( 49 | char *no_path_name); 50 | extern void read_an_include_file( 51 | char *no_path_name); 52 | -------------------------------------------------------------------------------- /as/layout.h: -------------------------------------------------------------------------------- 1 | extern void add_last_frags_to_sections( 2 | void); 3 | extern void layout_addresses( 4 | void); 5 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /as/relax.h: -------------------------------------------------------------------------------- 1 | /* The type used for a target address */ 2 | #ifdef ARCH64 3 | typedef uint64_t relax_addressT; 4 | #else 5 | typedef uint32_t relax_addressT; 6 | #endif 7 | 8 | /* 9 | * relax_stateT is a fragment's type and stored in a struct frag's fr_type 10 | * field. 11 | */ 12 | typedef enum { 13 | rs_fill, /* Variable chars to be repeated fr_offset */ 14 | /* times. Fr_symbol unused. */ 15 | /* Used with fr_offset == 0 for a constant */ 16 | /* length frag. */ 17 | rs_align, /* Align: Fr_offset: power of 2. */ 18 | /* 1 variable char: fill character. */ 19 | rs_org, /* Org: Fr_offset, fr_symbol: address. */ 20 | /* 1 variable char: fill character. */ 21 | rs_machine_dependent, 22 | rs_dwarf2dbg, 23 | rs_leb128 /* leb128 value, subtype is 0 for 1 for signed. */ 24 | } relax_stateT; 25 | 26 | /* 27 | * For machine dependent fragments, a struct frag's who's fr_type field is 28 | * rs_machine_dependent it's substate is stored in the struct frag's fr_subtype; 29 | * field. The substate is used to index in to md_relax_table by relax_section() 30 | * in layout.c to drive the span dependent branch algorithm of the assembler. 31 | * The substate is a machine dependent indication of what type of branch 32 | * instruction this fragment is. 33 | */ 34 | typedef uint32_t relax_substateT; 35 | 36 | /* 37 | * relax_typeS is the structure that is the entry in the md_relax_table array. 38 | * It is indexed into by the substate of a fragment for machine depependent 39 | * branches that have variable sizes. The entry tell how far this branch can 40 | * reach, rlx_forward and rlx_backward, as well as the size of branch, 41 | * rlx_length, and which substate go to, rlx_more, if this sized branch can't 42 | * reach it's target. 43 | */ 44 | typedef struct relax_type { 45 | int32_t rlx_forward; /* Forward reach. Signed number. > 0. */ 46 | int32_t rlx_backward; /* Backward reach. Signed number. < 0. */ 47 | unsigned char rlx_length; /* Bytes length of this address. */ 48 | relax_substateT rlx_more; /* Next longer relax-state. */ 49 | /* 0 means there is no 'next' relax-state. */ 50 | } relax_typeS; 51 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /cbtlibs/Makefile: -------------------------------------------------------------------------------- 1 | RC_OS = macos 2 | OFLAG = -Os 3 | ifneq "" "$(SDKROOT)" 4 | SDK = -isysroot $(SDKROOT) 5 | CC = $(shell xcrun -find -sdk $(SDKROOT) cc) 6 | LIBTOOL = $(shell xcrun -find -sdk $(SDKROOT) libtool) 7 | RANLIB = $(shell xcrun -find -sdk $(SDKROOT) ranlib) 8 | else 9 | LIBTOOL = libtool 10 | RANLIB = ranlib 11 | endif 12 | 13 | CFLAGS = $(OFLAG) -g -I$(SRCROOT)/../include -Wall $(SDK) 14 | MKDIRS = /bin/mkdir -p 15 | SRCROOT = . 16 | SYMROOT = . 17 | OBJROOT = . 18 | OFILE_DIR = $(OBJROOT) 19 | VPATH = $(OFILE_DIR) 20 | 21 | CFILES = libsyminfo.c 22 | OBJS = $(CFILES:.c=.o) 23 | INSTALL_FILES = $(CFILES) Makefile notes 24 | LOCLIBDIR = /usr/local/lib 25 | LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff 26 | 27 | all: $(OFILE_DIR) $(SYMROOT) lib_ofiles 28 | 29 | lib_ofiles: $(OFILE_DIR) $(SYMROOT) libsyminfo.a 30 | 31 | .c.o: 32 | $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c -o $(OFILE_DIR)/$*.o $< 33 | 34 | clean shlib_clean: 35 | -rm -r -f $(OFILE_DIRS) 36 | -rm -f libsyminfo.a libsyminfo.o libsyminfo.o.tmp 37 | -rm -r -f *dSYM 38 | 39 | install: all 40 | 41 | installsrc: 42 | $(MKDIRS) $(SRCROOT) 43 | chmod 755 $(SRCROOT) 44 | gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) 45 | chmod 444 $(SRCROOT)/* 46 | 47 | $(SYMROOT): 48 | $(MKDIRS) $@ 49 | 50 | libsyminfo.o: libsyminfo.c 51 | $(CC) $(CFLAGS) $(RC_CFLAGS) -c \ 52 | -o $(OFILE_DIR)/$*.o $(SRCROOT)/libsyminfo.c -DLIBRARY_API 53 | 54 | libsyminfo.a: libsyminfo.o 55 | $(CC) $(RC_CFLAGS) -nostdlib -r \ 56 | -o $(OBJROOT)/libsyminfo.o.tmp \ 57 | libsyminfo.o $(LIBSTUFF) 58 | $(LIBTOOL) -static -o $(SYMROOT)/libsyminfo.a \ 59 | $(OBJROOT)/libsyminfo.o.tmp 60 | 61 | 62 | lib_ofiles_install: lib_ofiles 63 | $(MKDIRS) $(DSTROOT)$(LOCLIBDIR) 64 | install -p -c -m 444 $(SYMROOT)/libsyminfo.a \ 65 | $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a 66 | $(RANLIB) $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a 67 | 68 | $(OFILE_DIR) $(SYMROOT): 69 | $(MKDIRS) $@ 70 | -------------------------------------------------------------------------------- /efitools/Makefile: -------------------------------------------------------------------------------- 1 | export USE_APPLE_PB_SUPPORT = all 2 | RC_OS = macos 3 | ifneq "" "$(SDKROOT)" 4 | SDK = -isysroot $(SDKROOT) 5 | CC = $(shell xcrun -find -sdk $(SDKROOT) cc) 6 | DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) 7 | else 8 | DSYMUTIL = dsymutil 9 | endif 10 | 11 | OFLAG = -Os 12 | CFLAGS = $(OFLAG) -g -Wall \ 13 | -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) 14 | LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff 15 | MKDIRS = /bin/mkdir -p 16 | 17 | SRCROOT = . 18 | OBJROOT = . 19 | OFILE_DIR = $(OBJROOT) 20 | VPATH = $(OFILE_DIR) 21 | SYMROOT = . 22 | 23 | EFIBINDIR = /usr/local/efi/bin 24 | LOCBINDIR = /usr/local/bin 25 | 26 | CFILES = makerelocs.c mtoc.c 27 | 28 | INSTALL_FILES = $(CFILES) Makefile notes 29 | 30 | PROGS = makerelocs.NEW mtoc.NEW 31 | 32 | all: $(OFILE_DIR) $(SYMROOT) $(PROGS) 33 | 34 | .c.o: 35 | $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< 36 | 37 | makerelocs.NEW: makerelocs.o 38 | $(CC) $(RC_CFLAGS) -nostdlib -r \ 39 | -o $(OBJROOT)/makerelocs.private.o \ 40 | $(OFILE_DIR)/makerelocs.o $(LIBSTUFF) 41 | $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/makerelocs.NEW \ 42 | $(OFILE_DIR)/makerelocs.private.o 43 | $(DSYMUTIL) $(SYMROOT)/makerelocs.NEW 44 | 45 | mtoc.NEW: mtoc.o 46 | $(CC) $(RC_CFLAGS) -nostdlib -r \ 47 | -o $(OBJROOT)/mtoc.private.o \ 48 | $(OFILE_DIR)/mtoc.o $(LIBSTUFF) 49 | $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/mtoc.NEW \ 50 | $(OFILE_DIR)/mtoc.private.o 51 | $(DSYMUTIL) $(SYMROOT)/mtoc.NEW 52 | 53 | clean: shlib_clean 54 | -rm -f \ 55 | $(SYMROOT)/makerelocs.NEW \ 56 | $(SYMROOT)/mtoc.NEW 57 | -rm -r -f *dSYM 58 | 59 | shlib_clean: 60 | -rm -f \ 61 | $(OFILE_DIR)/makerelocs.o \ 62 | $(OFILE_DIR)/makerelocs.private.o \ 63 | $(OFILE_DIR)/mtoc.o \ 64 | $(OFILE_DIR)/mtoc.private.o 65 | -rm -f make.out 66 | 67 | install: all install 68 | 69 | install: 70 | $(MKDIRS) $(DSTROOT)$(EFIBINDIR) $(DSTROOT)$(LOCBINDIR) 71 | # For now don't overwrite the existing makerelocs program the efitools project 72 | # builds. 73 | # install -c -s -m 555 $(SYMROOT)/makerelocs.NEW \ 74 | # $(DSTROOT)$(EFIBINDIR)/makerelocs 75 | install -c -s -m 555 $(SYMROOT)/mtoc.NEW \ 76 | $(DSTROOT)$(EFIBINDIR)/mtoc 77 | install -c -s -m 555 $(SYMROOT)/mtoc.NEW \ 78 | $(DSTROOT)$(LOCBINDIR)/mtoc 79 | 80 | installsrc: 81 | $(MKDIRS) $(SRCROOT) 82 | chmod 755 $(SRCROOT) 83 | gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) 84 | chmod 444 $(SRCROOT)/* 85 | 86 | $(OFILE_DIR) $(SYMROOT): 87 | $(MKDIRS) $@ 88 | -------------------------------------------------------------------------------- /gprof/Makefile: -------------------------------------------------------------------------------- 1 | ifneq "" "$(SDKROOT)" 2 | SDK = -isysroot $(SDKROOT) 3 | CC = $(shell xcrun -find -sdk $(SDKROOT) cc) 4 | DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) 5 | else 6 | DSYMUTIL = dsymutil 7 | endif 8 | 9 | OFLAG = -Os 10 | CFLAGS = $(OFLAG) -g -I../include -Wall -DNeXT_MOD -DDEBUG $(SDK) 11 | LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff 12 | MKDIRS = /bin/mkdir -p 13 | OBJROOT = . 14 | OFILE_DIR = $(OBJROOT) 15 | VPATH = $(OFILE_DIR) 16 | SYMROOT = . 17 | 18 | BINDIR = /usr/ucb 19 | USRBINDIR = /usr/bin 20 | LIBDIR = /usr/share 21 | 22 | HFILES = gprof.h m68k.h vax.h 23 | CFILES = gprof.c arcs.c dfn.c lookup.c calls.c hertz.c printgprof.c \ 24 | printlist.c getnfile.c scatter.c 25 | OBJS = $(CFILES:.c=.o) 26 | INSTALL_FILES = $(CFILES) $(HFILES) gprof.flat gprof.callg Makefile notes 27 | 28 | PRODUCT = gprof 29 | all: $(OFILE_DIR) $(SYMROOT) $(PRODUCT).NEW 30 | 31 | $(PRODUCT).NEW: $(OFILE_DIR) $(SYMROOT) $(OBJS) 32 | $(CC) $(RC_CFLAGS) -nostdlib -r \ 33 | -o $(SYMROOT)/$@.private.o $(OBJS) $(LIBSTUFF) 34 | $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/$@ $(SYMROOT)/$@.private.o 35 | $(DSYMUTIL) $(SYMROOT)/$@ 36 | 37 | .c.o: 38 | $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< 39 | 40 | clean: shlib_clean 41 | -rm -f $(SYMROOT)/$(PRODUCT).NEW 42 | -rm -f $(SYMROOT)/$(PRODUCT).NEW.private.o 43 | -rm -r -f *dSYM 44 | 45 | shlib_clean: 46 | -cd $(OFILE_DIR); rm -f $(OBJS) 47 | -rm -f make.out 48 | 49 | install: all 50 | # No longer install gprof and its files. 51 | # $(MKDIRS) $(DSTROOT)$(USRBINDIR) 52 | # install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ 53 | # $(DSTROOT)$(USRBINDIR)/$(PRODUCT) 54 | # $(MKDIRS) $(DSTROOT)$(LIBDIR) 55 | # install -c -m 444 gprof.flat $(DSTROOT)$(LIBDIR) 56 | # install -c -m 444 gprof.callg $(DSTROOT)$(LIBDIR) 57 | 58 | installsrc: 59 | $(MKDIRS) $(SRCROOT) 60 | chmod 755 $(SRCROOT) 61 | gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) 62 | chmod 444 $(SRCROOT)/* 63 | 64 | $(OFILE_DIR) $(SYMROOT): 65 | $(MKDIRS) $@ 66 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/architecture/nrw/macro_help.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, Apple Computer, Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 13 | * its contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR 20 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | /* 29 | * Mach Operating System 30 | * Copyright (c) 1989 Carnegie-Mellon University 31 | * Copyright (c) 1988 Carnegie-Mellon University 32 | * All rights reserved. The CMU software License Agreement specifies 33 | * the terms and conditions for use and redistribution. 34 | */ 35 | /* 36 | * HISTORY 37 | * 09-23-91 mike Created from Mach version 38 | * 39 | */ 40 | /* 41 | * File: architecture/nrw/macro_help.h 42 | * 43 | * Provide help in making lint-free macro routines 44 | * 45 | */ 46 | 47 | #ifndef _NRW_MACRO_HELP_H_ 48 | #define _NRW_MACRO_HELP_H_ 49 | 50 | #ifndef MACRO_BEGIN 51 | # define MACRO_BEGIN do { 52 | #endif /* MACRO_BEGIN */ 53 | 54 | #ifndef MACRO_END 55 | # define MACRO_END } while (0) 56 | #endif /* MACRO_END */ 57 | 58 | #ifndef MACRO_RETURN 59 | # define MACRO_RETURN if (1) return 60 | #endif /* MACRO_RETURN */ 61 | 62 | #endif /* _NRW_MACRO_HELP_H_ */ 63 | 64 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/coff/filehdr.h: -------------------------------------------------------------------------------- 1 | #ifndef _COFF_FILEHDR_H 2 | #define _COFF_FILEHDR_H 3 | /* 4 | * These data structures are discribed in the pecoff_v8.doc in section 5 | * "3.3. COFF File Header (Object and Image)" 6 | */ 7 | #include 8 | 9 | /* 10 | * At the beginning of an object file, or immediately after the signature of an 11 | * image file, is a standard COFF file header in the following format. Note 12 | * 13 | * Since definitions for this header were based from the GNU binutils 14 | * coff/pe.h header file that copyright info is below. 15 | */ 16 | 17 | /* pe.h - PE COFF header information 18 | 19 | Copyright 2000, 2001, 2003, 2004 Free Software Foundation, Inc. 20 | 21 | This file is part of BFD, the Binary File Descriptor library. 22 | 23 | This program is free software; you can redistribute it and/or modify 24 | it under the terms of the GNU General Public License as published by 25 | the Free Software Foundation; either version 2 of the License, or 26 | (at your option) any later version. 27 | 28 | This program is distributed in the hope that it will be useful, 29 | but WITHOUT ANY WARRANTY; without even the implied warranty of 30 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31 | GNU General Public License for more details. 32 | 33 | You should have received a copy of the GNU General Public License 34 | along with this program; if not, write to the Free Software Foundation, 35 | Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 36 | 37 | struct filehdr 38 | { 39 | uint16_t f_magic; /* Magic number. */ 40 | uint16_t f_nscns; /* Number of sections. */ 41 | uint32_t f_timdat; /* Time & date stamp. */ 42 | uint32_t f_symptr; /* File pointer to symtab. */ 43 | uint32_t f_nsyms; /* Number of symtab entries. */ 44 | uint16_t f_opthdr; /* Sizeof(optional hdr). */ 45 | uint16_t f_flags; /* Flags. */ 46 | }; 47 | 48 | /* Machine numbers (for the f_magic field). */ 49 | #define IMAGE_FILE_MACHINE_ARM 0x01c0 50 | #define IMAGE_FILE_MACHINE_ARM64 0x01c6 51 | #define IMAGE_FILE_MACHINE_I386 0x014c 52 | #define IMAGE_FILE_MACHINE_AMD64 0x8664 53 | 54 | /* NT specific file attributes (for the f_flags field). */ 55 | #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 56 | #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 57 | #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 58 | #define IMAGE_FILE_32BIT_MACHINE 0x0100 59 | #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 60 | 61 | #endif /* _COFF_FILEHDR_H */ 62 | -------------------------------------------------------------------------------- /include/coff/syment.h: -------------------------------------------------------------------------------- 1 | #ifndef _COFF_SYMENT_H 2 | #define _COFF_SYMENT_H 3 | /* 4 | * These data structures are discribed in the pecoff_v8.doc in section 5 | * "5.4. COFF Symbol Table" 6 | */ 7 | #include 8 | 9 | /* 10 | * Since definitions for this header were based from the GNU binutils 11 | * coff/external.h header file that copyright info is below. 12 | */ 13 | 14 | /* external.h -- External COFF structures 15 | 16 | Copyright 2001 Free Software Foundation, Inc. 17 | 18 | This program is free software; you can redistribute it and/or modify 19 | it under the terms of the GNU General Public License as published by 20 | the Free Software Foundation; either version 2 of the License, or 21 | (at your option) any later version. 22 | 23 | This program is distributed in the hope that it will be useful, 24 | but WITHOUT ANY WARRANTY; without even the implied warranty of 25 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 26 | GNU General Public License for more details. 27 | 28 | You should have received a copy of the GNU General Public License 29 | along with this program; if not, write to the Free Software 30 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ 31 | 32 | #define E_SYMNMLEN 8 /* # characters in a symbol name */ 33 | 34 | struct syment 35 | { 36 | union 37 | { 38 | char e_name[E_SYMNMLEN]; 39 | 40 | struct 41 | { 42 | uint32_t e_zeroes; 43 | uint32_t e_offset; 44 | } e; 45 | } e; 46 | 47 | uint32_t e_value; 48 | uint16_t e_scnum; 49 | uint16_t e_type; 50 | char e_sclass; 51 | char e_numaux; 52 | } 53 | /* 54 | * The symbol table is an array of this struct which must be 18 bytes in size. 55 | * Which is why the packed and and alignment of 2 bytes is done. 56 | */ 57 | __attribute((packed,aligned(2))) ; 58 | 59 | /* constants used in the e_sclass (Storage Class) field */ 60 | #define IMAGE_SYM_CLASS_EXTERNAL 2 61 | #endif /* _COFF_SYMENT_H */ 62 | -------------------------------------------------------------------------------- /include/gnu/a.out.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 | * Copyright (c) 1980 Regents of the University of California. 25 | * All rights reserved. The Berkeley software License Agreement 26 | * specifies the terms and conditions for redistribution. 27 | * 28 | * @(#)a.out.h 5.1 (Berkeley) 5/30/85 29 | */ 30 | 31 | /* 32 | * Definitions of the a.out header 33 | * and magic numbers are shared with 34 | * the kernel. 35 | */ 36 | #include 37 | 38 | /* 39 | * Macros which take exec structures as arguments and tell whether 40 | * the file has a reasonable magic number or offsets to text|symbols|strings. 41 | */ 42 | #define N_BADMAG(x) \ 43 | (((x).a_magic)!=OMAGIC && ((x).a_magic)!=NMAGIC && ((x).a_magic)!=ZMAGIC) 44 | 45 | #define N_TXTOFF(x) \ 46 | ((x).a_magic==ZMAGIC ? 0 : sizeof (struct exec)) 47 | #define N_SYMOFF(x) \ 48 | (N_TXTOFF(x) + (x).a_text+(x).a_data + (x).a_trsize+(x).a_drsize) 49 | #define N_STROFF(x) \ 50 | (N_SYMOFF(x) + (x).a_syms) 51 | 52 | #include "mach-o/reloc.h" 53 | #ifdef M88K 54 | #include "mach-o/m88k/reloc.h" 55 | #endif 56 | #ifdef M98K 57 | #include "mach-o/m98k/reloc.h" 58 | #endif 59 | #ifdef I860 60 | #include "mach-o/i860/reloc.h" 61 | #endif 62 | #ifdef HPPA 63 | #include "mach-o/hppa/reloc.h" 64 | #endif 65 | 66 | #include "mach-o/nlist.h" 67 | /* Things in other UNIX systems not in the NeXT version of nlist.h */ 68 | #define n_hash n_desc /* used internally by ld */ 69 | #define N_TEXT 0x4 /* text */ 70 | #define N_DATA 0x6 /* data */ 71 | #define N_BSS 0x8 /* bss */ 72 | #define N_COMM 0x12 /* common (internal to ld) */ 73 | #define N_FN 0x1f /* file name symbol */ 74 | /* 75 | * Format for namelist values. 76 | */ 77 | #define N_FORMAT "%08x" 78 | -------------------------------------------------------------------------------- /include/mach-o/arm64/reloc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2010 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 | * Relocation types used in the arm64 implementation. 25 | */ 26 | enum reloc_type_arm64 27 | { 28 | ARM64_RELOC_UNSIGNED, // for pointers 29 | ARM64_RELOC_SUBTRACTOR, // must be followed by a ARM64_RELOC_UNSIGNED 30 | ARM64_RELOC_BRANCH26, // a B/BL instruction with 26-bit displacement 31 | ARM64_RELOC_PAGE21, // pc-rel distance to page of target 32 | ARM64_RELOC_PAGEOFF12, // offset within page, scaled by r_length 33 | ARM64_RELOC_GOT_LOAD_PAGE21, // pc-rel distance to page of GOT slot 34 | ARM64_RELOC_GOT_LOAD_PAGEOFF12, // offset within page of GOT slot, 35 | // scaled by r_length 36 | ARM64_RELOC_POINTER_TO_GOT, // for pointers to GOT slots 37 | ARM64_RELOC_TLVP_LOAD_PAGE21, // pc-rel distance to page of TLVP slot 38 | ARM64_RELOC_TLVP_LOAD_PAGEOFF12, // offset within page of TLVP slot, 39 | // scaled by r_length 40 | ARM64_RELOC_ADDEND // must be followed by PAGE21 or PAGEOFF12 41 | }; 42 | -------------------------------------------------------------------------------- /include/mach-o/dyld_priv.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 | #ifndef _MACH_O_DYLD_PRIV_H_ 24 | #define _MACH_O_DYLD_PRIV_H_ 25 | 26 | 27 | #include 28 | 29 | #ifdef __cplusplus 30 | extern "C" { 31 | #endif /* __cplusplus */ 32 | 33 | 34 | /* 35 | * Given an imageOffset into an ObjectFileImage, returns 36 | * the segment/section name and offset into that section of 37 | * that imageOffset. Returns FALSE if the imageOffset is not 38 | * in any section. You can used the resulting sectionOffset to 39 | * index into the data returned by NSGetSectionDataInObjectFileImage. 40 | * 41 | * First appeared in Mac OS X 10.3 42 | * 43 | * SPI: currently only used by ZeroLink to detect +load methods 44 | */ 45 | enum DYLD_BOOL 46 | NSFindSectionAndOffsetInObjectFileImage( 47 | NSObjectFileImage objectFileImage, 48 | unsigned long imageOffset, 49 | const char** segmentName, /* can be NULL */ 50 | const char** sectionName, /* can be NULL */ 51 | unsigned long* sectionOffset); /* can be NULL */ 52 | 53 | 54 | 55 | 56 | #ifdef __cplusplus 57 | } 58 | #endif /* __cplusplus */ 59 | 60 | #endif /* _MACH_O_DYLD_PRIV_H_ */ 61 | -------------------------------------------------------------------------------- /include/mach-o/fat.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 | #ifndef _MACH_O_FAT_H_ 24 | #define _MACH_O_FAT_H_ 25 | /* 26 | * This header file describes the structures of the file format for "fat" 27 | * architecture specific file (wrapper design). At the begining of the file 28 | * there is one fat_header structure followed by a number of fat_arch 29 | * structures. For each architecture in the file, specified by a pair of 30 | * cputype and cpusubtype, the fat_header describes the file offset, file 31 | * size and alignment in the file of the architecture specific member. 32 | * The padded bytes in the file to place each member on it's specific alignment 33 | * are defined to be read as zeros and can be left as "holes" if the file system 34 | * can support them as long as they read as zeros. 35 | * 36 | * All structures defined here are always written and read to/from disk 37 | * in big-endian order. 38 | */ 39 | 40 | /* 41 | * is needed here for the cpu_type_t and cpu_subtype_t types 42 | * and contains the constants for the possible values of these types. 43 | */ 44 | #include 45 | #include 46 | #include 47 | 48 | #define FAT_MAGIC 0xcafebabe 49 | #define FAT_CIGAM 0xbebafeca /* NXSwapLong(FAT_MAGIC) */ 50 | 51 | struct fat_header { 52 | uint32_t magic; /* FAT_MAGIC */ 53 | uint32_t nfat_arch; /* number of structs that follow */ 54 | }; 55 | 56 | struct fat_arch { 57 | cpu_type_t cputype; /* cpu specifier (int) */ 58 | cpu_subtype_t cpusubtype; /* machine specifier (int) */ 59 | uint32_t offset; /* file offset to this object file */ 60 | uint32_t size; /* size of this object file */ 61 | uint32_t align; /* alignment as a power of 2 */ 62 | }; 63 | 64 | #endif /* _MACH_O_FAT_H_ */ 65 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/mach-o/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 | /* 24 | * Relocation types used in the m88k implementation. Relocation entries for 25 | * things other than instructions use the same generic relocation as discribed 26 | * above and their r_type is RELOC_VANILLA. The rest of the relocation types 27 | * are for instructions. Since they are for instructions the r_address field 28 | * indicates the 32 bit instruction that the relocation is to be preformed on. 29 | * The fields r_pcrel and r_length are ignored for non-RELOC_VANILLA r_types. 30 | */ 31 | enum reloc_type_m88k 32 | { 33 | M88K_RELOC_VANILLA, /* generic relocation as discribed above */ 34 | M88K_RELOC_PAIR, /* the second relocation entry of a pair */ 35 | M88K_RELOC_PC16, 36 | M88K_RELOC_PC26, 37 | M88K_RELOC_HI16, /* a PAIR follows with the low half */ 38 | M88K_RELOC_LO16, /* a PAIR follows with the high half */ 39 | M88K_RELOC_SECTDIFF,/* a PAIR follows with subtract symbol value */ 40 | M88K_RELOC_PB_LA_PTR/* prebound lazy pointer */ 41 | }; 42 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/mach-o/rld.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 | * This is the interface to the rld package as described in rld(3). 25 | */ 26 | 27 | #ifndef _MACHO_RLD_H_ 28 | #define _MACHO_RLD_H_ 29 | 30 | #include 31 | #include 32 | 33 | extern long rld_load( 34 | NXStream *stream, 35 | struct mach_header **header_addr, 36 | const char * const *object_filenames, 37 | const char *output_filename); 38 | 39 | extern long rld_load_from_memory( 40 | NXStream *stream, 41 | struct mach_header **header_addr, 42 | const char *object_name, 43 | char *object_addr, 44 | long object_size, 45 | const char *output_filename); 46 | 47 | extern long rld_unload( 48 | NXStream *stream); 49 | 50 | extern long rld_lookup( 51 | NXStream *stream, 52 | const char *symbol_name, 53 | unsigned long *value); 54 | 55 | extern long rld_forget_symbol( 56 | NXStream *stream, 57 | const char *symbol_name); 58 | 59 | extern long rld_unload_all( 60 | NXStream *stream, 61 | long deallocate_sets); 62 | 63 | extern long rld_load_basefile( 64 | NXStream *stream, 65 | const char *base_filename); 66 | 67 | extern void rld_address_func( 68 | unsigned long (*func)(unsigned long size, unsigned long headers_size)); 69 | 70 | extern long rld_write_symfile( 71 | NXStream *stream, 72 | const char *output_filename); 73 | #endif /* _MACHO_RLD_H_ */ 74 | -------------------------------------------------------------------------------- /include/mach-o/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 | /* reloc.h - assemble for Sparc */ 24 | /* Defines machine specific relocation entries */ 25 | 26 | #ifndef SPARC_RELOC_INCLUDED 27 | #define SPARC_RELOC_INCLUDED 28 | 29 | /* 30 | * Relocation types used in the sparc implementation. Relocation entries for 31 | * things other than instructions use the same generic relocation as discribed 32 | * in and their r_type is SPARC_RELOC_VANILLA. The rest of the 33 | * relocation types are for instructions. Since they are for instructions the 34 | * r_address field indicates the 32 bit instruction that the relocation is to 35 | * be preformed on. The field r_pcrel is set only for the SPARC_RELOC_WDISP22 36 | * and SPARC_RELOC_WDISP30. And r_length is set to long for all 37 | * non-RELOC_VANILLA r_types. 38 | */ 39 | enum reloc_type_sparc 40 | { 41 | SPARC_RELOC_VANILLA, /* vanilla relocation */ 42 | SPARC_RELOC_PAIR, /* the second relocation entry of a pair */ 43 | SPARC_RELOC_HI22, /* 22 high bits (sethi) (has pair) */ 44 | SPARC_RELOC_LO10, /* 10 low bits (has pair) */ 45 | SPARC_RELOC_WDISP22, /* 22 bit PC relative displacement */ 46 | SPARC_RELOC_WDISP30, /* 30 bit PC relative displacement */ 47 | SPARC_RELOC_SECTDIFF, /* a PAIR follows with subtract symbol value */ 48 | SPARC_RELOC_HI22_SECTDIFF, 49 | SPARC_RELOC_LO10_SECTDIFF, 50 | SPARC_RELOC_PB_LA_PTR /* prebound lazy pointer */ 51 | }; 52 | #endif /* SPARC_RELOC_INCLUDED */ 53 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/mach/arm/thread_state.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2007 Apple Inc. All rights reserved. 3 | */ 4 | /* 5 | * @OSF_COPYRIGHT@ 6 | */ 7 | 8 | #ifndef _MACH_ARM_THREAD_STATE_H_ 9 | #define _MACH_ARM_THREAD_STATE_H_ 10 | 11 | #define ARM_THREAD_STATE_MAX (272) 12 | 13 | #if defined (__arm__) 14 | #define THREAD_STATE_MAX ARM_THREAD_STATE_MAX 15 | #endif 16 | 17 | #if defined(__arm64__) && !defined(THREAD_STATE_MAX) 18 | #define THREAD_STATE_MAX ARM_THREAD_STATE_MAX 19 | #endif 20 | 21 | #endif /* _MACH_ARM_THREAD_STATE_H_ */ 22 | -------------------------------------------------------------------------------- /include/mach/i386/thread_state.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_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. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | /* 29 | * @OSF_COPYRIGHT@ 30 | */ 31 | 32 | #ifndef _MACH_I386_THREAD_STATE_H_ 33 | #define _MACH_I386_THREAD_STATE_H_ 34 | 35 | /* Size of maximum exported thread state in words */ 36 | #define I386_THREAD_STATE_MAX (224) /* Size of biggest state possible */ 37 | 38 | #if defined (__i386__) || defined(__x86_64__) 39 | #define THREAD_STATE_MAX I386_THREAD_STATE_MAX 40 | #endif 41 | 42 | #endif /* _MACH_I386_THREAD_STATE_H_ */ 43 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/stuff/bool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, Apple Computer, Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 13 | * its contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR 20 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | /* bool.h */ 29 | #ifndef ENUM_DYLD_BOOL 30 | #define ENUM_DYLD_BOOL 31 | 32 | #define _STDBOOL_H /* for gcc header */ 33 | #define __STDBOOL_H /* for clang header */ 34 | #undef bool 35 | 36 | 37 | #define DYLD_BOOL bool 38 | 39 | #undef FALSE 40 | #undef TRUE 41 | enum bool { 42 | FALSE, 43 | TRUE 44 | }; 45 | 46 | #endif /* ENUM_DYLD_BOOL */ 47 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 add_execute_list_with_prefix( 40 | char *str); 41 | 42 | __private_extern__ char * cmd_with_prefix( 43 | char *str); 44 | 45 | __private_extern__ void reset_execute_list( 46 | void); 47 | 48 | __private_extern__ int execute_list( 49 | int verbose); 50 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/stuff/hppa.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 calc_hppa_HILO( 28 | uint32_t base, 29 | uint32_t offset, 30 | uint32_t *left21, 31 | uint32_t *right14); 32 | 33 | __private_extern__ uint32_t assemble_17( 34 | uint32_t x, 35 | uint32_t y, 36 | uint32_t z); 37 | 38 | __private_extern__ uint32_t assemble_21( 39 | uint32_t x); 40 | 41 | __private_extern__ uint32_t assemble_12( 42 | uint32_t x, 43 | uint32_t y); 44 | 45 | __private_extern__ uint32_t assemble_3( 46 | uint32_t x); 47 | 48 | __private_extern__ uint32_t sign_ext( 49 | uint32_t x, 50 | uint32_t len); 51 | 52 | __private_extern__ uint32_t low_sign_ext( 53 | uint32_t x, 54 | uint32_t len); 55 | 56 | __private_extern__ uint32_t dis_assemble_21( 57 | uint32_t as21); 58 | 59 | __private_extern__ uint32_t low_sign_unext( 60 | uint32_t x, 61 | uint32_t len); 62 | 63 | __private_extern__ void dis_assemble_17( 64 | uint32_t as17, 65 | uint32_t *x, 66 | uint32_t *y, 67 | uint32_t *z); 68 | 69 | __private_extern__ uint32_t sign_unext( 70 | uint32_t x, 71 | uint32_t len); 72 | 73 | __private_extern__ uint32_t dis_assemble_3( 74 | uint32_t x); 75 | 76 | __private_extern__ void dis_assemble_12( 77 | uint32_t as12, 78 | uint32_t *x, 79 | uint32_t *y); 80 | -------------------------------------------------------------------------------- /include/stuff/llvm.h: -------------------------------------------------------------------------------- 1 | #ifndef _STUFF_LLVM_H_ 2 | #define _STUFF_LLVM_H_ 3 | 4 | #include "llvm-c/Disassembler.h" 5 | 6 | __private_extern__ LLVMDisasmContextRef llvm_create_disasm( 7 | const char *TripleName, 8 | const char *CPU, 9 | void *DisInfo, 10 | int TagType, 11 | LLVMOpInfoCallback GetOpInfo, 12 | LLVMSymbolLookupCallback SymbolLookUp); 13 | 14 | __private_extern__ void llvm_disasm_dispose( 15 | LLVMDisasmContextRef DC); 16 | 17 | __private_extern__ size_t llvm_disasm_instruction( 18 | LLVMDisasmContextRef DC, 19 | uint8_t *Bytes, 20 | uint64_t BytesSize, 21 | uint64_t Pc, 22 | char *OutString, 23 | size_t OutStringSize); 24 | 25 | __private_extern__ int llvm_disasm_set_options( 26 | LLVMDisasmContextRef DC, 27 | uint64_t Options); 28 | 29 | __private_extern__ const char *llvm_disasm_version_string( 30 | void); 31 | 32 | #endif /* _STUFF_LLVM_H_ */ 33 | -------------------------------------------------------------------------------- /include/stuff/lto.h: -------------------------------------------------------------------------------- 1 | #ifndef _STUFF_LTO_H_ 2 | #define _STUFF_LTO_H_ 3 | 4 | #include "stuff/arch.h" 5 | 6 | #ifdef LTO_SUPPORT 7 | 8 | __private_extern__ int is_llvm_bitcode_from_memory( 9 | char *addr, 10 | uint32_t size, 11 | struct arch_flag *arch_flag, 12 | void **mod); /* maybe NULL */ 13 | 14 | __private_extern__ uint32_t lto_get_nsyms( 15 | void *mod); 16 | 17 | __private_extern__ int lto_toc_symbol( 18 | void *mod, 19 | uint32_t symbol_index, 20 | int commons_in_toc); 21 | 22 | __private_extern__ void lto_get_nlist_64( 23 | struct nlist_64 *nl, 24 | void *mod, 25 | uint32_t symbol_index); 26 | 27 | __private_extern__ char * lto_symbol_name( 28 | void *mod, 29 | uint32_t symbol_index); 30 | 31 | __private_extern__ void lto_free( 32 | void *mod); 33 | 34 | #endif /* LTO_SUPPORT */ 35 | 36 | #endif /* _STUFF_LTO_H_ */ 37 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/stuff/openstep_mach.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, Apple Computer, Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 13 | * its contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR 20 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | #ifdef __OPENSTEP__ 29 | /* 30 | * This file is used to allow cctools to be compiled for Openstep now that 31 | * the code has been changed to use Mach 3.0 names (which work for MacOS X and 32 | * Rhapsody but not for Openstep). 33 | */ 34 | #define mach_task_self task_self 35 | #define mach_task_self_ task_self_ 36 | #define mach_host_self host_self 37 | #define mach_thread_self thread_self 38 | #define mach_port_allocate port_allocate 39 | #define mach_port_deallocate port_deallocate 40 | #define mach_port_names port_names 41 | #endif /* __OPENSTEP__ */ 42 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /include/stuff/rnd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, Apple Computer, Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 13 | * its contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR 20 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | #include 29 | 30 | #if defined(__MWERKS__) && !defined(__private_extern__) 31 | #define __private_extern__ __declspec(private_extern) 32 | #endif 33 | 34 | /* 35 | * rnd() rounds v to a multiple of r. 36 | */ 37 | __private_extern__ uint64_t rnd( 38 | uint64_t v, 39 | uint64_t r); 40 | -------------------------------------------------------------------------------- /include/stuff/seg_addr_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 | #include "stuff/bool.h" 24 | 25 | /* 26 | * These are the tokens for the "install name" for the next addresses to use 27 | * when updating the table. And also the token for fixed regions. 28 | */ 29 | #define NEXT_FLAT_ADDRESS_TO_ASSIGN "<<< Next flat address to assign >>>" 30 | #define NEXT_SPLIT_ADDRESS_TO_ASSIGN "<<< Next split address to assign >>>" 31 | #define NEXT_DEBUG_ADDRESS_TO_ASSIGN "<<< Next debug address to assign >>>" 32 | #define FIXED_ADDRESS_AND_SIZE "<<< Fixed address and size not to assign >>>" 33 | 34 | /* 35 | * The table of dynamic library install names and their addresses they are 36 | * linked at. This is used with the -seg_addr_table option from the static 37 | * link editor, ld(1), and the seg_addr_table(1) program. 38 | */ 39 | struct seg_addr_table { 40 | char *install_name; 41 | enum bool split; 42 | uint32_t seg1addr; 43 | uint32_t segs_read_only_addr; 44 | uint32_t segs_read_write_addr; 45 | uint32_t line; 46 | }; 47 | 48 | extern struct seg_addr_table *parse_default_seg_addr_table( 49 | char **seg_addr_table_name, 50 | uint32_t *table_size); 51 | 52 | extern struct seg_addr_table * parse_seg_addr_table( 53 | char *file_name, 54 | char *flag, 55 | char *argument, 56 | uint32_t *table_size); 57 | 58 | extern struct seg_addr_table * search_seg_addr_table( 59 | struct seg_addr_table *seg_addr_table, 60 | char *install_name); 61 | 62 | extern void process_seg_addr_table( 63 | char *file_name, 64 | FILE *out_fp, 65 | char *comment_prefix, 66 | void (*processor)(struct seg_addr_table *entry, FILE *out_fp, void *cookie), 67 | void *cookie); 68 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ld/debugcompunit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 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 | /* Given pointers to the DEBUG_INFO and DEBUG_ABBREV sections, and 27 | their corresponding sizes, and whether the object file is 28 | LITTLE_ENDIAN or not, look at the compilation unit DIE and 29 | determine its NAME, compilation directory (in COMP_DIR) and its 30 | line number information offset (in STMT_LIST). NAME and COMP_DIR 31 | may be NULL (especially COMP_DIR) if they are not in the .o file; 32 | STMT_LIST will be (uint64_t) -1. 33 | 34 | At present this assumes that there's only one compilation unit DIE. */ 35 | 36 | int read_comp_unit (const uint8_t * debug_info, 37 | size_t debug_info_size, 38 | const uint8_t * debug_abbrev, 39 | size_t debug_abbrev_size, 40 | int little_endian, 41 | const char ** name, 42 | const char ** comp_dir, 43 | uint64_t *stmt_list); 44 | -------------------------------------------------------------------------------- /ld/dwarf2.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2006 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 | /* These constants were taken from version 3 of the DWARF standard, 24 | which is Copyright (c) 2005 Free Standards Group, and 25 | Copyright (c) 1992, 1993 UNIX International, Inc. */ 26 | 27 | /* This is not a complete list. */ 28 | enum { 29 | DW_TAG_compile_unit = 17, 30 | DW_TAG_partial_unit = 60 31 | }; 32 | 33 | /* This is not a complete list. */ 34 | enum { 35 | DW_AT_sibling = 1, 36 | DW_AT_name = 3, 37 | DW_AT_stmt_list = 16, 38 | DW_AT_comp_dir = 27 39 | }; 40 | 41 | enum { 42 | DW_FORM_addr = 1, 43 | DW_FORM_block2 = 3, 44 | DW_FORM_block4, 45 | DW_FORM_data2, 46 | DW_FORM_data4, 47 | DW_FORM_data8, 48 | DW_FORM_string, 49 | DW_FORM_block, 50 | DW_FORM_block1, 51 | DW_FORM_data1, 52 | DW_FORM_flag, 53 | DW_FORM_sdata, 54 | DW_FORM_strp, 55 | DW_FORM_udata, 56 | DW_FORM_ref_addr, 57 | DW_FORM_ref1, 58 | DW_FORM_ref2, 59 | DW_FORM_ref4, 60 | DW_FORM_ref8, 61 | DW_FORM_ref_udata, 62 | DW_FORM_indirect /* 22 */ 63 | }; 64 | 65 | enum { 66 | DW_LNS_extended_op = 0, 67 | DW_LNS_copy, 68 | DW_LNS_advance_pc, 69 | DW_LNS_advance_line, 70 | DW_LNS_set_file, 71 | DW_LNS_set_column, 72 | DW_LNS_negate_stmt, 73 | DW_LNS_set_basic_block, 74 | DW_LNS_const_add_pc, 75 | DW_LNS_fixed_advance_pc, 76 | DW_LNS_set_prologue_end, 77 | DW_LNS_set_epilogue_begin, 78 | DW_LNS_set_isa 79 | }; 80 | 81 | enum { 82 | DW_LNE_end_sequence = 1, 83 | DW_LNE_set_address, 84 | DW_LNE_define_file 85 | }; 86 | -------------------------------------------------------------------------------- /ld/fvmlibs.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 | #ifndef RLD 28 | /* 29 | * Global types, variables and routines declared in the file fvmlibs.c. 30 | * 31 | * The following include file need to be included before this file: 32 | * #include 33 | * #include "ld.h" 34 | */ 35 | 36 | struct merged_fvmlib { 37 | char *fvmlib_name; /* The name of this fixed VM shared library. */ 38 | struct fvmlib_command *fl; /* The LC_LOADFVMLIB load command for this */ 39 | /* fixed VM shared library. */ 40 | struct object_file /* Pointer to the object file the load */ 41 | *definition_object; /* command was found in */ 42 | enum bool multiple; /* Flag to indicate if this was already */ 43 | /* loaded from more than one object */ 44 | struct merged_fvmlib *next; /* The next in the list, NULL otherwise */ 45 | }; 46 | 47 | /* the pointer to the head of the load fixed VM shared library commamds */ 48 | __private_extern__ struct merged_fvmlib *merged_fvmlibs; 49 | 50 | /* the pointer to the head of the fixed VM shared library segments */ 51 | __private_extern__ struct merged_segment *fvmlib_segments; 52 | 53 | __private_extern__ void merge_fvmlibs( 54 | void); 55 | 56 | #ifdef DEBUG 57 | __private_extern__ void print_load_fvmlibs_list( 58 | void); 59 | __private_extern__ void print_fvmlib_segments( 60 | void); 61 | #endif /* DEBUG */ 62 | #endif /* !defined(RLD) */ 63 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ld/librld.ofileList: -------------------------------------------------------------------------------- 1 | librld.o 2 | -------------------------------------------------------------------------------- /ld/live_refs.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 | * For dead stipping the routine mark_fine_relocs_references_live() calls a 29 | * machine dependent *_get_reloc_refs() routine that fills in the live_refs 30 | * structure for a relocation entry in a section. 31 | */ 32 | enum live_ref_type { 33 | LIVE_REF_NONE, /* there is no reference */ 34 | LIVE_REF_VALUE, /* the reference is in value, an address in on one 35 | of the object's sections */ 36 | LIVE_REF_SYMBOL /* the reference is in the merged_symbol */ 37 | }; 38 | 39 | struct live_ref { 40 | enum live_ref_type ref_type; 41 | unsigned long value; 42 | struct merged_symbol *merged_symbol; 43 | }; 44 | 45 | struct live_refs { 46 | struct live_ref ref1; 47 | struct live_ref ref2; 48 | }; 49 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ld/mod_sections.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 | * The mod_term_data is only used when -dead_strip is specified to break up 29 | * the section so each pointer has a fine relocation entry. 30 | */ 31 | struct mod_term_data { 32 | unsigned long output_offset; 33 | }; 34 | 35 | /* 36 | * Global types, variables and routines declared in the file modinit_sections.c. 37 | */ 38 | __private_extern__ unsigned long ninit; 39 | __private_extern__ unsigned long nterm; 40 | 41 | __private_extern__ void mod_section_merge( 42 | struct mod_term_data *data, 43 | struct merged_section *ms, 44 | struct section *s, 45 | struct section_map *section_map, 46 | enum bool redo_live); 47 | __private_extern__ void mod_section_order( 48 | struct mod_term_data *data, 49 | struct merged_section *ms); 50 | __private_extern__ void mod_section_reset_live( 51 | struct mod_term_data *data, 52 | struct merged_section *ms); 53 | __private_extern__ void mod_section_free( 54 | struct mod_term_data *data); 55 | -------------------------------------------------------------------------------- /ld/pass2.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 | * The total size of the output file and the memory buffer for the output file. 29 | */ 30 | __private_extern__ unsigned long output_size; 31 | __private_extern__ char *output_addr; 32 | 33 | /* 34 | * This is used to setting the SG_NORELOC flag in the segment flags correctly. 35 | * See the comments in the file pass2.c where this is defined. 36 | */ 37 | __private_extern__ struct merged_section **output_sections; 38 | 39 | __private_extern__ void pass2( 40 | void); 41 | #if defined(RLD) && !defined(SA_RLD) 42 | __private_extern__ void pass2_rld_symfile( 43 | void); 44 | #endif /* defined(RLD) && !defined(SA_RLD) */ 45 | __private_extern__ void output_flush( 46 | unsigned long offset, 47 | unsigned long size); 48 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /ld/sets.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 | #ifdef RLD 28 | /* 29 | * The set structure that holds the information for a set of dynamicly loaded 30 | * object files. 31 | */ 32 | struct set { 33 | char *output_addr; /* the output memory for this set */ 34 | unsigned long output_size; /* the size of the output memory for this set */ 35 | struct object_file /* the structures for the common symbols of */ 36 | *link_edit_common_object;/* this set that are allocated by rld() */ 37 | struct section_map 38 | *link_edit_section_maps; 39 | struct section 40 | *link_edit_common_section; 41 | unsigned long narchives; /* the number of archives loaded in this set */ 42 | struct archive *archives; /* addresses and sizes of where they are */ 43 | }; 44 | struct archive { 45 | char *file_name; /* name of the archive that is mapped */ 46 | char *file_addr; /* address the archive is mapped at */ 47 | unsigned long file_size; /* size that is mapped */ 48 | }; 49 | /* 50 | * Pointer to the array of set structures. 51 | */ 52 | __private_extern__ struct set *sets; 53 | /* 54 | * Index into the array of set structures for the current set. 55 | */ 56 | __private_extern__ long cur_set; 57 | 58 | __private_extern__ void new_set( 59 | void); 60 | __private_extern__ void new_archive_or_fat( 61 | char *file_name, 62 | char *file_addr, 63 | unsigned long file_size); 64 | __private_extern__ void remove_set( 65 | void); 66 | __private_extern__ void free_sets( 67 | void); 68 | __private_extern__ void clean_archives_and_fats( 69 | void); 70 | 71 | #endif /* RLD */ 72 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libmacho/i860_swap.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 | #import 25 | 26 | void 27 | swap_i860_thread_state_regs( 28 | struct i860_thread_state_regs *cpu, 29 | enum NXByteOrder target_byte_sex) 30 | { 31 | int i; 32 | 33 | for(i = 0; i < 31; i++) 34 | cpu->ireg[i] = OSSwapInt32(cpu->ireg[i]); 35 | for(i = 0; i < 30; i++) 36 | cpu->freg[i] = OSSwapInt32(cpu->freg[i]); 37 | cpu->psr = OSSwapInt32(cpu->psr); 38 | cpu->epsr = OSSwapInt32(cpu->epsr); 39 | cpu->db = OSSwapInt32(cpu->db); 40 | cpu->pc = OSSwapInt32(cpu->pc); 41 | cpu->_padding_ = OSSwapInt32(cpu->_padding_); 42 | cpu->Mres3 = OSSwapInt64(cpu->Mres3); 43 | cpu->Ares3 = OSSwapInt64(cpu->Ares3); 44 | cpu->Mres2 = OSSwapInt64(cpu->Mres2); 45 | cpu->Ares2 = OSSwapInt64(cpu->Ares2); 46 | cpu->Mres1 = OSSwapInt64(cpu->Mres1); 47 | cpu->Ares1 = OSSwapInt64(cpu->Ares1); 48 | cpu->Ires1 = OSSwapInt64(cpu->Ires1); 49 | cpu->Lres3m = OSSwapInt64(cpu->Lres3m); 50 | cpu->Lres2m = OSSwapInt64(cpu->Lres2m); 51 | cpu->Lres1m = OSSwapInt64(cpu->Lres1m); 52 | cpu->KR = OSSwapInt64(cpu->KR); 53 | cpu->KI = OSSwapInt64(cpu->KI); 54 | cpu->T = OSSwapInt64(cpu->T); 55 | cpu->Fsr3 = OSSwapInt32(cpu->Fsr3); 56 | cpu->Fsr2 = OSSwapInt32(cpu->Fsr2); 57 | cpu->Fsr1 = OSSwapInt32(cpu->Fsr1); 58 | cpu->Mergelo32 = OSSwapInt32(cpu->Mergelo32); 59 | cpu->Mergehi32 = OSSwapInt32(cpu->Mergehi32); 60 | } 61 | #endif /* !defined(RLD) */ 62 | -------------------------------------------------------------------------------- /libmacho/m68k_swap.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 | #import 25 | 26 | void 27 | swap_m68k_thread_state_regs( 28 | struct m68k_thread_state_regs *cpu, 29 | enum NXByteOrder target_byte_sex) 30 | { 31 | uint32_t i; 32 | 33 | for(i = 0; i < 8; i++) 34 | cpu->dreg[i] = OSSwapInt32(cpu->dreg[i]); 35 | for(i = 0; i < 8; i++) 36 | cpu->areg[i] = OSSwapInt32(cpu->areg[i]); 37 | cpu->pad0 = OSSwapInt16(cpu->pad0); 38 | cpu->sr = OSSwapInt16(cpu->sr); 39 | cpu->pc = OSSwapInt32(cpu->pc); 40 | } 41 | 42 | void 43 | swap_m68k_thread_state_68882( 44 | struct m68k_thread_state_68882 *fpu, 45 | enum NXByteOrder target_byte_sex) 46 | { 47 | uint32_t i, tmp; 48 | 49 | for(i = 0; i < 8; i++){ 50 | tmp = OSSwapInt32(fpu->regs[i].fp[0]); 51 | fpu->regs[i].fp[1] = OSSwapInt32(fpu->regs[i].fp[1]); 52 | fpu->regs[i].fp[0] = OSSwapInt32(fpu->regs[i].fp[2]); 53 | fpu->regs[i].fp[2] = tmp; 54 | } 55 | fpu->cr = OSSwapInt32(fpu->cr); 56 | fpu->sr = OSSwapInt32(fpu->sr); 57 | fpu->iar = OSSwapInt32(fpu->iar); 58 | fpu->state = OSSwapInt32(fpu->state); 59 | } 60 | 61 | void 62 | swap_m68k_thread_state_user_reg( 63 | struct m68k_thread_state_user_reg *user_reg, 64 | enum NXByteOrder target_byte_sex) 65 | { 66 | user_reg->user_reg = OSSwapInt32(user_reg->user_reg); 67 | } 68 | #endif /* !defined(RLD) */ 69 | -------------------------------------------------------------------------------- /libmacho/shlib.ofileList: -------------------------------------------------------------------------------- 1 | arch.o 2 | getmachhead.o 3 | getsecbyname.o 4 | getsegbyname.o 5 | get_end.o 6 | swap.o 7 | -------------------------------------------------------------------------------- /libmacho/slot_name.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. 3 | * 4 | * @APPLE_OSREFERENCE_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. The rights granted to you under the License 10 | * may not be used to create, or enable the creation or redistribution of, 11 | * unlawful or unlicensed copies of an Apple operating system, or to 12 | * circumvent, violate, or enable the circumvention or violation of, any 13 | * terms of an Apple operating system software license agreement. 14 | * 15 | * Please obtain a copy of the License at 16 | * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 | * 18 | * The Original Code and all software distributed under the License are 19 | * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 | * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 | * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 | * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 | * Please see the License for the specific language governing rights and 24 | * limitations under the License. 25 | * 26 | * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 | */ 28 | /* 29 | * File: slot_name.c 30 | * Author: Avadis Tevanian, Jr. 31 | * 32 | * Copyright (C) 1987, Avadis Tevanian, Jr. 33 | * 34 | * Convert machine slot values to human readable strings. 35 | * 36 | * HISTORY 37 | * 26-Jan-88 Mary Thompson (mrt) at Carnegie Mellon 38 | * added case for CUP_SUBTYPE_RT_APC 39 | * 40 | * 28-Feb-87 Avadis Tevanian (avie) at Carnegie-Mellon University 41 | * Created. 42 | * 43 | */ 44 | 45 | #include 46 | #include 47 | 48 | /* 49 | * Convert the specified cpu_type/cpu_subtype pair to their 50 | * human readable form. 51 | */ 52 | void slot_name(cpu_type, cpu_subtype, cpu_name, cpu_subname) 53 | cpu_type_t cpu_type; 54 | cpu_subtype_t cpu_subtype; 55 | char **cpu_name, **cpu_subname; 56 | { 57 | register char *name = "Unknown CPU"; 58 | register char *subname = ""; 59 | const NXArchInfo *ai = NXGetArchInfoFromCpuType(cpu_type, cpu_subtype); 60 | if (ai != NULL) { 61 | name = (char *)ai->name; 62 | subname = (char *)ai->description; 63 | } 64 | *cpu_name = name; 65 | *cpu_subname = subname; 66 | } 67 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libstuff/fatals.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 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "stuff/errors.h" 33 | 34 | /* 35 | * Print the fatal error message and exit. 36 | */ 37 | __private_extern__ 38 | void 39 | fatal( 40 | const char *format, 41 | ...) 42 | { 43 | va_list ap; 44 | 45 | va_start(ap, format); 46 | fprintf(stderr, "fatal error: %s: ", progname); 47 | vfprintf(stderr, format, ap); 48 | fprintf(stderr, "\n"); 49 | va_end(ap); 50 | exit(1); 51 | } 52 | 53 | /* 54 | * Print the fatal error message along with the system error message and exit. 55 | */ 56 | __private_extern__ 57 | void 58 | system_fatal( 59 | const char *format, 60 | ...) 61 | { 62 | va_list ap; 63 | 64 | va_start(ap, format); 65 | fprintf(stderr, "fatal error: %s: ", progname); 66 | vfprintf(stderr, format, ap); 67 | fprintf(stderr, " (%s)\n", strerror(errno)); 68 | va_end(ap); 69 | exit(1); 70 | } 71 | 72 | /* 73 | * Print the fatal error message along with the mach error string and exit. 74 | */ 75 | __private_extern__ 76 | void 77 | mach_fatal( 78 | kern_return_t r, 79 | char *format, 80 | ...) 81 | { 82 | va_list ap; 83 | 84 | va_start(ap, format); 85 | fprintf(stderr, "fatal error: %s: ", progname); 86 | vfprintf(stderr, format, ap); 87 | fprintf(stderr, " (%s)\n", mach_error_string(r)); 88 | va_end(ap); 89 | exit(1); 90 | } 91 | #endif /* !defined(RLD) */ 92 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /libstuff/rnd.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2004, Apple Computer, Inc. All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions 6 | * are met: 7 | * 1. Redistributions of source code must retain the above copyright 8 | * notice, this list of conditions and the following disclaimer. 9 | * 2. Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of 13 | * its contributors may be used to endorse or promote products derived 14 | * from this software without specific prior written permission. 15 | * 16 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR 20 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING 25 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 26 | * POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | #include 29 | #include "stuff/rnd.h" 30 | /* 31 | * rnd() rounds v to a multiple of r. 32 | */ 33 | __private_extern__ 34 | uint64_t 35 | rnd( 36 | uint64_t v, 37 | uint64_t r) 38 | { 39 | r--; 40 | v += r; 41 | v &= ~(int64_t)r; 42 | return(v); 43 | } 44 | -------------------------------------------------------------------------------- /libstuff/set_arch_flag_name.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 "stuff/arch.h" 26 | #include "stuff/allocate.h" 27 | 28 | /* 29 | * set_arch_flag_name() sets the name field of the specified arch_flag to 30 | * match it's cputype and cpusubtype. The string is allocated via malloc by 31 | * the routines in "allocate.h" and errors are handled by the routines in 32 | * "error.h". 33 | */ 34 | __private_extern__ 35 | void 36 | set_arch_flag_name( 37 | struct arch_flag *p) 38 | { 39 | const struct arch_flag *arch_flag; 40 | 41 | arch_flag = get_arch_flags(); 42 | while(arch_flag->name != NULL){ 43 | if(arch_flag->cputype == p->cputype && 44 | (arch_flag->cpusubtype & ~CPU_SUBTYPE_MASK) == 45 | (p->cpusubtype & ~CPU_SUBTYPE_MASK)){ 46 | p->name = savestr(arch_flag->name); 47 | break; 48 | } 49 | arch_flag++; 50 | } 51 | if(p->name == NULL){ 52 | p->name = savestr("cputype (1234567890) cpusubtype (1234567890)"); 53 | sprintf(p->name, "cputype (%d) cpusubtype (%d)", 54 | p->cputype, p->cpusubtype); 55 | } 56 | } 57 | #endif /* !defined(RLD) */ 58 | -------------------------------------------------------------------------------- /libstuff/unix_standard_mode.c: -------------------------------------------------------------------------------- 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 | #ifndef RLD 24 | #include 25 | #include 26 | #include "stuff/bool.h" 27 | #include "stuff/unix_standard_mode.h" 28 | 29 | /* 30 | * get_unix_standard_mode() returns TRUE if we are running in UNIX standard 31 | * command mode (the default). 32 | */ 33 | __private_extern__ 34 | enum bool 35 | get_unix_standard_mode( 36 | void) 37 | { 38 | static enum bool checked_environment_variable = FALSE; 39 | static enum bool unix_standard_mode = TRUE; 40 | char *p; 41 | 42 | if(checked_environment_variable == FALSE){ 43 | checked_environment_variable = TRUE; 44 | /* 45 | * Pick up the UNIX standard command mode environment variable. 46 | */ 47 | p = getenv("COMMAND_MODE"); 48 | if(p != NULL){ 49 | if(strcasecmp("legacy", p) == 0) 50 | unix_standard_mode = FALSE; 51 | } 52 | } 53 | return(unix_standard_mode); 54 | } 55 | #endif /* !defined(RLD) */ 56 | -------------------------------------------------------------------------------- /libstuff/vm_flush_cache.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 | /* This has to be -D__3_2_User_with_hppa__ when compiling for 3.2 hp */ 25 | #ifdef __3_2_User_with_hppa__ 26 | 27 | #include 28 | #include "stuff/vm_flush_cache.h" 29 | 30 | /* 31 | * This is currently only implemented on the hppa architecture so versions for 32 | * the other architectures are hacked in here. 33 | */ 34 | #ifndef __hppa__ 35 | __private_extern__ 36 | kern_return_t 37 | vm_flush_cache( 38 | mach_port_t target_task, 39 | vm_address_t address, 40 | vm_size_t size) 41 | { 42 | #ifdef __m68k__ 43 | asm("trap #2"); 44 | #endif 45 | #ifdef __i386__ 46 | asm("jmp 1f"); 47 | asm("1: nop"); 48 | #endif 49 | #ifdef __m88k__ 50 | user_cache_flush(address, size); 51 | #endif 52 | #ifdef __ppc__ 53 | user_cache_flush(address, size); 54 | #endif 55 | return(KERN_SUCCESS); 56 | } 57 | #endif /* !defined(__hppa__) */ 58 | 59 | #else /* undef(__3_2_User_with_hppa__) */ 60 | 61 | #include 62 | #include "stuff/vm_flush_cache.h" 63 | 64 | /* 65 | * This is currently only implemented on the hppa architecture so versions for 66 | * the other architectures are hacked in here. 67 | */ 68 | __private_extern__ 69 | kern_return_t 70 | vm_flush_cache( 71 | mach_port_t target_task, 72 | vm_address_t address, 73 | vm_size_t size) 74 | { 75 | #if !defined(__m68k__) && !defined(__i386__) 76 | vm_machine_attribute_val_t value; 77 | value = MATTR_VAL_ICACHE_FLUSH; 78 | return(vm_machine_attribute(target_task, address, size, MATTR_CACHE, 79 | &value)); 80 | #endif 81 | #ifdef __m68k__ 82 | asm("trap #2"); 83 | return(KERN_SUCCESS); 84 | #endif 85 | #ifdef __i386__ 86 | asm("jmp 1f"); 87 | asm("1: nop"); 88 | return(KERN_SUCCESS); 89 | #endif 90 | } 91 | 92 | #endif /* __3_2_User_with_hppa__ */ 93 | #endif /* !defined(RLD) */ 94 | -------------------------------------------------------------------------------- /man/Mach-O.5: -------------------------------------------------------------------------------- 1 | .TH MACH-O 5 "October 22, 2001" "Apple Computer, Inc." 2 | .SH NAME 3 | Mach-O \- Mach-O assembler and link editor output 4 | .SH SYNOPSIS 5 | .nf 6 | .B #include 7 | .B #include 8 | .B #include 9 | .B #include 10 | .fi 11 | .SH DESCRIPTION 12 | The object files produced by the assembler and link editor are in Mach-O 13 | (Mach object) file format. 14 | The file name 15 | .I a.out 16 | is the default output file name of the assembler 17 | .IR as (1) 18 | and the link editor 19 | .IR ld (1) 20 | . 21 | The format of the object file however is not 4.3BSD a.out format as the 22 | name suggests, but rather Mach-O format. 23 | The link editor will make 24 | .I a.out 25 | executable if the resulting format is an executable type and there were no 26 | errors and no unresolved external references. 27 | .PP 28 | The complete description of a Mach-O file is given in a number of include files. 29 | The file describes the headers, describes 30 | the symbol table entries with supplementing it, 31 | and describes the relocation entries. 32 | .PP 33 | The actual instructions and data used by the program represented by a Mach-O 34 | file are the contents of its sections. Sections are grouped together in 35 | segments. Each section carries with it, in its header, the information as to 36 | which segment it belongs in. When a file type that is executable is created 37 | the sections are placed in their proper segment and all the segment headers are 38 | created and the segments themselves are padded out to the segment alignment 39 | (typically the target pagesize). For the object file type produced by an 40 | assembler (or by the link editor for further linking) all the sections are 41 | placed in one segment for compactness. 42 | .PP 43 | When the kernel executes a Mach-O file it maps in the object file's segments, 44 | the dynamic link editor (if used) and creates the thread(s) for execution. Any 45 | part of the object file that is not part of a segment is not mapped in for 46 | execution. For executable using the dynamic link editor the headers and other 47 | link edit information is needed to execute the file. These parts include the 48 | relocation entries, the symbol table and the string table. These parts are 49 | mapped in with the use of the link editor's 50 | .B \-seglinkedit 51 | option which creates a segment that contains these parts. 52 | These parts can be stripped down with the 53 | .B \-S 54 | option to 55 | .IR ld (1) 56 | or various options to 57 | .IR strip (1). 58 | .PP 59 | .SH "SEE ALSO" 60 | as(1), ld(1), nm(1), gdb(1), stab(5), strip(1) 61 | -------------------------------------------------------------------------------- /man/Makefile: -------------------------------------------------------------------------------- 1 | ifneq "" "$(wildcard /bin/mkdirs)" 2 | MKDIRS = /bin/mkdirs 3 | else 4 | MKDIRS = /bin/mkdir -p 5 | endif 6 | 7 | DYLD_MAN1 = dyld.1 8 | OS_MAN1 = strings.1 lipo.1 9 | COMMON_MAN1 = as.1 nm.1 otool.1 ranlib.1 segedit.1 size.1 \ 10 | strip.1 libtool.1 cmpdylib.1 pagestuff.1 \ 11 | redo_prebinding.1 nmedit.1 install_name_tool.1 \ 12 | codesign_allocate.1 ctf_insert.1 bitcode_strip.1 13 | DEAD = gprof.1 14 | 15 | DYLD_MAN3 = dyld.3 NSModule.3 NSObjectFileImage.3 dyld_debug.3 16 | MAN3 = kld.3 arch.3 get_end.3 end.3 getsectbyname.3 \ 17 | getsectbynamefromheader.3 getsectdata.3 getsectdatafromheader.3 \ 18 | getsegbyname.3 19 | 20 | MAN5 = Mach-O.5 a.out.5 ranlib.5 stab.5 21 | 22 | MANL = indr.1 checksyms.1 seg_addr_table.1 check_dylib.1 23 | 24 | EFI1 = mtoc.1 25 | 26 | DYLD_MANL3 = NSObjectFileImage_priv.3 27 | MANL3 = libsyminfo.3 redo_prebinding.3 28 | 29 | INSTALL_FILES = Makefile $(OS_MAN1) $(COMMON_MAN1) $(MAN3) $(MAN5) $(MANL) \ 30 | $(MANL3) $(DYLD_MAN1) $(DYLD_MAN3) $(DYLD_MANL3) $(EFI1) notes 31 | 32 | MANDIR = /usr/share/man 33 | LOCMANDIR = /usr/local/man 34 | EFIMANDIR = /usr/local/efi/share/man 35 | DSTDIRS_MAN1 = $(DSTROOT)$(MANDIR)/man1 36 | DSTDIRS = $(DSTROOT)$(MANDIR)/man3 \ 37 | $(DSTROOT)$(MANDIR)/man5 $(DSTROOT)$(LOCMANDIR)/man1 \ 38 | $(DSTROOT)$(LOCMANDIR)/man3 $(DSTROOT)$(EFIMANDIR)/man1 39 | 40 | install_os_tools: $(DSTDIRS_MAN1) $(OS_MAN1) 41 | install -c -m 444 $(OS_MAN1) $(DSTROOT)$(MANDIR)/man1 42 | 43 | install: $(DSTDIRS) $(DSTDIRS_MAN1) $(COMMON_MAN1) $(MAN3) $(MAN5) $(MANL) \ 44 | $(RC_OS) $(MANL3) install_os_tools 45 | install -c -m 444 $(COMMON_MAN1) $(DSTROOT)$(MANDIR)/man1 46 | if [ $(OLD_DYLD_STUFF) ]; \ 47 | then \ 48 | install -c -m 444 $(DYLD_MAN1) $(DSTROOT)$(MANDIR)/man1 ; \ 49 | fi 50 | install -c -m 444 $(MAN3) $(DSTROOT)$(MANDIR)/man3 51 | if [ $(OLD_DYLD_STUFF) ]; \ 52 | then \ 53 | install -c -m 444 $(DYLD_MAN3) $(DSTROOT)$(MANDIR)/man3 ; \ 54 | fi 55 | install -c -m 444 $(MAN5) $(DSTROOT)$(MANDIR)/man5 56 | install -c -m 444 $(MANL) $(DSTROOT)$(LOCMANDIR)/man1 57 | install -c -m 444 $(MANL3) $(DSTROOT)$(LOCMANDIR)/man3 58 | install -c -m 444 $(EFI1) $(DSTROOT)$(EFIMANDIR)/man1 59 | if [ $(OLD_DYLD_STUFF) ]; \ 60 | then \ 61 | install -c -m 444 $(DYLD_MANL3) $(DSTROOT)$(LOCMANDIR)/man3;\ 62 | fi 63 | 64 | teflon macos: 65 | 66 | nextstep: 67 | 68 | installsrc: 69 | $(MKDIRS) $(SRCROOT) 70 | chmod 755 $(SRCROOT) 71 | gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) 72 | chmod 444 $(SRCROOT)/* 73 | 74 | $(DSTDIRS) $(DSTDIRS_MAN1): 75 | $(MKDIRS) $@ 76 | 77 | clean shlib_clean: 78 | 79 | all: 80 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /man/a.out.5: -------------------------------------------------------------------------------- 1 | .so man5/Mach-O.5 2 | -------------------------------------------------------------------------------- /man/bitcode_strip.1: -------------------------------------------------------------------------------- 1 | .TH BITCODE_STRIP 1 "June 8, 2015" "Apple, Inc." 2 | .SH NAME 3 | bitcode_strip \- remove or leave the bitcode segment in a Mach-O file 4 | .SH SYNOPSIS 5 | .B bitcode_strip 6 | input [ \-r | \-m | \-l ] \-o output 7 | .SH DESCRIPTION 8 | .I bitcode_strip 9 | edits the input Mach-O file and with the \-r option removes the bitcode segment, 10 | the segment named __LLVM and its section. With the \-m option removes the bitcode 11 | segment but leaves a marker. Or with the -l option leaves only the bitcode segment 12 | in the Mach-O file. If the Mach-O file, or slice of a universal file, does not have a 13 | bitcode segment, it is left essentially unchanged. 14 | .TP 15 | .BI input 16 | specifies the input Mach-O file to operate on. 17 | .TP 18 | .BI \-o " output" 19 | specifies the output file as 20 | .I output. 21 | .TP 22 | .B \-r 23 | specifies the bitcode segment is to be removed. 24 | .TP 25 | .B \-m 26 | specifies the bitcode segment is to be removed and a marker is left. 27 | .TP 28 | .BI \-l 29 | specifies that only the bitcode segment is to be left in the Mach-O file. 30 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /man/cmpdylib.1: -------------------------------------------------------------------------------- 1 | .TH CMPDYLIB 1 "November 3, 1997" "Apple Computer, Inc." 2 | .SH NAME 3 | cmpdylib \- compare two dynamic shared libraries for compatibility 4 | .SH SYNOPSIS 5 | .B cmpdylib 6 | .I oldLibrary 7 | .I newLibrary 8 | .SH DESCRIPTION 9 | .B cmpdylib 10 | compares two versions of a dynamic shared library to see if they are compatible 11 | with each other. If the two versions are incompatible, the reason is printed to 12 | stdout, and the exit status is nonzero. If they are compatible, nothing is 13 | printed, and the exit status is zero. 14 | .PP 15 | To see if the two versions are compatible, 16 | .B cmpdylib 17 | first verifies that 18 | .I newLibrary 19 | was built for all of the architectures that 20 | .I oldLibrary 21 | was built for. If so, for each architecture, it checks to see if the global 22 | symbols defined in 23 | .I oldLibrary 24 | are still defined in 25 | .I newLibrary. 26 | It then looks for new symbols, symbols defined in 27 | .I newLibrary 28 | that are not defined in 29 | .I oldLibrary. 30 | If it finds new symbols, it compares the compatibility version numbers of 31 | the two libraries. If the compatibility version number of 32 | .I newLibrary 33 | is greater than 34 | .IR oldLibrary , 35 | the libraries are still compatible. 36 | If the compatibility version number is the same or less, the 37 | libraries are incompatible. 38 | .SH OPTIONS 39 | .TP 40 | .I oldLibrary 41 | The older version of the library. 42 | .TP 43 | .I newLibrary 44 | The newer version of the library. 45 | .SH EXAMPLES 46 | This example shows the result of performing 47 | .B cmpdylib 48 | on two incompatible versions of the Foundation library. As stated, the versions 49 | are incompatible because the newer version was not built for the ppc 50 | architecture. 51 | .PP 52 | cmpdylib /System/Library/Frameworks/Foundation.framework/Foundation Foundation_proj/Foundation 53 | .br 54 | cmpdylib: file: Foundation_proj/Foundation does not contain architecture: ppc 55 | .br 56 | cmpdylib: new dynamic shared library: Foundation_proj/Foundation does not contain architecture ppc 57 | .SH DIAGNOSTICS 58 | The exit status is zero if the library versions are compatible and nonzero if they are incompatible. 59 | .SH BUGS 60 | There are lots of other things that could be checked for that 61 | are not (such as the Objective C API). 62 | 63 | -------------------------------------------------------------------------------- /man/codesign_allocate.1: -------------------------------------------------------------------------------- 1 | .TH CODESIGN_ALLOCATE 1 "March 16, 2009" "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 embedded 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 | -------------------------------------------------------------------------------- /man/ctf_insert.1: -------------------------------------------------------------------------------- 1 | .TH CODESIGN_ALLOCATE 1 "March 2, 2010" "Apple, Inc." 2 | .SH NAME 3 | ctf_insert \- insert the (__CTF,__ctf) section data into the mach_kernel file 4 | .SH SYNOPSIS 5 | .B ctf_insert 6 | input [ \-arch arch file ]... \-o output 7 | .SH DESCRIPTION 8 | .I ctf_insert 9 | inserts the cft (Compact File Type) data into a mach_kernel creating 10 | (__CTF,__ctf) sections. The input must not have this section or it is an error. 11 | And the program must be passed one \-arch argument for each architecture in a 12 | universal file, or exactly one \-arch for a thin file. 13 | .TP 14 | .BI input 15 | specifies the input mach_kernel. 16 | .TP 17 | .BI \-o " output" 18 | specifies the output file. 19 | .TP 20 | .BI \-arch " arch file" 21 | specifies for the file containing the cft (Compact File Type) data to be used 22 | for the specified 23 | .I arch 24 | whos content will be the section's data. 25 | -------------------------------------------------------------------------------- /man/end.3: -------------------------------------------------------------------------------- 1 | .so man3/get_end.3 2 | -------------------------------------------------------------------------------- /man/get_end.3: -------------------------------------------------------------------------------- 1 | .TH GET_END 3 "April 10, 1998" "Apple Computer, Inc." 2 | .SH NAME 3 | get_end, get_etext, get_edata \- get values of UNIX link editor defined symbols 4 | .SH SYNOPSIS 5 | .nf 6 | .PP 7 | #include 8 | .sp 9 | unsigned long \fBget_end()\fR; 10 | unsigned long \fBget_etext()\fR; 11 | unsigned long \fBget_edata()\fR; 12 | .fi 13 | .SH DESCRIPTION 14 | These routines provide a stopgap measure to programs that use the 15 | .SM UNIX 16 | link-editor defined symbols. Use of these routines is very strongly 17 | discouraged. The problem is that any program that is using 18 | .SM UNIX 19 | link editor defined symbols (_end, _etext or _edata) is making assumptions that 20 | the program has the memory layout of a UNIX program. 21 | .PP 22 | This is an incorrect assumption for a program built by the Mach-O link 23 | editor. The reason that these routines are provided is that if very minimal 24 | assumptions about the layout are used and the default format and memory layout 25 | of the Mach-O link editor is used to build the program, some things may work by 26 | using the values returned by these routines in place of the addresses of their 27 | UNIX link-editor defined symbols. So use at your own risk, and only if you 28 | know what your doing. 29 | Or better yet, convert the program to use the appropriate Mach or Mach-O 30 | functions. If you are trying to allocate memory use 31 | .IR vm_allocate (2), 32 | if you are trying to find out about your address space use 33 | .IR vm_region (2) 34 | and if you are trying to find out where your program is loaded use the 35 | .IR dyld (3) 36 | functions. 37 | .PP 38 | The values of the UNIX link-editor defined symbols _etext, _edata and _end are 39 | returned by the routines get_etext, get_edata, and get_end respectively. 40 | In a Mach-O file they have the following values: 41 | get_etext returns the first address after the 42 | .SM (\_\^\_TEXT,\_\^\_text) 43 | section, note this my or may not be the only section in the \_\^\_TEXT segment. 44 | get_edata returns the first address after the 45 | .SM (\_\^\_DATA,\_\^\_data) 46 | section, note this my or may not be the last non-zero fill section in 47 | the \_\^\_DATA segment. 48 | get_end returns the first address after 49 | the last segment in the executable, note a shared library may be loaded at this 50 | address. 51 | .SH "SEE ALSO" 52 | ld(1), dyld(3) 53 | -------------------------------------------------------------------------------- /man/getsectbyname.3: -------------------------------------------------------------------------------- 1 | .TH GETSECTBYNAME 3 "April 10, 1998" "Apple Computer, Inc." 2 | .SH NAME 3 | getsectbyname, getsectdata \- get the section information for the named section 4 | .SH SYNOPSIS 5 | .nf 6 | \fB#include \fR 7 | .PP 8 | const struct section *\fBgetsectbynamefromheader\fR( 9 | const struct mach_header *\fImhp\fR, 10 | const char *\fIsegname\fR, 11 | const char *\fIsectname\fR) 12 | .sp .5 13 | const struct section *\fBgetsectbyname\fR( 14 | const char *\fIsegname\fR, 15 | const char *\fIsectname\fR) 16 | .sp .5 17 | char *\fBgetsectdatafromheader\fR( 18 | const struct mach_header *\fImhp\fR, 19 | const char *\fIsegname\fR, 20 | const char *\fIsectname\fR, 21 | unsigned long *\fIsize\fR) 22 | .sp .5 23 | char *\fBgetsectdata\fR( 24 | const char *\fIsegname\fR, 25 | const char *\fIsectname\fR, 26 | unsigned long *\fIsize\fR) 27 | .sp .5 28 | char *\fBgetsectdatafromFramework\fR( 29 | const char *\fIFrameworkName\fR, 30 | const char *\fIsegname\fR, 31 | const char *\fIsectname\fR, 32 | unsigned long *\fIsize\fR) 33 | .fi 34 | .SH DESCRIPTION 35 | .I Getsectbynamefromheader 36 | returns the section structure for the named section in the named segment if it 37 | exists in the specified Mach header otherwise it returns 38 | .SM NULL. 39 | If the specified Mach header comes from a dynamic library as returned by 40 | .IR _dyld_get_image_header (3) 41 | the 42 | .I addr 43 | field in the section structure will have to have 44 | .IR _dyld_get_image_vmaddr_slide (3) 45 | added to it to make it a valid pointer. 46 | .PP 47 | .I Getsectbyname 48 | is the same as 49 | .I getsectbynamefromheader 50 | with its first argument being the link editor defined symbol 51 | .I _mh_execute_header. 52 | .PP 53 | .I Getsectdatafromheader 54 | returns the address to the data for the named section in the named segment if 55 | it exists in the specified Mach header. Also it returns the size of the section 56 | data indirectly through the pointer size. 57 | Otherwise it returns 58 | .SM NULL 59 | for the pointer and zero for the size. 60 | If the specified Mach header comes from a dynamic library as returned by 61 | .IR _dyld_get_image_header (3) 62 | the address to the data returned will have to have 63 | .IR _dyld_get_image_vmaddr_slide (3) 64 | added to it to make it a valid pointer. 65 | .PP 66 | .I Getsectdata 67 | is the same as 68 | .I getsectdatafromheader 69 | with its first argument being the link editor defined symbol 70 | .I _mh_execute_header. 71 | .PP 72 | .I getsectdatafromFramework 73 | is used to get the named section data from the named Framework. 74 | For example, the framework name ``Appkit'' would be used 75 | for /System/Library/Frameworks/Appkit.framework/Versions/C/Appkit. 76 | If that Framework isn't being used by the program then it 77 | returns 78 | .SM NULL 79 | for the pointer and zero for the size. 80 | .SH "SEE ALSO" 81 | dyld(3), getsegbyname(3) 82 | -------------------------------------------------------------------------------- /man/getsectbynamefromheader.3: -------------------------------------------------------------------------------- 1 | .so man3/getsectbyname.3 2 | -------------------------------------------------------------------------------- /man/getsectdata.3: -------------------------------------------------------------------------------- 1 | .so man3/getsectbyname.3 2 | -------------------------------------------------------------------------------- /man/getsectdatafromheader.3: -------------------------------------------------------------------------------- 1 | .so man3/getsectbyname.3 2 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /man/indr.1: -------------------------------------------------------------------------------- 1 | .TH INDR 1 "July 28, 2005" "Apple Computer, Inc." 2 | .SH NAME 3 | indr \- add indirection to symbols in object files 4 | .SH SYNOPSIS 5 | .B indr 6 | [\-n] [[\-arch arch_type] ...] list input output 7 | .sp .5 8 | .B indr 9 | [\-n] [[\-arch_indr arch_type list] ...] input output 10 | .SH DESCRIPTION 11 | .I Indr 12 | builds the output file, 13 | .I output, 14 | by translating each symbol name listed in the file 15 | .I list 16 | to the same name with and underbar prepended to it in all the 17 | objects in the input file, 18 | .I input. 19 | This is used in building the ANSI C library and ``hiding'' non-ANSI C library 20 | symbols that are used by the ANSI C routines. 21 | The input file can be either and object file or an archive and the output 22 | file will be the same type as the input file. 23 | Then it if the input file is an archive and the 24 | .B \-n 25 | flag is not specified then it creates an object for each of these 26 | symbols with an indirect symbol (n_type == N_INDR) for the symbol name with an 27 | underbar and adds that to the output archive. 28 | .PP 29 | Some or all of the following options may be specified: 30 | .TP 31 | .B \-n 32 | Suppress creating the indirect objects when the output file is an archive. 33 | This is assumed when the output file is an object file. 34 | .TP 35 | .BI \-arch " arch_type" 36 | Specifies the architecture, 37 | .I arch_type, 38 | of the file for 39 | .IR indr (1) 40 | to process when the file is a universal file (see 41 | .IR arch (3) 42 | for the currently know 43 | .IR arch_type s). 44 | The 45 | .I arch_type 46 | can be 47 | .I all 48 | to process all architectures in the file. 49 | The default is to process only the host architecture if that is contained in 50 | the file if not and only one architecture is present in the file then it is 51 | processed. In all other cases the architecture(s) to process must be specified 52 | with this flag. 53 | .TP 54 | .BI \-arch " arch_type list" 55 | Same as above but specifies the list of symbol that applys only to this 56 | architecture. 57 | .SH SEE ALSO 58 | Mach-O(5), arch(3) 59 | -------------------------------------------------------------------------------- /man/install_name_tool.1: -------------------------------------------------------------------------------- 1 | .TH INSTALL_NAME_TOOL 1 "March 4, 2009" "Apple, Inc." 2 | .SH NAME 3 | install_name_tool \- change dynamic shared library install names 4 | .SH SYNOPSIS 5 | .B install_name_tool 6 | [\-change old new ] ... [\-rpath old new ] ... [\-add_rpath new ] ... [\-delete_rpath new ] ... [\-id name] file 7 | .SH DESCRIPTION 8 | .I Install_name_tool 9 | changes the dynamic shared library install names and or adds, changes or deletes 10 | the rpaths recorded in a Mach-O binary. 11 | For this tool to work when the install names or rpaths are larger the binary 12 | should be built with the 13 | .IR ld (1) 14 | .B \-headerpad_max_install_names 15 | option. 16 | .TP 17 | .BI \-change " old new" 18 | Changes the dependent shared library install name 19 | .I old 20 | to 21 | .I new 22 | in the specified Mach-O binary. More than one of these options can be 23 | specified. 24 | If the Mach-O binary does not contain the 25 | .I old 26 | install name in a specified 27 | .B \-change 28 | option the option is ignored. 29 | .TP 30 | .BI \-id " name" 31 | Changes the shared library identification name of a dynamic shared library to 32 | .I name. 33 | If the Mach-O binary is not a dynamic shared library and the 34 | .B \-id 35 | option is specified it is ignored. 36 | .TP 37 | .BI \-rpath " old new" 38 | Changes the rpath path name 39 | .I old 40 | to 41 | .I new 42 | in the specified Mach-O binary. More than one of these options can be 43 | specified. 44 | If the Mach-O binary does not contain the 45 | .I old 46 | rpath path name in a specified 47 | .B \-rpath 48 | it is an error. 49 | .TP 50 | .BI \-add_rpath " new" 51 | Adds the rpath path name 52 | .I new 53 | in the specified Mach-O binary. More than one of these options can be 54 | specified. 55 | If the Mach-O binary already contains the 56 | .I new 57 | rpath path name specified in 58 | .B \-add_rpath 59 | it is an error. 60 | .TP 61 | .BI \-delete_rpath " old" 62 | deletes the rpath path name 63 | .I old 64 | in the specified Mach-O binary. More than one of these options can be 65 | specified. 66 | If the Mach-O binary does not contains the 67 | .I old 68 | rpath path name specified in 69 | .B \-delete_rpath 70 | it is an error. 71 | .SH "SEE ALSO" 72 | ld(1) 73 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /man/pagestuff.1: -------------------------------------------------------------------------------- 1 | .TH PAGESTUFF 1 "November 2, 2010" "Apple, Inc." 2 | .SH NAME 3 | pagestuff \- Mach-O file page analysis tool 4 | .SH SYNOPSIS 5 | pagestuff file [-arch arch_flag] [-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 \-arch " arch_type" 18 | Specifies the architecture, 19 | .I arch_type, 20 | of the file for 21 | .IR pagestuff (1) 22 | to operate on when the file is a universal file. (See 23 | .IR arch (3) 24 | for the currently know 25 | .IR arch_type s.) 26 | When this option is used the page numbers are the logical page numbers starting 27 | at zero for the offset that architecture starts in a universal file. 28 | .TP 29 | .BI \-a 30 | Displays all pages. All other arguments are ignored. 31 | .TP 32 | .BI \-p 33 | Print a list of the sections of the specified Mach-O file, with offsets and 34 | lengths. All other arguments are ignored. Note that the size(1) tool given 35 | arguments "-m -l -x" displays a much more concise listing. 36 | .SH "SEE ALSO" 37 | Mach-O(5), size(1) 38 | -------------------------------------------------------------------------------- /man/ranlib.1: -------------------------------------------------------------------------------- 1 | .so man1/libtool.1 2 | -------------------------------------------------------------------------------- /man/segedit.1: -------------------------------------------------------------------------------- 1 | .TH SEGEDIT 1 "October 23, 1997" "Apple Computer, Inc." 2 | .SH NAME 3 | segedit \- extract and replace sections from object files 4 | .SH SYNOPSIS 5 | .B segedit 6 | [ option ] name ... 7 | .I input_file 8 | [\-extract 9 | .IR "segname sectname filename" "] ..." 10 | [[\-replace 11 | .IR "segname sectname filename" "] ..." 12 | \-output 13 | .IR output_file ] 14 | .SH DESCRIPTION 15 | .I Segedit 16 | extracts and or replaces the named sections from the 17 | .I input_file 18 | and creates an 19 | .I output_file 20 | (if replacing a section). The segment and section names are 21 | the same as specified to 22 | .IR ld (1) 23 | with the 24 | .B \-segcreate 25 | option. The segment and section names of an object file can be examined with 26 | the 27 | .B \-l 28 | option to 29 | .IR otool (1). 30 | Only sections in segments that have no relocation to or for them can be 31 | replaced (marked with the 32 | .SM SG_NORELOC 33 | segment flag) but all sections can be 34 | extracted. 35 | .PP 36 | The options to 37 | .IR segedit (1): 38 | .TP 39 | .BI \-extract " segname sectname filename" 40 | Extracts the section specified by the segment name section name pair and places 41 | the contents in the specified 42 | .I filename. 43 | .TP 44 | .BI \-replace " segname sectname filename" 45 | Will replace the section specified by the segment name section name pair and 46 | places and take the new contents for the section from the specified 47 | .I filename. 48 | The 49 | .BI \-output " filename" 50 | option must also be specified. 51 | The resulting size of the section will be rounded to a multiple of 4 bytes and 52 | padded with zero bytes if necessary. 53 | .TP 54 | .BI \-output " output_file" 55 | Specifies the output file to create when replacing sections. 56 | .SH "SEE ALSO" 57 | ld(1), otool(1) 58 | .SH "LIMITATIONS" 59 | Only mach-O format files that are laid out in a contiguous address space 60 | and with their contents ordered in the order of increasing address can have 61 | their segments replaced by this program. This layout is what the link editor 62 | produces by default. 63 | -------------------------------------------------------------------------------- /man/size.1: -------------------------------------------------------------------------------- 1 | .TH SIZE 1 "July 28, 2005" "Apple Computer, Inc." 2 | .SH NAME 3 | size \- print the size of the sections in an object file 4 | .SH SYNOPSIS 5 | .B size 6 | [ option ... ] [ object ... ] 7 | .SH DESCRIPTION 8 | .I Size 9 | (without the 10 | .B \-m 11 | option) prints the (decimal) number of bytes required by the \_\^\_TEXT, 12 | \_\^\_DATA and \_\^\_OBJC segments. All other segments are totaled and 13 | that size is listed in the `others' column. The final two columns is 14 | the sum in decimal and hexadecimal. 15 | If no file is specified, 16 | .B a.out 17 | is used. 18 | .PP 19 | The options to 20 | .IR size (1) 21 | are: 22 | .TP 23 | .B \- 24 | Treat the remaining arguments as name of object files not options to 25 | .IR size (1). 26 | .TP 27 | .B \-m 28 | Print the sizes of the Mach-O segments and sections as well as the total sizes 29 | of the sections in each segment and the total size of the segments in the file. 30 | .TP 31 | .B \-l 32 | When used with the 33 | .B \-m 34 | option, also print the addresses and offsets of the sections and segments. 35 | .TP 36 | .B \-x 37 | When used with the 38 | .B \-m 39 | option, 40 | print the values in hexadecimal (with leading 0x's) rather than decimal. 41 | .TP 42 | .BI \-arch " arch_type" 43 | Specifies the architecture, 44 | .I arch_type, 45 | of the file for 46 | .IR size (1) 47 | to operate on when the file is a universal file. (See 48 | .IR arch (3) 49 | for the currently know 50 | .IR arch_type s.) 51 | The 52 | .I arch_type 53 | can be "all" to operate on all architectures in the file. 54 | The default is to display only the host architecture, if the file contains it; 55 | otherwise, all architectures in the file are shown. 56 | .SH "SEE ALSO" 57 | otool(1) 58 | .SH BUGS 59 | The size of common symbols can't be reflected in any of the numbers for 60 | relocatable object files. 61 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /otool/Makefile: -------------------------------------------------------------------------------- 1 | export USE_APPLE_PB_SUPPORT = all 2 | 3 | ifeq "$(EFITOOLS)" "efitools" 4 | EFI_SUPPORT = -DEFI_SUPPORT 5 | endif 6 | 7 | ifneq "" "$(SDKROOT)" 8 | SDK = -isysroot $(SDKROOT) 9 | CC = $(shell xcrun -find -sdk $(SDKROOT) cc) 10 | CXX = $(shell xcrun -find -sdk $(SDKROOT) c++) 11 | DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) 12 | else 13 | DSYMUTIL = dsymutil 14 | endif 15 | 16 | OFLAG = -Os 17 | LTO = -DLTO_SUPPORT 18 | LEGACY = -D_MACH_I386_THREAD_STATUS_FPSTATE_LEGACY_FIELD_NAMES_ \ 19 | -D_ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_ 20 | CFLAGS = $(OFLAG) $(LTO) -g -Wall -I$(SRCROOT)/../include \ 21 | -I$(SRCROOT) $(LEGACY) $(EFI_SUPPORT) $(SDK) 22 | 23 | LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff 24 | CXXLIB = -stdlib=libc++ 25 | 26 | MKDIRS = /bin/mkdir -p 27 | SRCROOT = . 28 | SYMROOT = . 29 | OBJROOT = . 30 | OFILE_DIR = $(OBJROOT) 31 | VPATH = $(OFILE_DIR) 32 | 33 | BINDIR = /bin 34 | USRBINDIR = /usr/bin 35 | 36 | CFILES = main.c ofile_print.c m68k_disasm.c i860_disasm.c \ 37 | m88k_disasm.c i386_disasm.c ppc_disasm.c hppa_disasm.c \ 38 | sparc_disasm.c print_objc.c notify.c arm_disasm.c \ 39 | print_objc2_64bit.c print_objc2_32bit.c dyld_bind_info.c \ 40 | arm64_disasm.c print_bitcode.c 41 | ifeq "$(EFITOOLS)" "efitools" 42 | CFILES += coff_print.c 43 | endif 44 | HFILES = otool.h ofile_print.h m68k_disasm.h i860_disasm.h \ 45 | sparc_disasm.h m88k_disasm.h i386_disasm.h ppc_disasm.h hppa_disasm.h \ 46 | notify.h arm_disasm.h dyld_bind_info.h arm64_disasm.h cxa_demangle.h 47 | OBJS = $(CFILES:.c=.o) ofile.o 48 | INSTALL_FILES = $(CFILES) $(HFILES) Makefile notes 49 | 50 | PRODUCT = otool 51 | all: $(OFILE_DIR) $(SYMROOT) $(PRODUCT).NEW 52 | 53 | $(PRODUCT).NEW: $(OFILE_DIR) $(SYMROOT) $(OBJS) 54 | $(CC) $(RC_CFLAGS) -nostdlib -r -o $(OBJROOT)/private.o \ 55 | $(OBJS) $(LIBSTUFF) 56 | $(CXX) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/$@ $(OBJROOT)/private.o \ 57 | $(LIBSTUFF) $(CXXLIB) 58 | $(DSYMUTIL) $(SYMROOT)/$@ 59 | 60 | .c.o: 61 | $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< 62 | 63 | ofile.o: $(SRCROOT)/../libstuff/ofile.c 64 | $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o \ 65 | $(SRCROOT)/../libstuff/ofile.c -DOTOOL 66 | 67 | clean: shlib_clean 68 | -rm -f $(SYMROOT)/$(PRODUCT).NEW 69 | -rm -r -f *dSYM 70 | 71 | shlib_clean: 72 | -cd $(OFILE_DIR); rm -f $(OBJS) private.o 73 | -rm -f make.out 74 | 75 | install: all 76 | $(MKDIRS) $(DSTROOT)$(USRBINDIR) 77 | install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ 78 | $(DSTROOT)$(USRBINDIR)/$(PRODUCT) 79 | 80 | installsrc: 81 | $(MKDIRS) $(SRCROOT) 82 | chmod 755 $(SRCROOT) 83 | gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) 84 | chmod 444 $(SRCROOT)/* 85 | 86 | $(OFILE_DIR) $(SYMROOT): 87 | $(MKDIRS) $@ 88 | -------------------------------------------------------------------------------- /otool/arm64_disasm.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | #import 5 | #include "stuff/symbol.h" 6 | #include "llvm-c/Disassembler.h" 7 | 8 | extern uint32_t arm64_disassemble( 9 | char *sect, 10 | uint32_t left, 11 | uint64_t addr, 12 | uint32_t sect_addr, 13 | enum byte_sex object_byte_sex, 14 | struct relocation_info *relocs, 15 | uint32_t nrelocs, 16 | struct relocation_info *ext_relocs, 17 | uint32_t next_relocs, 18 | struct relocation_info *loc_relocs, 19 | uint32_t nloc_relocs, 20 | struct dyld_bind_info *dbi, 21 | uint64_t ndbi, 22 | struct nlist_64 *symbols64, 23 | uint32_t nsymbols, 24 | struct symbol *sorted_symbols, 25 | uint32_t nsorted_symbols, 26 | char *strings, 27 | uint32_t strings_size, 28 | uint32_t *indirect_symbols, 29 | uint32_t nindirect_symbols, 30 | struct load_command *load_commands, 31 | uint32_t ncmds, 32 | uint32_t sizeofcmds, 33 | char *object_addr, 34 | uint32_t object_size, 35 | enum bool verbose, 36 | LLVMDisasmContextRef dc); 37 | 38 | extern LLVMDisasmContextRef create_arm64_llvm_disassembler(void); 39 | extern void delete_arm64_llvm_disassembler(LLVMDisasmContextRef dc); 40 | -------------------------------------------------------------------------------- /otool/cxa_demangle.h: -------------------------------------------------------------------------------- 1 | extern 2 | char * 3 | __cxa_demangle( 4 | const char* mangled_name, 5 | char *output_buffer, 6 | size_t *length, 7 | int *status); 8 | -------------------------------------------------------------------------------- /otool/dyld_bind_info.h: -------------------------------------------------------------------------------- 1 | /* 2 | * The internal structure for the broken out bind info. 3 | */ 4 | struct dyld_bind_info { 5 | const char *segname; 6 | const char *sectname; 7 | uint64_t address; 8 | int bind_type; 9 | uint64_t addend; 10 | const char *dylibname; 11 | const char *symbolname; 12 | enum bool weak_import; 13 | }; 14 | 15 | extern void get_dyld_bind_info( 16 | const uint8_t *start, /* inputs */ 17 | const uint8_t *end, 18 | const char **dylibs, 19 | uint32_t ndylibs, 20 | struct segment_command **segs, 21 | uint32_t nsegs, 22 | struct segment_command_64 **segs64, 23 | uint32_t nsegs64, 24 | struct dyld_bind_info **dbi, /* outputs */ 25 | uint64_t *ndbi); 26 | 27 | extern void print_dyld_bind_info( 28 | struct dyld_bind_info *dbi, 29 | uint64_t ndbi); 30 | 31 | extern const char * get_dyld_bind_info_symbolname( 32 | uint64_t address, 33 | struct dyld_bind_info *dbi, 34 | uint64_t ndbi); 35 | -------------------------------------------------------------------------------- /otool/hppa_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @APPLE_LICENSE_HEADER_END@ 30 | */ 31 | #import 32 | #import 33 | #import 34 | #import 35 | #include "stuff/symbol.h" 36 | 37 | extern uint32_t hppa_disassemble( 38 | char *sect, 39 | uint32_t left, 40 | uint32_t addr, 41 | uint32_t sect_addr, 42 | enum byte_sex object_byte_sex, 43 | struct relocation_info *sorted_relocs, 44 | uint32_t nsorted_relocs, 45 | struct nlist *symbols, 46 | uint32_t nsymbols, 47 | struct symbol *sorted_symbols, 48 | uint32_t nsorted_symbols, 49 | char *strings, 50 | uint32_t strings_size, 51 | enum bool verbose); 52 | -------------------------------------------------------------------------------- /otool/i860_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @APPLE_LICENSE_HEADER_END@ 30 | */ 31 | #import 32 | #import 33 | #import 34 | #import 35 | #include "stuff/symbol.h" 36 | 37 | extern uint32_t i860_disassemble( 38 | char *sect, 39 | uint32_t left, 40 | uint32_t addr, 41 | uint32_t sect_addr, 42 | enum byte_sex object_byte_sex, 43 | struct relocation_info *sorted_relocs, 44 | uint32_t nsorted_relocs, 45 | struct nlist *symbols, 46 | uint32_t nsymbols, 47 | struct symbol *sorted_symbols, 48 | uint32_t nsorted_symbols, 49 | char *strings, 50 | uint32_t strings_size, 51 | enum bool verbose); 52 | -------------------------------------------------------------------------------- /otool/m68k_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @APPLE_LICENSE_HEADER_END@ 30 | */ 31 | #import 32 | #import 33 | #import 34 | #import 35 | #include "stuff/symbol.h" 36 | 37 | extern uint32_t m68k_disassemble( 38 | char *sect, 39 | uint32_t left, 40 | uint32_t addr, 41 | uint32_t sect_addr, 42 | enum byte_sex object_byte_sex, 43 | struct relocation_info *sorted_relocs, 44 | uint32_t nsorted_relocs, 45 | struct nlist *symbols, 46 | uint32_t nsymbols, 47 | struct symbol *sorted_symbols, 48 | uint32_t nsorted_symbols, 49 | char *strings, 50 | uint32_t strings_size, 51 | uint32_t *indirect_symbols, 52 | uint32_t nindirect_symbols, 53 | struct load_command *load_commands, 54 | uint32_t ncmds, 55 | uint32_t sizeofcmds, 56 | enum bool verbose); 57 | -------------------------------------------------------------------------------- /otool/m88k_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @APPLE_LICENSE_HEADER_END@ 30 | */ 31 | #import 32 | #import 33 | #import 34 | #import 35 | #include "stuff/symbol.h" 36 | 37 | extern uint32_t m88k_disassemble( 38 | char *sect, 39 | uint32_t left, 40 | uint32_t addr, 41 | uint32_t sect_addr, 42 | enum byte_sex object_byte_sex, 43 | struct relocation_info *sorted_relocs, 44 | uint32_t nsorted_relocs, 45 | struct nlist *symbols, 46 | uint32_t nsymbols, 47 | struct symbol *sorted_symbols, 48 | uint32_t nsorted_symbols, 49 | char *strings, 50 | uint32_t strings_size, 51 | enum bool verbose); 52 | -------------------------------------------------------------------------------- /otool/notify.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @APPLE_LICENSE_HEADER_END@ 30 | */ 31 | #ifndef __DYNAMIC__ 32 | #include 33 | 34 | uint32_t notify_post(const char *name) 35 | { 36 | return 0; 37 | } 38 | 39 | uint32_t notify_register_check(const char *name, int *out_token) 40 | { 41 | *out_token = 0; 42 | return 0; 43 | } 44 | 45 | uint32_t notify_register_signal(const char *name, int sig, int *out_token) 46 | { 47 | *out_token = 0; 48 | return 0; 49 | } 50 | 51 | uint32_t notify_register_mach_port(const char *name, mach_port_t *notify_port, int flags, int *out_token) 52 | { 53 | *notify_port = MACH_PORT_NULL; 54 | out_token = 0; 55 | return 0; 56 | } 57 | 58 | uint32_t notify_register_file_descriptor(const char *name, int *notify_fd, int flags, int *out_token) 59 | { 60 | *notify_fd = 0; 61 | out_token = 0; 62 | return 0; 63 | } 64 | 65 | uint32_t notify_check(int token, int *check) 66 | { 67 | *check = 1; 68 | return 0; 69 | } 70 | 71 | uint32_t notify_cancel(int token) 72 | { 73 | return 0; 74 | } 75 | 76 | int __notify_78945668_info__ = 0; 77 | 78 | uint32_t notify_monitor_file(int t, char *s, int f) 79 | { 80 | return 0; 81 | } 82 | #endif /* !defined(__DYNAMIC__) */ 83 | -------------------------------------------------------------------------------- /otool/ppc_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @APPLE_LICENSE_HEADER_END@ 30 | */ 31 | #import 32 | #import 33 | #import 34 | #import 35 | #include "stuff/symbol.h" 36 | 37 | extern uint32_t ppc_disassemble( 38 | char *sect, 39 | uint32_t left, 40 | uint32_t addr, 41 | uint32_t sect_addr, 42 | enum byte_sex object_byte_sex, 43 | struct relocation_info *relocs, 44 | uint32_t nrelocs, 45 | struct nlist *symbols, 46 | struct nlist_64 *symbols64, 47 | uint32_t nsymbols, 48 | struct symbol *sorted_symbols, 49 | uint32_t nsorted_symbols, 50 | char *strings, 51 | uint32_t strings_size, 52 | uint32_t *indirect_symbols, 53 | uint32_t nindirect_symbols, 54 | struct load_command *load_commands, 55 | uint32_t ncmds, 56 | uint32_t sizeofcmds, 57 | enum bool verbose); 58 | -------------------------------------------------------------------------------- /otool/sparc_disasm.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright © 2009 Apple Inc. All rights reserved. 3 | * 4 | * @APPLE_LICENSE_HEADER_START@ 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * 1. Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 2. Redistributions in binary form must reproduce the above copyright notice, 12 | * this list of conditions and the following disclaimer in the documentation 13 | * and/or other materials provided with the distribution. 14 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of its 15 | * contributors may be used to endorse or promote products derived from this 16 | * software without specific prior written permission. 17 | * 18 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 19 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 20 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 21 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY 22 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 23 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 24 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 25 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | * 29 | * @APPLE_LICENSE_HEADER_END@ 30 | */ 31 | #import 32 | #import 33 | #import 34 | #import 35 | #include "stuff/symbol.h" 36 | 37 | extern uint32_t sparc_disassemble( 38 | char *sect, 39 | uint32_t left, 40 | uint32_t addr, 41 | uint32_t sect_addr, 42 | enum byte_sex object_byte_sex, 43 | struct relocation_info *sorted_relocs, 44 | uint32_t nsorted_relocs, 45 | struct nlist *symbols, 46 | uint32_t nsymbols, 47 | struct symbol *sorted_symbols, 48 | uint32_t nsorted_symbols, 49 | char *strings, 50 | uint32_t strings_size, 51 | uint32_t *indirect_symbols, 52 | uint32_t nindirect_symbols, 53 | struct load_command *load_commands, 54 | uint32_t ncmds, 55 | uint32_t sizeofcmds, 56 | enum bool verbose); 57 | --------------------------------------------------------------------------------