From 47b982940de02562fec0283429925274c61612ec Mon Sep 17 00:00:00 2001 From: Iain Sandoe Date: Wed, 13 May 2015 23:24:22 +0100 Subject: [PATCH] 845 --- cctools/Makefile | 9 +- cctools/RelNotes/Private_CompilerTools.html | 127 +- cctools/ar/Makefile | 41 +- cctools/as/Makefile | 80 +- cctools/as/as.c | 33 + cctools/as/driver.c | 12 + cctools/as/dwarf2dbg.c | 1 + cctools/as/i386.c | 12 +- cctools/as/i860.c | 2 +- cctools/as/m88k.c | 2 +- cctools/as/notes | 21 +- cctools/as/ppc.c | 2 +- cctools/as/sparc.c | 2 +- cctools/cbtlibs/Makefile | 36 +- cctools/efitools/Makefile | 40 +- cctools/gprof/Makefile | 66 +- cctools/gprof/notes | 3 + cctools/include/llvm-c/Disassembler.h | 46 +- cctools/include/mach-o/arch.h | 4 +- cctools/include/mach-o/dyld.h | 4 +- cctools/include/mach-o/dyld_priv.h | 4 +- cctools/include/mach-o/getsect.h | 4 +- cctools/include/mach-o/loader.h | 14 +- cctools/include/mach-o/nlist.h | 4 +- cctools/include/mach-o/redo_prebinding.h | 4 +- cctools/include/mach-o/swap.h | 4 +- cctools/include/mach/machine.h | 4 + cctools/include/notes | 37 +- cctools/include/stuff/bytesex.h | 4 + cctools/include/stuff/errors.h | 40 +- cctools/include/stuff/llvm.h | 5 + cctools/ld/Makefile | 16 +- cctools/ld/notes | 4 +- cctools/libmacho/Makefile | 171 +- cctools/libmacho/arch.c | 6 + cctools/libmacho/notes | 19 +- cctools/libmacho/slot_name.c | 66 + cctools/libstuff/Makefile | 68 +- cctools/libstuff/arch.c | 3 + cctools/libstuff/best_arch.c | 15 + cctools/libstuff/bytesex.c | 11 + cctools/libstuff/get_arch_from_host.c | 24 + cctools/libstuff/llvm.c | 41 +- cctools/libstuff/lto.c | 15 + cctools/libstuff/notes | 31 +- cctools/libstuff/ofile.c | 18 + cctools/libstuff/swap_headers.c | 15 + cctools/man/Makefile | 3 +- cctools/man/gprof.1 | 284 --- cctools/man/notes | 6 +- cctools/man/otool.1 | 7 +- cctools/misc/Makefile | 110 +- cctools/misc/install_name_tool.c | 1 + cctools/misc/lipo.c | 85 +- cctools/misc/notes | 3411 +++------------------------ cctools/otool/Makefile | 256 +- cctools/otool/arm_disasm.c | 143 +- cctools/otool/arm_disasm.h | 11 +- cctools/otool/i386_disasm.c | 65 +- cctools/otool/i386_disasm.h | 7 +- cctools/otool/main.c | 261 +- cctools/otool/notes | 88 +- cctools/otool/ofile_print.c | 138 +- cctools/otool/ofile_print.h | 11 +- cctools/otool/otool.h | 20 +- 65 files changed, 1858 insertions(+), 4239 deletions(-) create mode 100644 cctools/libmacho/slot_name.c delete mode 100644 cctools/man/gprof.1 rewrite cctools/misc/notes (90%) rewrite cctools/otool/Makefile (61%) diff --git a/cctools/Makefile b/cctools/Makefile index 494d585..f439f92 100644 --- a/cctools/Makefile +++ b/cctools/Makefile @@ -234,14 +234,14 @@ lib_ofiles lib_ofiles_install: installhdrs SRCROOT=$(SRCROOT)/libstuff \ OBJROOT=$(OBJROOT)/libstuff \ SYMROOT=$(SYMROOT)/libstuff $@) || exit 1; \ - echo =========== $(MAKE) all for libstuff =============; \ + echo ====== $(MAKE) lib_static_ofiles for libstuff =======; \ (cd libstuff; $(MAKE) "RC_CFLAGS=$$SED_RC_CFLAGS" \ RC_ARCHS="$(RC_ARCHS)" RC_OS="$(RC_OS)" \ OLD_LIBKLD="$(OLD_LIBKLD)" \ DSTROOT=$$DSTROOT \ SRCROOT=$(SRCROOT)/libstuff \ OBJROOT=$(OBJROOT)/libstuff \ - SYMROOT=$(SYMROOT)/libstuff all) || exit 1; \ + SYMROOT=$(SYMROOT)/libstuff lib_static_ofiles) || exit 1; \ if [ $(BUILD_DYLIBS) = "YES" ]; \ then \ echo =========== $(MAKE) $@ for libmacho =============; \ @@ -284,10 +284,10 @@ lib_ofiles lib_ofiles_install: installhdrs (cd libstuff; $(MAKE) "RC_CFLAGS=$(RC_CFLAGS)" \ RC_ARCHS="$(RC_ARCHS)" RC_OS="$(RC_OS)" \ DSTROOT=$$DSTROOT $@) || exit 1; \ - echo =========== $(MAKE) all for libstuff =============; \ + echo ====== $(MAKE) lib_static_ofiles for libstuff =======; \ (cd libstuff; $(MAKE) "RC_CFLAGS=$$SED_RC_CFLAGS" \ RC_ARCHS="$(RC_ARCHS)" RC_OS="$(RC_OS)" \ - DSTROOT=$$DSTROOT all) || exit 1; \ + DSTROOT=$$DSTROOT lib_static_ofiles) || exit 1; \ if [ $(BUILD_DYLIBS) = "YES" ]; \ then \ echo =========== $(MAKE) $@ for libmacho =============; \ @@ -311,7 +311,6 @@ lib_ofiles lib_ofiles_install: installhdrs fi install_dev_tools: - @ export RC_FORCEHDRS=YES; \ $(MAKE) RC_CFLAGS="$(RC_CFLAGS)" \ RC_ARCHS="$(RC_ARCHS)" \ RC_OS="$(RC_OS)" \ diff --git a/cctools/RelNotes/Private_CompilerTools.html b/cctools/RelNotes/Private_CompilerTools.html index e1620ed..87b17fd 100644 --- a/cctools/RelNotes/Private_CompilerTools.html +++ b/cctools/RelNotes/Private_CompilerTools.html @@ -8,14 +8,14 @@ -

Mac OS X Xcode 4.5.1 Developer Release Copyright -2012 by Apple, Inc. All Rights Reserved.

+

Mac OS X Xcode 5 Developer Release Copyright +2013 by Apple, Inc. All Rights Reserved.

-

Private Mac OS X Xcode 4.5.1 Developer Release:
-Compiler Tools (cctools-839)

+

Private Mac OS X Xcode 5 Developer Release:
+Compiler Tools (cctools-845)

This file contains release notes for the 5.33 release of the -Compiler Tools for the Mac OS X Xcode 4.5.1 Developer Release. This +Compiler Tools for the Mac OS X Xcode 5 Developer Release. This file contains information about the following topics:

-

Notes Specific to Release 5.33 (Mac OS X Xcode 4.5.1 Developer +

Notes Specific to Release 5.33 (Mac OS X Xcode 5 Developer Release)

+
Changes since the last release (cctools-844 for +the 5.33 Mac OS X Xcode 4.5.1 Developer release)
+ + +
Changes since the last release (cctools-843 for +the 5.33 Mac OS X Xcode 4.5.1 Developer release)
+ + +
Changes since the last release (cctools-842 for +the 5.33 Mac OS X Xcode 4.5.1 Developer release)
+ + +
Changes since the last release (cctools-841 for +the 5.33 Mac OS X Xcode 4.5.1 Developer release)
+ + +
Changes since the last release (cctools-840 for +the 5.33 Mac OS X Xcode 4.5.1 Developer release)
+ + +
Changes since the last release (cctools-839 for +the 5.33 Mac OS X Xcode 4.5.1 Developer release)
+ + +
Changes since the last release (cctools-838 for the 5.33 Mac OS X Xcode 4.5.1 Developer release)
@@ -1144,7 +1253,7 @@ the 5.27 Mac OS X Xcode 3.2.2 Developer release) address for the -t option of an x86_64 binary. Radar bug #7012357. -
  • Removed the #ifndef __OPEN_SOURCE__ lines around the armv7 +
  • Removed the #ifndef __OPEN_SOURCE__ code. Radar bug #7016121.
  • @@ -2205,7 +2314,7 @@ the 5.25 Mac OS X Xcode 3.1 Developer release) parameter as a general register not a xmm register. Radar bug #5650346. -
  • Removed the sources changes to #ifndef __OPEN_SOURCE__ to +
  • Removed the sources changes to #ifndef __OPEN_SOURCE__ isolate arm sections of cctools sources that was put in for Radar bug #5326431.
  • @@ -2413,7 +2522,7 @@ the 5.25 Mac OS X Xcode 3.1 Developer release) the 5.24 Mac OS X Xcode 3.0 Developer release) diff --git a/cctools/ar/Makefile b/cctools/ar/Makefile index 77f1ae1..fcd160f 100644 --- a/cctools/ar/Makefile +++ b/cctools/ar/Makefile @@ -1,27 +1,15 @@ ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) -endif -OFLAG = -Os -ifeq "mwccppc" "$(notdir $(CC))" - CFLAGS = -g $(OFLAG) -I$(SRCROOT)/../include $(SDK) + DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) else - CFLAGS = -g $(OFLAG) -Wall -I$(SRCROOT)/../include $(SDK) + DSYMUTIL = dsymutil endif +OFLAG = -Os +CFLAGS = -g $(OFLAG) -Wall -I$(SRCROOT)/../include $(SDK) LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff - -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) - -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif - +MKDIRS = /bin/mkdir -p SRCROOT = . OBJROOT = . SYMROOT = . @@ -46,34 +34,25 @@ all: $(OFILE_DIR) $(SYMROOT) $(PRODUCT).NEW $(PRODUCT).NEW: $(OFILE_DIR) $(SYMROOT) $(OBJS) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/$@ $(OBJS) $(LIBSTUFF) + $(DSYMUTIL) $(SYMROOT)/$@ -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif clean: shlib_clean -rm -f $(SYMROOT)/$(PRODUCT).NEW + -rm -r -f *dSYM shlib_clean: -cd $(OFILE_DIR); rm -f $(OBJS) - -rm -f $(OFILE_DIR)/Makedep make.out + -rm -f make.out -install: $(RC_OS) - -teflon macos: all $(DSTDIRS) +install: all $(DSTDIRS) install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ $(DSTROOT)$(BINDIR)/$(PRODUCT) install -c -m 444 $(MAN1) $(DSTROOT)$(MANDIR)/man1 install -c -m 444 $(MAN5) $(DSTROOT)$(MANDIR)/man5 -nextstep: - installsrc: $(MKDIRS) $(SRCROOT) chmod 755 $(SRCROOT) @@ -82,5 +61,3 @@ installsrc: $(OFILE_DIR) $(SYMROOT) $(DSTDIRS): $(MKDIRS) $@ - --include $(OFILE_DIR)/Makedep diff --git a/cctools/as/Makefile b/cctools/as/Makefile index 6095fe0..a4b016e 100644 --- a/cctools/as/Makefile +++ b/cctools/as/Makefile @@ -1,32 +1,20 @@ -RC_OS = macos export USE_APPLE_PB_SUPPORT = all -OFLAG = -Os -X_CFLAGS = - -ifneq "clang" "$(notdir $(CC))" - GCC_FLAGS = -Wall $(X_CFLAGS) -endif - -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "clang" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) + DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) +else + DSYMUTIL = dsymutil endif -CFLAGS = $(OFLAG) -g -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) \ - $(GCC_FLAGS) -DNeXT_MOD $(SDK) +OFLAG = -Os +CFLAGS = $(OFLAG) -g -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) \ + -Wall -DNeXT_MOD $(SDK) LIBSTUFF_DIR = -L$(SYMROOT)/../../libstuff LIBSTUFF = -lstuff -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif +MKDIRS = /bin/mkdir -p SRCROOT = . SYMROOT = . @@ -57,13 +45,8 @@ OFILE_DIRS = $(OBJROOT)/driver_dir \ BINDIR = /bin USRBINDIR = /usr/bin -ifeq "macos" "$(RC_OS)" - LIBDIR = /usr/libexec/as - LOCLIBDIR = /usr/local/libexec/as -else - LIBDIR = /usr/libexec - LOCLIBDIR = /usr/local/libexec -endif +LIBDIR = /usr/libexec/as +LOCLIBDIR = /usr/local/libexec/as DWARF = dwarf2dbg.c CFILES = app.c as.c atof-generic.c atof-ieee.c expr.c fixes.c flonum-const.c \ @@ -115,14 +98,14 @@ driver_build: $(OBJROOT)/driver_dir @if [ $(SRCROOT) = . ]; \ then \ cd driver_dir; $(MAKE) -f ../Makefile driver VPATH=.. \ - CFLAGS="-g -I../../include $(OFLAG) $(GCC_FLAGS) $(SDK)" \ + CFLAGS="-g -I../../include $(OFLAG) $(SDK)" \ VERS_STRING_FLAGS="$(VERS_STRING_FLAGS)" OFILE_DIR=. \ RC_FLAGS="$(RC_CFLAGS)" DEP_DIR=driver_dir; \ else \ cd $(OBJROOT)/driver_dir; $(MAKE) -f $(SRCROOT)/Makefile \ driver VPATH=$(SRCROOT) OFILE_DIR=$(OBJROOT)/driver_dir \ SYMROOT=$(SYMROOT)/driver_dir SRCROOT=$(SRCROOT) \ - CFLAGS="-g -I$(SRCROOT)/../include $(OFLAG) $(GCC_FLAGS) $(SDK)" \ + CFLAGS="-g -I$(SRCROOT)/../include $(OFLAG) $(SDK)" \ VERS_STRING_FLAGS="$(VERS_STRING_FLAGS)" \ RC_FLAGS="$(RC_CFLAGS)" DEP_DIR=driver_dir; \ fi @@ -344,12 +327,14 @@ aarm_test: aarm_dir driver: driver.o $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/driver \ $(OFILE_DIR)/driver.o $(LIBSTUFF_DIR) $(LIBSTUFF) + $(DSYMUTIL) $(SYMROOT)/driver as: $(OBJS) $(TARGET_OBJS) $(CC) $(RC_CFLAGS) -nostdlib -r \ -o $(SYMROOT)/as.private.o $(OBJS) $(TARGET_OBJS) \ $(LIBSTUFF_DIR) $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/as $(SYMROOT)/as.private.o + $(DSYMUTIL) $(SYMROOT)/as m68k-check: $(CC) $(COPTS) $(CFLAGS) -o check ../m68k-check.c @@ -387,15 +372,8 @@ test: diff check1.s check2.s > check.out cmp check.o check1.o -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(COPTS) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(COPTS) $(CFLAGS) $(RC_CFLAGS) -c -MD \ - -dependency-file $(OFILE_DIR)/$*.d -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif clean shlib_clean: -rm -r -f $(OFILE_DIRS) make.out @@ -406,22 +384,13 @@ installsrc installGASsrc: gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) chmod 444 $(SRCROOT)/* -install: all $(RC_OS)_install - -macos_install: common_install xcommon_install +install: all $(MKDIRS) $(DSTROOT)$(LIBDIR)/i386 install -c -s -m 555 $(SYMROOT)/a386_dir/as \ $(DSTROOT)$(LIBDIR)/i386/as $(MKDIRS) $(DSTROOT)$(LIBDIR)/x86_64 install -c -s -m 555 $(SYMROOT)/ax86_64_dir/as \ $(DSTROOT)$(LIBDIR)/x86_64/as - -teflon_install: common_install xcommon_install - $(MKDIRS) $(DSTROOT)$(LIBDIR)/i386 - install -c -s -m 555 $(SYMROOT)/a386_dir/as \ - $(DSTROOT)$(LIBDIR)/i386/as - -xcommon_install: $(MKDIRS) $(DSTROOT)$(USRBINDIR) install -c -s -m 555 $(SYMROOT)/driver_dir/driver \ $(DSTROOT)$(USRBINDIR)/as @@ -446,25 +415,6 @@ xcommon_install: $(MKDIRS) $(DSTROOT)$(LIBDIR)/arm install -c -s -m 555 $(SYMROOT)/aarm_dir/as \ $(DSTROOT)$(LIBDIR)/arm/as - -nextstep_install: common_install - $(MKDIRS) $(DSTROOT)$(BINDIR) - install -c -s -m 555 $(SYMROOT)/driver_dir/driver \ - $(DSTROOT)$(BINDIR)/as - $(MKDIRS) $(DSTROOT)$(LIBDIR)/m68k - install -c -s -m 555 $(SYMROOT)/a68_dir/as \ - $(DSTROOT)$(LIBDIR)/m68k/as - $(MKDIRS) $(DSTROOT)$(LIBDIR)/i386 - install -c -s -m 555 $(SYMROOT)/a386_dir/as \ - $(DSTROOT)$(LIBDIR)/i386/as - $(MKDIRS) $(DSTROOT)$(LIBDIR)/sparc - install -c -s -m 555 $(SYMROOT)/asparc_dir/as \ - $(DSTROOT)$(LIBDIR)/sparc/as - $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/ppc - install -c -s -m 555 $(SYMROOT)/appc_dir/as \ - $(DSTROOT)$(LOCLIBDIR)/ppc/as - -common_install: $(MKDIRS) $(DSTROOT)$(LOCLIBDIR)/m88k install -c -s -m 555 $(SYMROOT)/a88_dir/as \ $(DSTROOT)$(LOCLIBDIR)/m88k/as @@ -477,5 +427,3 @@ common_install: $(OFILE_DIRS) $(SYM_DIRS): $(MKDIRS) $@ - --include $(DEP_DIR)/Makedep diff --git a/cctools/as/as.c b/cctools/as/as.c index 1b011c4..a15f62c 100644 --- a/cctools/as/as.c +++ b/cctools/as/as.c @@ -707,6 +707,17 @@ char **envp) CPU_SUBTYPE_ARM_V6; } else if(strcmp(*work_argv, + "armv6m") == 0){ + if(archflag_cpusubtype != -1 && + archflag_cpusubtype != + CPU_SUBTYPE_ARM_V6M) + as_fatal("can't specify more " + "than one -arch flag "); + specific_archflag = *work_argv; + archflag_cpusubtype = + CPU_SUBTYPE_ARM_V6M; + } + else if(strcmp(*work_argv, "armv7") == 0){ if(archflag_cpusubtype != -1 && archflag_cpusubtype != @@ -750,6 +761,28 @@ char **envp) archflag_cpusubtype = CPU_SUBTYPE_ARM_V7K; } + else if(strcmp(*work_argv, + "armv7m") == 0){ + if(archflag_cpusubtype != -1 && + archflag_cpusubtype != + CPU_SUBTYPE_ARM_V7M) + as_fatal("can't specify more " + "than one -arch flag "); + specific_archflag = *work_argv; + archflag_cpusubtype = + CPU_SUBTYPE_ARM_V7M; + } + else if(strcmp(*work_argv, + "armv7em") == 0){ + if(archflag_cpusubtype != -1 && + archflag_cpusubtype != + CPU_SUBTYPE_ARM_V7EM) + as_fatal("can't specify more " + "than one -arch flag "); + specific_archflag = *work_argv; + archflag_cpusubtype = + CPU_SUBTYPE_ARM_V7EM; + } else as_fatal("I expected 'arm' after " "-arch for this assembler."); diff --git a/cctools/as/driver.c b/cctools/as/driver.c index e10eb74..738c40e 100644 --- a/cctools/as/driver.c +++ b/cctools/as/driver.c @@ -210,6 +210,18 @@ char **envp) printf("%s: can't specifiy both -q and -Q\n", progname); exit(1); } + /* + * If the environment variable AS_INTEGRATED_ASSEMBLER is set then set + * the qflag to call clang(1) with -integrated-as unless the -Q flag is + * set and do this for the supported architectures. + */ + if(Qflag == FALSE && + getenv("AS_INTEGRATED_ASSEMBLER") != NULL && + (arch_flag.cputype == CPU_TYPE_X86_64 || + arch_flag.cputype == CPU_TYPE_I386 || + arch_flag.cputype == CPU_TYPE_ARM)){ + qflag = TRUE; + } if(qflag == TRUE && (arch_flag.cputype != CPU_TYPE_X86_64 && arch_flag.cputype != CPU_TYPE_I386 && diff --git a/cctools/as/dwarf2dbg.c b/cctools/as/dwarf2dbg.c index 00c2282..5c9231f 100644 --- a/cctools/as/dwarf2dbg.c +++ b/cctools/as/dwarf2dbg.c @@ -1535,6 +1535,7 @@ struct frchain *line_section) enum dwarf2_format d2f; int sizeof_offset, output_something; + sizeof_offset = 0; section_set(line_section); line_start = symbol_temp_new_now (); diff --git a/cctools/as/i386.c b/cctools/as/i386.c index 0d0e024..4ad6f96 100644 --- a/cctools/as/i386.c +++ b/cctools/as/i386.c @@ -89,11 +89,7 @@ #define SCALE1_WHEN_NO_INDEX 1 #endif -#ifdef ARCH64 -typedef enum reloc_type_x86_64 bfd_reloc_code_real_type; -#else -typedef enum reloc_type_generic bfd_reloc_code_real_type; -#endif +typedef int bfd_reloc_code_real_type; #ifndef DEFAULT_ARCH #ifdef ARCH64 @@ -215,12 +211,8 @@ struct _i386_insn unsigned int flags[MAX_OPERANDS]; #define Operand_PCrel 1 -#ifdef ARCH64 /* Relocation type for operand */ - enum reloc_type_x86_64 reloc[MAX_OPERANDS]; -#else - enum reloc_type_generic reloc[MAX_OPERANDS]; -#endif + int reloc[MAX_OPERANDS]; /* BASE_REG, INDEX_REG, and LOG2_SCALE_FACTOR are used to encode the base index byte below. */ diff --git a/cctools/as/i860.c b/cctools/as/i860.c index d083f02..45f9388 100644 --- a/cctools/as/i860.c +++ b/cctools/as/i860.c @@ -134,7 +134,7 @@ struct i860_it { nlist_t *nlistp; expressionS exp; int pcrel; - enum reloc_type_i860 reloc; + int reloc; }; static struct i860_it the_insn; diff --git a/cctools/as/m88k.c b/cctools/as/m88k.c index c9e8919..7793016 100644 --- a/cctools/as/m88k.c +++ b/cctools/as/m88k.c @@ -74,7 +74,7 @@ struct m88k_insn { uint32_t opcode; expressionS exp; #ifdef NeXT_MOD - enum reloc_type_m88k reloc; + int reloc; #else enum reloc_type reloc; #endif diff --git a/cctools/as/notes b/cctools/as/notes index 0cc7ff2..396d6b4 100644 --- a/cctools/as/notes +++ b/cctools/as/notes @@ -25,6 +25,13 @@ Bugs to be fixed: - The PowerPC extended branch mnemonic like beqlrl need to take a CRFONLY or a number shifted over by 2 (like the fcmpu instruction). +Changes for the 5.33 release (the cctools-840 release): +- Added the environment variable AS_INTEGRATED_ASSEMBLER to be like the -q flag + and use clang(1) with -integrated-as when -Q is not used and the targeted + architecture is supported by clang(1). Radar bug #12671669. +- Added support for new archs: armv6m / armv7m / armv7em and updated main() in + as.c . Radar bug #11314463. + Changes for the 5.32 release (the cctools-832 release): - Fixed command line parsing problems in the driver that was not skiping the parsing the characters after multiple character options. Radar bug #11754204. @@ -471,9 +478,9 @@ Changes for the 5.27 release (the cctools-762 release): Changes for the 5.27 release (the cctools-760 release): - Changed the sources so the armv7 stuff is a no longer #ifndef __OPEN_SOURCE__ Radar bug #7016121. - - Changed the Makefile and removed the #ifndef __OPEN_SOURCE__ for the arm + - Changed the Makefile and removed the #ifndef __OPEN_SOURCE__ build. - - Removed the #ifndef __OPEN_SOURCE__ from as.c that was bracketing armv7 + - Removed the #ifndef __OPEN_SOURCE__ the reference. Changes for the 5.27 release (the cctools-759 release): @@ -984,8 +991,8 @@ Changes for the 5.26 release (the cctools-701 release): Changes for the 5.25 release (the cctools-697 release): - Changed the sources so the arm assembler is not in the open source version. Radar bug #5844124. - - Changed the Makefile to #ifndef __OPEN_SOURCE__ out the arm build - - Added #ifndef __OPEN_SOURCE__ to as.c to bracket armv7 reference. + - Changed the Makefile to #ifndef __OPEN_SOURCE__ + - Added #ifndef __OPEN_SOURCE__ Changes for the 5.25 release (the cctools-689 release): - Fixed a place that needed force_cpusubtype_ALL tested in md_assemble() in @@ -1522,7 +1529,7 @@ Changes for the 5.25 release (the cctools-678 release): Changes for the 5.25 release (the cctools-677 release): - Changed the Makefile to not use -Wno-long-double and -no-cpp-precomp . Radar bug #5563553. -- Fixed a problem with the #ifndef __OPEN_SOURCE__ change in done for bug +- Fixed a problem with the #ifndef __OPEN_SOURCE__ #5326431 in layout.c in fixup_section(). Where the non __OPEN_SOURCE__ defined else clause was missing the needed #ifdef for x86_64. Radar bug #5575380. @@ -1615,8 +1622,8 @@ Changes for the 5.25 release (the cctools-676 release): Changes for the 5.25 release (the cctools-673 release): - Changed the sources so the arm stuff is not in the open source version. Radar bug #5326431. - - Changed the Makefile to #ifndef __OPEN_SOURCE__ out the arm build - - Added #ifndef __OPEN_SOURCE__ to the following files to bracket arm code: + - Changed the Makefile to #ifndef __OPEN_SOURCE__ + - Added #ifndef __OPEN_SOURCE__ as.c, layout.c, messages.c, write_object.c, symbols.c, symbols.h and write_object.c . diff --git a/cctools/as/ppc.c b/cctools/as/ppc.c index 4803a40..340a5a8 100644 --- a/cctools/as/ppc.c +++ b/cctools/as/ppc.c @@ -125,7 +125,7 @@ struct ppc_insn { uint32_t opcode; expressionS exp; expressionS jbsr_exp; - enum reloc_type_ppc reloc; + int reloc; int32_t pcrel; int32_t pcrel_reloc; }; diff --git a/cctools/as/sparc.c b/cctools/as/sparc.c index ee2f58d..0d94c1e 100644 --- a/cctools/as/sparc.c +++ b/cctools/as/sparc.c @@ -166,7 +166,7 @@ struct sparc_it expressionS exp; int pcrel; char pcrel_reloc; /* do relocation? */ - enum reloc_type_sparc reloc; + int reloc; }; struct sparc_it the_insn; diff --git a/cctools/cbtlibs/Makefile b/cctools/cbtlibs/Makefile index 08038fd..f0cd1ac 100644 --- a/cctools/cbtlibs/Makefile +++ b/cctools/cbtlibs/Makefile @@ -1,26 +1,12 @@ RC_OS = macos OFLAG = -Os -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) endif -ifeq "mwccppc" "$(notdir $(CC))" - CFLAGS = $(OFLAG) -g -gccinc -I$(SRCROOT)/../include $(SDK) -else - CFLAGS = $(OFLAG) -g -I$(SRCROOT)/../include -Wall $(X_CFLAGS) $(SDK) -endif - -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif - +CFLAGS = $(OFLAG) -g -I$(SRCROOT)/../include -Wall $(SDK) +MKDIRS = /bin/mkdir -p SRCROOT = . SYMROOT = . OBJROOT = . @@ -37,20 +23,13 @@ all: $(OFILE_DIR) $(SYMROOT) lib_ofiles lib_ofiles: $(OFILE_DIR) $(SYMROOT) libsyminfo.a -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c \ - -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif clean shlib_clean: -rm -r -f $(OFILE_DIRS) -rm -f libsyminfo.a + -rm -r -f *dSYM install: all @@ -64,15 +43,8 @@ $(SYMROOT): $(MKDIRS) $@ libsyminfo.o: libsyminfo.c -ifeq "NO" "$(USE_DEPENDENCY_FILE)" $(CC) $(CFLAGS) $(RC_CFLAGS) -c \ -o $(OFILE_DIR)/$*.o $(SRCROOT)/libsyminfo.c -DLIBRARY_API -else - $(CC) $(CFLAGS) $(RC_CFLAGS) -c \ - -MD -dependency-file $(OFILE_DIR)/$*.d -o $(OFILE_DIR)/$*.o \ - $(SRCROOT)/libsyminfo.c -DLIBRARY_API - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif libsyminfo.a: libsyminfo.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -88,7 +60,5 @@ lib_ofiles_install: lib_ofiles $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a ranlib $(DSTROOT)$(LOCLIBDIR)/libsyminfo.a --include $(OFILE_DIR)/Makedep - $(OFILE_DIR) $(SYMROOT): $(MKDIRS) $@ diff --git a/cctools/efitools/Makefile b/cctools/efitools/Makefile index 3851c2b..ca7cfc5 100644 --- a/cctools/efitools/Makefile +++ b/cctools/efitools/Makefile @@ -1,32 +1,18 @@ export USE_APPLE_PB_SUPPORT = all -OFLAG = -Os RC_OS = macos -X_CFLAGS = ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) -endif - -ifeq "clang" "$(notdir $(CC))" - CFLAGS = $(OFLAG) -g -Wall \ - -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) + DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) else - CFLAGS = $(OFLAG) -g -Wall $(X_CFLAGS) \ - -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) + DSYMUTIL = dsymutil endif -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) - +OFLAG = -Os +CFLAGS = $(OFLAG) -g -Wall \ + -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff - -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif +MKDIRS = /bin/mkdir -p SRCROOT = . OBJROOT = . @@ -45,15 +31,8 @@ PROGS = makerelocs.NEW mtoc.NEW all: $(OFILE_DIR) $(SYMROOT) $(PROGS) -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -MD -dependency-file \ - $(OFILE_DIR)/$*.d -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif makerelocs.NEW: makerelocs.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -61,6 +40,7 @@ makerelocs.NEW: makerelocs.o $(OFILE_DIR)/makerelocs.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/makerelocs.NEW \ $(OFILE_DIR)/makerelocs.private.o + $(DSYMUTIL) $(SYMROOT)/makerelocs.NEW mtoc.NEW: mtoc.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -68,11 +48,13 @@ mtoc.NEW: mtoc.o $(OFILE_DIR)/mtoc.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/mtoc.NEW \ $(OFILE_DIR)/mtoc.private.o + $(DSYMUTIL) $(SYMROOT)/mtoc.NEW clean: shlib_clean -rm -f \ $(SYMROOT)/makerelocs.NEW \ $(SYMROOT)/mtoc.NEW + -rm -r -f *dSYM shlib_clean: -rm -f \ @@ -80,7 +62,7 @@ shlib_clean: $(OFILE_DIR)/makerelocs.private.o \ $(OFILE_DIR)/mtoc.o \ $(OFILE_DIR)/mtoc.private.o - -rm -f $(OFILE_DIR)/Makedep make.out + -rm -f make.out install: all install @@ -103,5 +85,3 @@ installsrc: $(OFILE_DIR) $(SYMROOT): $(MKDIRS) $@ - --include $(OFILE_DIR)/Makedep diff --git a/cctools/gprof/Makefile b/cctools/gprof/Makefile index bf2d226..ea1441b 100644 --- a/cctools/gprof/Makefile +++ b/cctools/gprof/Makefile @@ -1,28 +1,15 @@ -RC_OS = macos -OFLAG = -Os -LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff - -ifneq "clang" "$(notdir $(CC))" - GCC_FLAGS = $(X_CFLAGS) -endif - -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "clang" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) - ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) -endif -CFLAGS = $(OFLAG) -g -I../include -Wall $(GCC_FLAGS) -DNeXT_MOD -DDEBUG $(SDK) - -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs + DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) else - MKDIRS = /bin/mkdir -p + DSYMUTIL = dsymutil endif +OFLAG = -Os +CFLAGS = $(OFLAG) -g -I../include -Wall -DNeXT_MOD -DDEBUG $(SDK) +LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff +MKDIRS = /bin/mkdir -p OBJROOT = . OFILE_DIR = $(OBJROOT) VPATH = $(OFILE_DIR) @@ -30,9 +17,7 @@ SYMROOT = . BINDIR = /usr/ucb USRBINDIR = /usr/bin -nextstep_LIBDIR = /usr/lib -teflon_LIBDIR = /usr/share -macos_LIBDIR = /usr/share +LIBDIR = /usr/share HFILES = gprof.h m68k.h vax.h CFILES = gprof.c arcs.c dfn.c lookup.c calls.c hertz.c printgprof.c \ @@ -47,41 +32,28 @@ $(PRODUCT).NEW: $(OFILE_DIR) $(SYMROOT) $(OBJS) $(CC) $(RC_CFLAGS) -nostdlib -r \ -o $(SYMROOT)/$@.private.o $(OBJS) $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/$@ $(SYMROOT)/$@.private.o + $(DSYMUTIL) $(SYMROOT)/$@ -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif clean: shlib_clean -rm -f $(SYMROOT)/$(PRODUCT).NEW -rm -f $(SYMROOT)/$(PRODUCT).NEW.private.o + -rm -r -f *dSYM shlib_clean: -cd $(OFILE_DIR); rm -f $(OBJS) - -rm -f $(OFILE_DIR)/Makedep make.out + -rm -f make.out -install: all common_install $(RC_OS)_install - -teflon_install macos_install: - $(MKDIRS) $(DSTROOT)$(USRBINDIR) - install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ - $(DSTROOT)$(USRBINDIR)/$(PRODUCT) - -nextstep_install: - $(MKDIRS) $(DSTROOT)$(BINDIR) - install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ - $(DSTROOT)$(BINDIR)/$(PRODUCT) - -common_install: - $(MKDIRS) $(DSTROOT)$($(RC_OS)_LIBDIR) - install -c -m 444 gprof.flat $(DSTROOT)$($(RC_OS)_LIBDIR) - install -c -m 444 gprof.callg $(DSTROOT)$($(RC_OS)_LIBDIR) +install: all +# No longer install gprof and its files. +# $(MKDIRS) $(DSTROOT)$(USRBINDIR) +# install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ +# $(DSTROOT)$(USRBINDIR)/$(PRODUCT) +# $(MKDIRS) $(DSTROOT)$(LIBDIR) +# install -c -m 444 gprof.flat $(DSTROOT)$(LIBDIR) +# install -c -m 444 gprof.callg $(DSTROOT)$(LIBDIR) installsrc: $(MKDIRS) $(SRCROOT) @@ -91,5 +63,3 @@ installsrc: $(OFILE_DIR) $(SYMROOT): $(MKDIRS) $@ - --include $(OFILE_DIR)/Makedep diff --git a/cctools/gprof/notes b/cctools/gprof/notes index 1a10ec5..38a2ecb 100644 --- a/cctools/gprof/notes +++ b/cctools/gprof/notes @@ -3,6 +3,9 @@ TODO: stuff). - Add multi-arch support for findcalls() and make work better (use disasm). +Changes for the 5.30 release (the cctools-841 release): +- Changed the Makefile to stop installing gprof. Radar bug #12206921. + Changes for the 5.30 release (the cctools-820 release): - Removed the use of vers_string(1) from the Makefile. Radar bug #10596469. - Added a reference to apple_version[] in gprof.c . diff --git a/cctools/include/llvm-c/Disassembler.h b/cctools/include/llvm-c/Disassembler.h index b209801..6f6ca64 100644 --- a/cctools/include/llvm-c/Disassembler.h +++ b/cctools/include/llvm-c/Disassembler.h @@ -18,6 +18,13 @@ #include /** + * @defgroup LLVMCDisassembler Disassembler + * @ingroup LLVMC + * + * @{ + */ + +/** * An opaque reference to a disassembler context. */ typedef void *LLVMDisasmContextRef; @@ -68,6 +75,7 @@ struct LLVMOpInfoSymbol1 { const char *Name; /* symbol name if not NULL */ uint64_t Value; /* symbol value if name is NULL */ }; + struct LLVMOpInfo1 { struct LLVMOpInfoSymbol1 AddSymbol; struct LLVMOpInfoSymbol1 SubtractSymbol; @@ -100,9 +108,9 @@ struct LLVMOpInfo1 { */ typedef const char *(*LLVMSymbolLookupCallback)(void *DisInfo, uint64_t ReferenceValue, - uint64_t *ReferenceType, - uint64_t ReferencePC, - const char **ReferenceName); + uint64_t *ReferenceType, + uint64_t ReferencePC, + const char **ReferenceName); /** * The reference types on input and output. */ @@ -130,13 +138,39 @@ extern "C" { * by passing a block of information in the DisInfo parameter and specifying the * TagType and callback functions as described above. These can all be passed * as NULL. If successful, this returns a disassembler context. If not, it - * returns NULL. + * returns NULL. This function is equivalent to calling LLVMCreateDisasmCPU() + * with an empty CPU name. */ LLVMDisasmContextRef LLVMCreateDisasm(const char *TripleName, void *DisInfo, int TagType, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp); /** + * Create a disassembler for the TripleName and a specific CPU. Symbolic + * disassembly is supported by passing a block of information in the DisInfo + * parameter and specifying the TagType and callback functions as described + * above. These can all be passed * as NULL. If successful, this returns a + * disassembler context. If not, it returns NULL. + */ +LLVMDisasmContextRef LLVMCreateDisasmCPU(const char *Triple, const char *CPU, + void *DisInfo, int TagType, + LLVMOpInfoCallback GetOpInfo, + LLVMSymbolLookupCallback SymbolLookUp); + +/** + * Set the disassembler's options. Returns 1 if it can set the Options and 0 + * otherwise. + */ +int LLVMSetDisasmOptions(LLVMDisasmContextRef DC, uint64_t Options); + +/* The option to produce marked up assembly. */ +#define LLVMDisassembler_Option_UseMarkup 1 +/* The option to print immediates as hex. */ +#define LLVMDisassembler_Option_PrintImmHex 2 +/* The option use the other assembler printer variant */ +#define LLVMDisassembler_Option_AsmPrinterVariant 4 + +/** * Dispose of a disassembler context. */ void LLVMDisasmDispose(LLVMDisasmContextRef DC); @@ -155,6 +189,10 @@ size_t LLVMDisasmInstruction(LLVMDisasmContextRef DC, uint8_t *Bytes, uint64_t BytesSize, uint64_t Pc, char *OutString, size_t OutStringSize); +/** + * @} + */ + #ifdef __cplusplus } #endif /* !defined(__cplusplus) */ diff --git a/cctools/include/mach-o/arch.h b/cctools/include/mach-o/arch.h index 526c10f..7b3c6ae 100644 --- a/cctools/include/mach-o/arch.h +++ b/cctools/include/mach-o/arch.h @@ -48,7 +48,7 @@ typedef struct { const char *description; } NXArchInfo; -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -98,7 +98,7 @@ extern cpu_subtype_t NXCombineCpuSubtypes(cpu_type_t cputype, cpu_subtype_t cpusubtype1, cpu_subtype_t cpusubtype2); -#if __cplusplus +#ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/cctools/include/mach-o/dyld.h b/cctools/include/mach-o/dyld.h index e2233eb..9699d83 100644 --- a/cctools/include/mach-o/dyld.h +++ b/cctools/include/mach-o/dyld.h @@ -23,7 +23,7 @@ #ifndef _MACH_O_DYLD_H_ #define _MACH_O_DYLD_H_ -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -320,7 +320,7 @@ __private_extern__ int _dyld_func_lookup( const char *dyld_func_name, unsigned long *address); -#if __cplusplus +#ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/cctools/include/mach-o/dyld_priv.h b/cctools/include/mach-o/dyld_priv.h index 6aa2d86..636caf6 100644 --- a/cctools/include/mach-o/dyld_priv.h +++ b/cctools/include/mach-o/dyld_priv.h @@ -26,7 +26,7 @@ #include -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -53,7 +53,7 @@ NSFindSectionAndOffsetInObjectFileImage( -#if __cplusplus +#ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/cctools/include/mach-o/getsect.h b/cctools/include/mach-o/getsect.h index cee1f9f..c4b4fff 100644 --- a/cctools/include/mach-o/getsect.h +++ b/cctools/include/mach-o/getsect.h @@ -26,7 +26,7 @@ #include #include -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -124,7 +124,7 @@ extern const struct section_64 *getsectbynamefromheader_64( const char *segname, const char *sectname); -#if __cplusplus +#ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/cctools/include/mach-o/loader.h b/cctools/include/mach-o/loader.h index d26ad14..9e4997d 100644 --- a/cctools/include/mach-o/loader.h +++ b/cctools/include/mach-o/loader.h @@ -295,6 +295,7 @@ struct load_command { #define LC_SOURCE_VERSION 0x2A /* source version used to build binary */ #define LC_DYLIB_CODE_SIGN_DRS 0x2B /* Code signing DRs copied from linked dylibs */ #define LC_ENCRYPTION_INFO_64 0x2C /* 64-bit encrypted segment information */ +#define LC_LINKER_OPTION 0x2D /* linker options in MH_OBJECT files */ /* @@ -1177,7 +1178,7 @@ struct encryption_info_command { /* * The encryption_info_command_64 contains the file offset and size of an - * of an encrypted segment (for use in 64-bit targets). + * of an encrypted segment (for use in x86_64 targets). */ struct encryption_info_command_64 { uint32_t cmd; /* LC_ENCRYPTION_INFO_64 */ @@ -1376,6 +1377,17 @@ struct dyld_info_command { #define EXPORT_SYMBOL_FLAGS_STUB_AND_RESOLVER 0x10 /* + * The linker_option_command contains linker options embedded in object files. + */ +struct linker_option_command { + uint32_t cmd; /* LC_LINKER_OPTION only used in MH_OBJECT filetypes */ + uint32_t cmdsize; + uint32_t count; /* number of strings */ + /* concatenation of zero terminated UTF8 strings. + Zero filled at end to align */ +}; + +/* * The symseg_command contains the offset and size of the GNU style * symbol table information as described in the header file . * The symbol roots of the symbol segments must also be aligned properly diff --git a/cctools/include/mach-o/nlist.h b/cctools/include/mach-o/nlist.h index dd19888..a5b45a0 100644 --- a/cctools/include/mach-o/nlist.h +++ b/cctools/include/mach-o/nlist.h @@ -297,14 +297,14 @@ struct nlist_64 { #define N_SYMBOL_RESOLVER 0x0100 #ifndef __STRICT_BSD__ -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /* * The function nlist(3) from the C library. */ extern int nlist (const char *filename, struct nlist *list); -#if __cplusplus +#ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __STRICT_BSD__ */ diff --git a/cctools/include/mach-o/redo_prebinding.h b/cctools/include/mach-o/redo_prebinding.h index 1c0207f..d261091 100644 --- a/cctools/include/mach-o/redo_prebinding.h +++ b/cctools/include/mach-o/redo_prebinding.h @@ -48,7 +48,7 @@ * dependent library paths. */ -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -270,7 +270,7 @@ uint32_t *ncksums, const char *program_name, char **error_message); -#if __cplusplus +#ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/cctools/include/mach-o/swap.h b/cctools/include/mach-o/swap.h index ba10994..b354880 100644 --- a/cctools/include/mach-o/swap.h +++ b/cctools/include/mach-o/swap.h @@ -31,7 +31,7 @@ #include #include -#if __cplusplus +#ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -200,7 +200,7 @@ extern void swap_dylib_table_of_contents( uint32_t ntocs, enum NXByteOrder target_byte_sex); -#if __cplusplus +#ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/cctools/include/mach/machine.h b/cctools/include/mach/machine.h index 4556240..1ebe97a 100644 --- a/cctools/include/mach/machine.h +++ b/cctools/include/mach/machine.h @@ -310,6 +310,10 @@ extern vm_offset_t interrupt_stack[]; #define CPU_SUBTYPE_ARM_V7F ((cpu_subtype_t) 10) /* Cortex A9 */ #define CPU_SUBTYPE_ARM_V7S ((cpu_subtype_t) 11) /* Swift */ #define CPU_SUBTYPE_ARM_V7K ((cpu_subtype_t) 12) /* Kirkwood40 */ +#define CPU_SUBTYPE_ARM_V6M ((cpu_subtype_t) 14) /* Not meant to be run under xnu */ +#define CPU_SUBTYPE_ARM_V7M ((cpu_subtype_t) 15) /* Not meant to be run under xnu */ +#define CPU_SUBTYPE_ARM_V7EM ((cpu_subtype_t) 16) /* Not meant to be run under xnu */ + /* * MC88000 subtypes diff --git a/cctools/include/notes b/cctools/include/notes index 1be8c33..0e840aa 100644 --- a/cctools/include/notes +++ b/cctools/include/notes @@ -1,3 +1,28 @@ +Changes for the 5.33 release (the cctools-843 release): +- Updated the comment on the encryption_info_command_64 struct in + mach-o/loader.h . Radar bug #13300310. + +Changes for the 5.33 release (the cctools-841 release): +- Added support for the LC_LINKER_OPTION load command. Radar bug #12906665. + - Added the LC_LINKER_OPTION load command to . + - Added swap_linker_option_command() in "stuff/bytesex.h" . +- Added the LLVMCreateDisasmCPU() API to llvm-c/Disassembler.h . And changed + the llvm_create_disasm() api in stuff/llvm.h to add a CPU argument. + Radar bug #12839170. +- Added the LLVMDisassembler_Option_PrintImmHex constant to + llvm-c/Disassembler.h . Radar bug #12810901. + +Changes for the 5.33 release (the cctools-840 release): +- Added cpu subtypes to for armv6m / armv7m / armv7em + Radar bug #11314463. +- Updated the header in the mach-o directory that used "#if __cplusplus" to use + "#ifdef __cplusplus". The headers: arch.h, dyld.h, dyld_priv.h, getsect.h, + nlist.h, redo_prebinding.h and swap.h were changed. Radar bug #12476645. +- Added support for marked up llvm disassembler output. Radar bug #11764962. + - Updated llvm-c/Disassembler to the current source picking up the new + routine LLVMSetDisasmOptions(). + - Added llvm_disasm_set_options() to stuff/llvm.h . + Changes for the 5.32 release (the cctools-836 release): - Changed the Makefile to include "mach/arm/_structs.h" in the sources so this will build on non iOS trains. Radar bug #12025943. @@ -141,8 +166,8 @@ Changes for the 5.27 release (the cctools-769 release): Changes for the 5.26 release (the cctools-760 release): - Changed the sources so the armv7 stuff is a no longer #ifndef __OPEN_SOURCE__ Radar bug #7016121. - - Changed the Makefile and removed #ifndef __OPEN_SOURCE__ for "opcode/arm.h". - - Removed the #ifndef __OPEN_SOURCE__ in "mach/machine.h" that bracket armv7. + - Changed the Makefile and removed #ifndef __OPEN_SOURCE__ + - Removed the #ifndef __OPEN_SOURCE__ Changes for the 5.26 release (the cctools-758 release): - Backed out the change for Radar bug #6511482: @@ -244,8 +269,8 @@ Changes for the 5.25 release (the cctools-698 release): Changes for the 5.25 release (the cctools-697 release): - Changed the sources so the armv7 stuff is not in the open source version. Radar bug #5844124. - - Changed the Makefile to #ifndef __OPEN_SOURCE__ in "opcode/arm.h". - - Added #ifndef __OPEN_SOURCE__ to "mach/machine.h" to bracket armv7 + - Changed the Makefile to #ifndef __OPEN_SOURCE__ + - Added #ifndef __OPEN_SOURCE__ references. Changes for the 5.25 release (the cctools-696 release): @@ -288,9 +313,9 @@ Changes for the 5.25 release (the cctools-675 release): Changes for the 5.25 release (the cctools-673 release): - Changed the sources so the arm stuff is not in the open source version. Radar bug #5326431. - - Changed the Makefile to #ifndef __OPEN_SOURCE__ out the arm files and to + - Changed the Makefile to #ifndef __OPEN_SOURCE__ run unifdef on nlist.h - - Added #ifndef __OPEN_SOURCE__ to the following files to bracket arm code: + - Added #ifndef __OPEN_SOURCE__ mach/machine.h, mach-o/nlist.h, stuff/bytesex.h and stuff/symbol.h . Changes for the 5.24 release (the cctools-663 release): diff --git a/cctools/include/stuff/bytesex.h b/cctools/include/stuff/bytesex.h index c25c67b..11f9a3a 100644 --- a/cctools/include/stuff/bytesex.h +++ b/cctools/include/stuff/bytesex.h @@ -351,6 +351,10 @@ __private_extern__ void swap_encryption_command_64( struct encryption_info_command_64 *ec, enum byte_sex target_byte_sex); +__private_extern__ void swap_linker_option_command( + struct linker_option_command *lo, + enum byte_sex target_byte_sex); + __private_extern__ void swap_dyld_info_command( struct dyld_info_command *dc, enum byte_sex target_byte_sex); diff --git a/cctools/include/stuff/errors.h b/cctools/include/stuff/errors.h index 294a217..a2da7ce 100644 --- a/cctools/include/stuff/errors.h +++ b/cctools/include/stuff/errors.h @@ -25,67 +25,63 @@ * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ -#if defined(__MWERKS__) && !defined(__private_extern__) -#define __private_extern__ __declspec(private_extern) -#endif - #import "mach/mach.h" /* user defined (imported) */ -__private_extern__ char *progname; +extern char *progname __attribute__((visibility("hidden"))); /* defined in errors.c */ /* number of detected calls to error() */ -__private_extern__ uint32_t errors; +extern uint32_t errors __attribute__((visibility("hidden"))); -__private_extern__ void warning( +extern void warning( const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif - ; -__private_extern__ void error( + __attribute__((visibility("hidden"))); +extern void error( const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif - ; -__private_extern__ void error_with_arch( + __attribute__((visibility("hidden"))); +extern void error_with_arch( const char *arch_name, const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif - ; -__private_extern__ void system_error( + __attribute__((visibility("hidden"))); +extern void system_error( const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif - ; -__private_extern__ void fatal( + __attribute__((visibility("hidden"))); +extern void fatal( const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif - ; -__private_extern__ void system_fatal( + __attribute__((visibility("hidden"))); +extern void system_fatal( const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 1, 2))) #endif - ; -__private_extern__ void my_mach_error( + __attribute__((visibility("hidden"))); +extern void my_mach_error( kern_return_t r, char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif - ; -__private_extern__ void mach_fatal( + __attribute__((visibility("hidden"))); +extern void mach_fatal( kern_return_t r, char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif - ; + __attribute__((visibility("hidden"))); diff --git a/cctools/include/stuff/llvm.h b/cctools/include/stuff/llvm.h index 2006a0f..519c3b8 100644 --- a/cctools/include/stuff/llvm.h +++ b/cctools/include/stuff/llvm.h @@ -5,6 +5,7 @@ __private_extern__ LLVMDisasmContextRef llvm_create_disasm( const char *TripleName, + const char *CPU, void *DisInfo, int TagType, LLVMOpInfoCallback GetOpInfo, @@ -21,4 +22,8 @@ __private_extern__ size_t llvm_disasm_instruction( char *OutString, size_t OutStringSize); +__private_extern__ int llvm_disasm_set_options( + LLVMDisasmContextRef DC, + uint64_t Options); + #endif /* _STUFF_LLVM_H_ */ diff --git a/cctools/ld/Makefile b/cctools/ld/Makefile index d186daa..d3ec33b 100644 --- a/cctools/ld/Makefile +++ b/cctools/ld/Makefile @@ -30,11 +30,6 @@ ifneq "clang" "$(notdir $(CC))" PG = -pg endif -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) - ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) @@ -345,16 +340,9 @@ libkld.dylib: $(OBJS) nmedit -p $(SYMROOT)/dynamic_libkld.o libtool -o $(SYMROOT)/libkld.dylib $(SYMROOT)/dynamic_libkld.o -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(CFLAGS) $(COPTS) $(OFLAG) $(RC_CFLAGS) -c \ -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(COPTS) $(OFLAG) $(RC_CFLAGS) -c -MD \ - -dependency-file $(OFILE_DIR)/$*.d -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif clean: -rm -r -f $(OFILE_DIRS) ld_g_dir ld_p_dir make.out @@ -362,7 +350,7 @@ clean: shlib_clean: -rm -r -f $(OBJROOT)/ld_dir $(OBJROOT)/ptmp_obj $(OBJROOT)/otmp_obj \ $(OBJROOT)/dtmp_obj $(OBJROOT)/sarld_dir ld_g_dir ld_p_dir - -cd $(OBJROOT)/shlib_obj; rm -f $(OBJS) Makedep + -cd $(OBJROOT)/shlib_obj; rm -f $(OBJS) install: $(OFILE_DIRS) $(SYMROOT) ld_build $(RC_OS)_lib_ofiles $(RC_OS)_install @@ -471,5 +459,3 @@ installsrc: $(OFILE_DIRS) $(SYMROOT) $(SYMROOT)/ld_dir ld_g_dir ld_p_dir: $(MKDIRS) $@ - --include $(MAKEINCDIR)/Makedep diff --git a/cctools/ld/notes b/cctools/ld/notes index fe99364..76329f2 100644 --- a/cctools/ld/notes +++ b/cctools/ld/notes @@ -109,8 +109,8 @@ Changes for the 5.25 release (the cctools-676 release): Changes for the 5.25 release (the cctools-673 release): - Changed the sources so the arm stuff is not in the open source version. Radar bug #5326431. - - Changed the Makefile to #ifndef __OPEN_SOURCE__ out the arm files - - Added #ifndef __OPEN_SOURCE__ to the following files to bracket arm code: + - Changed the Makefile to #ifndef __OPEN_SOURCE__ + - Added #ifndef __OPEN_SOURCE__ layout.c, ld.c, objects.c, objects.h, sections.c, symbols.c and arm_reloc.c. Changes for the 5.24 release (the cctools-663 release): diff --git a/cctools/libmacho/Makefile b/cctools/libmacho/Makefile index 0af3c52..2fb8ad9 100644 --- a/cctools/libmacho/Makefile +++ b/cctools/libmacho/Makefile @@ -1,18 +1,6 @@ -RC_OS = macos -OFLAG = -Os LEGACY = -D_MACH_I386_THREAD_STATUS_FPSTATE_LEGACY_FIELD_NAMES_ \ -D_ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_ -ifneq "$(RC_MAJOR_RELEASE_TRAIN)" "Tiger" -KERN = -fno-builtin -finline -fno-keep-inline-functions -fsigned-bitfields \ - -msoft-float -nostdinc \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/PrivateHeaders/libsa \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/PrivateHeaders \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/Headers/libsa \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/Headers/bsd \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/Headers \ - -DKERNEL -DKERNEL_PRIVATE -DAPPLE -DNeXT -DLIBSA_PRIVATE -else KERN = -fno-builtin -finline -fno-keep-inline-functions -fsigned-bitfields \ -msoft-float -nostdinc \ -I$(NEXT_ROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders/libsa \ @@ -21,46 +9,30 @@ KERN = -fno-builtin -finline -fno-keep-inline-functions -fsigned-bitfields \ -I$(NEXT_ROOT)/System/Library/Frameworks/Kernel.framework/Headers/bsd \ -I$(NEXT_ROOT)/System/Library/Frameworks/Kernel.framework/Headers \ -DKERNEL -DKERNEL_PRIVATE -DAPPLE -DNeXT -DLIBSA_PRIVATE -endif -ifeq "macos" "$(RC_OS)" - CC := $(shell if [ "$(RC_RELEASE)" == "Tiger" ] || \ - [ "$(RC_RELEASE)" == "Gordian" ] || \ - [ "$(RC_RELEASE)" == "Saffron" ] || \ - [ "$(RC_USE_GCC35_FOR_PPC64)" == "YES" ]; then \ - echo gcc-3.5 ; \ - else \ - echo "$(CC)" ; \ - fi; ) +ifeq "cctools_ofiles_Sim" "$(RC_ProjectName)" + S = _sim endif + +DEPENDENT_LIBS = -nodefaultlibs -umbrella System -L/usr/lib/system \ + -ldyld -lsystem_malloc -lsystem_c -lsystem_kernel -lcompiler_rt + ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) STRIP = $(shell xcrun -find -sdk ${SDKROOT} strip) + DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) else STRIP = strip -endif -ifeq "clang" "$(notdir $(CC))" - CFLAGS = $(OFLAG) -g -Wall $(LEGACY) \ - -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) - PG = -else - CFLAGS = $(OFLAG) -g -Wall $(X_CFLAGS) $(LEGACY) \ - -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) - PG = -pg + DSYMUTIL = dsymutil endif -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "clang" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) - -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif +OFLAG = -Os +CFLAGS = $(OFLAG) -g -Wall $(LEGACY) \ + -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) +PG = -pg +MKDIRS = /bin/mkdir -p SRCROOT = . SYMROOT = . OBJROOT = . @@ -71,42 +43,30 @@ OFILE_DIRS = $(OBJROOT)/shlib_obj $(OBJROOT)/profile_obj \ OFILE_DIR = $(OBJROOT) VPATH = $(OFILE_DIR) -ifeq "macos" "$(RC_OS)" - ARCHIVEDIR := $(shell if [ "$(RC_RELEASE)" = "Beaker" ] || \ - [ "$(RC_RELEASE)" = "Bunsen" ] || \ - [ "$(RC_RELEASE)" = "Gonzo" ]; then \ - echo /Local/Developer/System; else echo /usr/local/lib/system; fi; ) -else - ARCHIVEDIR = /Local/Developer/System -endif +ARCHIVEDIR = /usr/local/lib/system DYLIBDIR = /usr/lib/system CFILES = arch.c getsecbyname.c getsegbyname.c get_end.c \ swap.c hppa_swap.c i386_swap.c m68k_swap.c sparc_swap.c \ - ppc_swap.c i860_swap.c m88k_swap.c + ppc_swap.c i860_swap.c m88k_swap.c slot_name.c INSTALL_FILES = $(CFILES) $(HFILES) shlib.ofileList dylib.ofileList Makefile \ notes OBJS = arch.o getsecbyname.o getsegbyname.o get_end.o swap.o \ hppa_swap.o i386_swap.o m68k_swap.o sparc_swap.o ppc_swap.o \ - i860_swap.o m88k_swap.o + i860_swap.o m88k_swap.o slot_name.o ifeq "$(OLD_LIBKLD)" "YES" KLD_OFILES = kld_ofiles else - KLD_OFILES = + KLD_OFILES = endif all: lib_ofiles -macos: optimized_ofiles $(KLD_OFILES) - -teflon: optimized_ofiles $(KLD_OFILES) - -nextstep: optimized_ofiles $(KLD_OFILES) shlib_ofiles - -lib_ofiles: $(OFILE_DIRS) $(SYMROOT) $(RC_OS) dynamic_ofiles profile_ofiles +lib_ofiles: $(OFILE_DIRS) $(SYMROOT) optimized_ofiles $(KLD_OFILES) \ + dynamic_ofiles profile_ofiles shlib_ofiles: $(OBJROOT)/shlib_obj @if [ $(SRCROOT) = . ]; \ @@ -143,8 +103,8 @@ profile_ofiles: $(OBJROOT)/profile_obj $(OBJROOT)/ptmp_obj @if [ $(SRCROOT) = . ]; \ then \ (cd ptmp_obj; \ - $(MAKE) -f ../Makefile libmacho_pg.a libmacho_profile.dylib \ - INSTALL_NAME=/usr/lib/system/libmacho_profile.dylib \ + $(MAKE) -f ../Makefile libmacho_pg.a libmacho$S_profile.dylib \ + INSTALL_NAME=/usr/lib/system/libmacho$S_profile.dylib \ VPATH=.. \ OFILE_DIR=. \ SRCROOT=.. \ @@ -162,8 +122,8 @@ profile_ofiles: $(OBJROOT)/profile_obj $(OBJROOT)/ptmp_obj else \ (cd $(OBJROOT)/ptmp_obj; \ $(MAKE) -f $(SRCROOT)/Makefile libmacho_pg.a \ - libmacho_profile.dylib \ - INSTALL_NAME=/usr/lib/system/libmacho_profile.dylib \ + libmacho$S_profile.dylib \ + INSTALL_NAME=/usr/lib/system/libmacho$S_profile.dylib \ VPATH=$(SRCROOT) \ OFILE_DIR=$(OBJROOT)/ptmp_obj \ SRCROOT=$(SRCROOT) \ @@ -258,8 +218,8 @@ dynamic_ofiles: $(OBJROOT)/dynamic_obj $(OBJROOT)/dtmp_obj @if [ $(SRCROOT) = . ]; \ then \ (cd dtmp_obj; \ - $(MAKE) -f ../Makefile libmacho.a libmacho.dylib \ - INSTALL_NAME=/usr/lib/system/libmacho.dylib \ + $(MAKE) -f ../Makefile libmacho.a libmacho$S.dylib \ + INSTALL_NAME=/usr/lib/system/libmacho$S.dylib \ VPATH=.. \ OFILE_DIR=. \ SRCROOT=.. \ @@ -269,8 +229,8 @@ dynamic_ofiles: $(OBJROOT)/dynamic_obj $(OBJROOT)/dtmp_obj RC_CFLAGS="$(RC_CFLAGS)" \ RC_ARCHS="$(RC_ARCHS)"); \ (cd dtmp_obj; \ - $(MAKE) -f ../Makefile libmacho_debug.dylib \ - INSTALL_NAME=/usr/lib/system/libmacho_debug.dylib \ + $(MAKE) -f ../Makefile libmacho$S_debug.dylib \ + INSTALL_NAME=/usr/lib/system/libmacho$S_debug.dylib \ VPATH=.. \ OFILE_DIR=. \ SRCROOT=.. \ @@ -285,8 +245,8 @@ dynamic_ofiles: $(OBJROOT)/dynamic_obj $(OBJROOT)/dtmp_obj cp dylib.ofileList dynamic_obj/libmacho.ofileList; \ else \ (cd $(OBJROOT)/dtmp_obj; \ - $(MAKE) -f $(SRCROOT)/Makefile libmacho.a libmacho.dylib \ - INSTALL_NAME=/usr/lib/system/libmacho.dylib \ + $(MAKE) -f $(SRCROOT)/Makefile libmacho.a libmacho$S.dylib \ + INSTALL_NAME=/usr/lib/system/libmacho$S.dylib \ VPATH=$(SRCROOT) \ OFILE_DIR=$(OBJROOT)/dtmp_obj \ SRCROOT=$(SRCROOT) \ @@ -297,8 +257,8 @@ dynamic_ofiles: $(OBJROOT)/dynamic_obj $(OBJROOT)/dtmp_obj RC_CFLAGS="$(RC_CFLAGS)" \ RC_ARCHS="$(RC_ARCHS)"); \ (cd $(OBJROOT)/dtmp_obj; \ - $(MAKE) -f $(SRCROOT)/Makefile libmacho_debug.dylib \ - INSTALL_NAME=/usr/lib/system/libmacho_debug.dylib \ + $(MAKE) -f $(SRCROOT)/Makefile libmacho$S_debug.dylib \ + INSTALL_NAME=/usr/lib/system/libmacho$S_debug.dylib \ VPATH=$(SRCROOT) \ OFILE_DIR=$(OBJROOT)/dtmp_obj \ SRCROOT=$(SRCROOT) \ @@ -315,16 +275,8 @@ dynamic_ofiles: $(OBJROOT)/dynamic_obj $(OBJROOT)/dtmp_obj cp dylib.ofileList $(OBJROOT)/dynamic_obj/libmacho.ofileList; \ fi -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c \ - -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif clean: -rm -r -f $(OFILE_DIRS) $(OBJROOT)/static_obj @@ -335,26 +287,20 @@ shlib_clean: libmacho.a libmacho_pg.a libmacho_static.a libmacho_kld.a: $(OBJS) libtool -static -o $(SYMROOT)/$@ $(OBJS) -libmacho.dylib libmacho_profile.dylib libmacho_debug.dylib: $(OBJS) - $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -dynamiclib \ +libmacho$S.dylib libmacho$S_profile.dylib libmacho$S_debug.dylib: $(OBJS) + $(CC) $(CFLAGS) $(RC_CFLAGS) -dynamiclib \ -o $(SYMROOT)/$@ $(OBJS) \ -install_name $(INSTALL_NAME) \ -compatibility_version 1 \ -current_version $(RC_ProjectSourceVersion) \ - -lSystem - -install: $(RC_OS)_install + $(DEPENDENT_LIBS) + $(DSYMUTIL) $(SYMROOT)/$@ -macos_install: +install: -teflon_install nextstep_install: all - - -lib_ofiles_install: $(RC_OS)_lib_ofiles_install - -macos_lib_ofiles_install: all +lib_ofiles_install: all $(MKDIRS) $(DSTROOT)$(ARCHIVEDIR) $(DSTROOT)$(DYLIBDIR) - if [ $(SRCROOT) = . ]; \ + @if [ $(SRCROOT) = . ]; \ then \ install -c -m 444 dtmp_obj/libmacho.a \ $(DSTROOT)$(ARCHIVEDIR)/libmacho.a; \ @@ -367,15 +313,15 @@ macos_lib_ofiles_install: all install -c -m 444 otmp_obj/libmacho_static.a \ $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \ ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \ - install -c -m 555 dtmp_obj/libmacho.dylib \ - $(DSTROOT)$(DYLIBDIR)/libmacho.dylib; \ - $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho.dylib; \ - install -c -m 555 dtmp_obj/libmacho_profile.dylib \ - $(DSTROOT)$(DYLIBDIR)/libmacho_profile.dylib; \ - $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho_profile.dylib; \ - install -c -m 555 dtmp_obj/libmacho_debug.dylib \ - $(DSTROOT)$(DYLIBDIR)/libmacho_debug.dylib; \ - $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho_debug.dylib; \ + install -c -m 555 dtmp_obj/libmacho$S.dylib \ + $(DSTROOT)$(DYLIBDIR)/libmacho$S.dylib; \ + $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho$S.dylib; \ + install -c -m 555 dtmp_obj/libmacho$S_profile.dylib \ + $(DSTROOT)$(DYLIBDIR)/libmacho$S_profile.dylib; \ + $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho$S_profile.dylib; \ + install -c -m 555 dtmp_obj/libmacho$S_debug.dylib \ + $(DSTROOT)$(DYLIBDIR)/libmacho$S_debug.dylib; \ + $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho$S_debug.dylib; \ else \ install -c -m 444 $(SYMROOT)/libmacho.a \ $(DSTROOT)$(ARCHIVEDIR)/libmacho.a; \ @@ -388,20 +334,17 @@ macos_lib_ofiles_install: all install -c -m 444 $(SYMROOT)/libmacho_static.a \ $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \ ranlib $(DSTROOT)$(ARCHIVEDIR)/libmacho_static.a; \ - install -c -m 555 $(SYMROOT)/libmacho.dylib \ - $(DSTROOT)$(DYLIBDIR)/libmacho.dylib; \ - $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho.dylib; \ - install -c -m 555 $(SYMROOT)/libmacho_profile.dylib \ - $(DSTROOT)$(DYLIBDIR)/libmacho_profile.dylib; \ - $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho_profile.dylib; \ - install -c -m 555 $(SYMROOT)/libmacho_debug.dylib \ - $(DSTROOT)$(DYLIBDIR)/libmacho_debug.dylib; \ - $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho_debug.dylib; \ + install -c -m 555 $(SYMROOT)/libmacho$S.dylib \ + $(DSTROOT)$(DYLIBDIR)/libmacho$S.dylib; \ + $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho$S.dylib; \ + install -c -m 555 $(SYMROOT)/libmacho$S_profile.dylib \ + $(DSTROOT)$(DYLIBDIR)/libmacho$S_profile.dylib; \ + $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho$S_profile.dylib; \ + install -c -m 555 $(SYMROOT)/libmacho$S_debug.dylib \ + $(DSTROOT)$(DYLIBDIR)/libmacho$S_debug.dylib; \ + $(STRIP) -S $(DSTROOT)$(DYLIBDIR)/libmacho$S_debug.dylib; \ fi -teflon_lib_ofiles_install nextstep_lib_ofiles_install: - - installsrc: $(MKDIRS) $(SRCROOT) chmod 755 $(SRCROOT) @@ -410,5 +353,3 @@ installsrc: $(OFILE_DIRS) $(SYMROOT): $(MKDIRS) $@ - --include $(OFILE_DIR)/Makedep diff --git a/cctools/libmacho/arch.c b/cctools/libmacho/arch.c index f469ad9..a6739e8 100644 --- a/cctools/libmacho/arch.c +++ b/cctools/libmacho/arch.c @@ -134,6 +134,8 @@ static const NXArchInfo ArchInfoTable[] = { "arm xscale"}, {"armv6", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V6, NX_LittleEndian, "arm v6"}, + {"armv6m", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V6M, NX_LittleEndian, + "arm v6m"}, {"armv7", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7, NX_LittleEndian, "arm v7"}, {"armv7f", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7F, NX_LittleEndian, @@ -142,6 +144,10 @@ static const NXArchInfo ArchInfoTable[] = { "arm v7s"}, {"armv7k", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7K, NX_LittleEndian, "arm v7k"}, + {"armv7m", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7M, NX_LittleEndian, + "arm v7m"}, + {"armv7em",CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7EM, NX_LittleEndian, + "arm v7em"}, {"little", CPU_TYPE_ANY, CPU_SUBTYPE_LITTLE_ENDIAN, NX_LittleEndian, "Little Endian"}, {"big", CPU_TYPE_ANY, CPU_SUBTYPE_BIG_ENDIAN, NX_BigEndian, diff --git a/cctools/libmacho/notes b/cctools/libmacho/notes index 38d21ca..156f507 100644 --- a/cctools/libmacho/notes +++ b/cctools/libmacho/notes @@ -1,3 +1,16 @@ +Changes for the 5.33 release (the cctools-844 release): +- Changed the Makefile to also link against libsystem_malloc, just before + libsystem_c. Radar bug #13437197 + +Changes for the 5.33 release (the cctools-843 release): +- Changed the Makefile to link against libSystem children rather than + libSystem directly. Radar bug #13239126. +- Added the slot_name() API from Libc to libmacho. Radar bug #13239190. + +Changes for the 5.33 release (the cctools-840 release): +- Added support for new archs: armv6m / armv7m / armv7em . Radar bug #11314463. + - Added entries to the ArchInfoTable[] in arch.c . + Changes for the 5.32 release (the cctools-830 release): - Changed the use of _NSGetMachExecuteHeader() to not cache its return value in a static variable. The changes were in get_end.c, getsecbyname.c and @@ -39,7 +52,7 @@ Changes for the 5.27 release (the cctools-760 release): Radar bug #7016121. - Changed the Makefile to remove the OPEN macro which was -D__OPEN_SOURCE__ and removed it from the CFLAGS. - - Removed the #ifndef __OPEN_SOURCE__ in arch.c that bracketed armv7 + - Removed the #ifndef __OPEN_SOURCE__ references. Changes for the 5.27 release (the cctools-759 release): @@ -77,7 +90,7 @@ Changes for the 5.25 release (the cctools-697 release): Radar bug #5844124. - Changed the Makefile to add the OPEN macro as -D__OPEN_SOURCE__ and added it to the CFLAGS. - - Added #ifndef __OPEN_SOURCE__ to arch.c to bracket armv7 references. + - Added #ifndef __OPEN_SOURCE__ Changes for the 5.25 release (the cctools-696 release): - Changed the Makefile to use -iwithsysroot as part of the KERN flags. @@ -107,7 +120,7 @@ Changes for the 5.25 release (the cctools-673 release): - Changed the sources so the arm stuff is not in the open source version. Radar bug #5326431. - Changed the Makefile to build with -D__OPEN_SOURCE__ with $(OPEN) - - Added #ifndef __OPEN_SOURCE__ to arch.c to bracket arm code. + - Added #ifndef __OPEN_SOURCE__ Changes for the 5.24 release (the cctools-652 release): - Added creating a vers.c file and linking in the vers.o into the libmacho diff --git a/cctools/libmacho/slot_name.c b/cctools/libmacho/slot_name.c new file mode 100644 index 0000000..a780430 --- /dev/null +++ b/cctools/libmacho/slot_name.c @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ + * + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. + * + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and + * limitations under the License. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ + */ +/* + * File: slot_name.c + * Author: Avadis Tevanian, Jr. + * + * Copyright (C) 1987, Avadis Tevanian, Jr. + * + * Convert machine slot values to human readable strings. + * + * HISTORY + * 26-Jan-88 Mary Thompson (mrt) at Carnegie Mellon + * added case for CUP_SUBTYPE_RT_APC + * + * 28-Feb-87 Avadis Tevanian (avie) at Carnegie-Mellon University + * Created. + * + */ + +#include +#include + +/* + * Convert the specified cpu_type/cpu_subtype pair to their + * human readable form. + */ +void slot_name(cpu_type, cpu_subtype, cpu_name, cpu_subname) + cpu_type_t cpu_type; + cpu_subtype_t cpu_subtype; + char **cpu_name, **cpu_subname; +{ + register char *name = "Unknown CPU"; + register char *subname = ""; + const NXArchInfo *ai = NXGetArchInfoFromCpuType(cpu_type, cpu_subtype); + if (ai != NULL) { + name = (char *)ai->name; + subname = (char *)ai->description; + } + *cpu_name = name; + *cpu_subname = subname; +} diff --git a/cctools/libstuff/Makefile b/cctools/libstuff/Makefile index 6102e3e..7b8bc9d 100644 --- a/cctools/libstuff/Makefile +++ b/cctools/libstuff/Makefile @@ -1,19 +1,6 @@ -RC_OS = macos -OFLAG = -Os -LTO = -DLTO_SUPPORT LEGACY = -D_MACH_I386_THREAD_STATUS_FPSTATE_LEGACY_FIELD_NAMES_ \ -D_ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_ -ifneq "$(RC_MAJOR_RELEASE_TRAIN)" "Tiger" -KERN = -fno-builtin -finline -fno-keep-inline-functions -fsigned-bitfields \ - -msoft-float -nostdinc \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/PrivateHeaders/libsa \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/PrivateHeaders \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/Headers/libsa \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/Headers/bsd \ - -iwithsysroot /System/Library/Frameworks/Kernel.framework/Headers \ - -DKERNEL -DKERNEL_PRIVATE -DAPPLE -DNeXT -DLIBSA_PRIVATE -else KERN = -fno-builtin -finline -fno-keep-inline-functions -fsigned-bitfields \ -msoft-float -nostdinc \ -I$(NEXT_ROOT)/System/Library/Frameworks/Kernel.framework/PrivateHeaders/libsa \ @@ -22,37 +9,19 @@ KERN = -fno-builtin -finline -fno-keep-inline-functions -fsigned-bitfields \ -I$(NEXT_ROOT)/System/Library/Frameworks/Kernel.framework/Headers/bsd \ -I$(NEXT_ROOT)/System/Library/Frameworks/Kernel.framework/Headers \ -DKERNEL -DKERNEL_PRIVATE -DAPPLE -DNeXT -DLIBSA_PRIVATE -endif - -X_CFLAGS = -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) - ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) endif +OFLAG = -Os +LTO = -DLTO_SUPPORT G = -g -ifeq "clang" "$(notdir $(CC))" - CFLAGS = $(OFLAG) $(LTO) $(G) -I$(SRCROOT)/../include -Wall \ - $(LEGACY) $(SDK) - PG = -else - CFLAGS = $(OFLAG) $(LTO) $(G) -I$(SRCROOT)/../include -Wall \ - $(X_CFLAGS) $(LEGACY) $(SDK) - PG = -pg -endif - -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif +CFLAGS = $(OFLAG) $(LTO) $(G) -I$(SRCROOT)/../include -Wall $(LEGACY) $(SDK) +PG = -pg +MKDIRS = /bin/mkdir -p SRCROOT = . SYMROOT = . OBJROOT = . @@ -84,17 +53,14 @@ else STATIC_KLD = endif -#all: $(OFILE_DIRS) $(SYMROOT) static dynamic profile $(STATIC_KLD) $(RC_OS) -all: $(OFILE_DIRS) $(SYMROOT) dynamic profile $(STATIC_KLD) $(RC_OS) +all: $(OFILE_DIRS) $(SYMROOT) dynamic profile $(STATIC_KLD) + +lib_static_ofiles: $(STATIC_KLD) lib_ofiles: $(OFILE_DIRS) $(SYMROOT) dynamic lib_ofiles_install: lib_ofiles -teflon macos: - -nextstep: shlib - static: $(OBJROOT)/static_obj @if [ $(SRCROOT) = . ]; \ then \ @@ -248,7 +214,6 @@ apple_version.c: echo "const char apple_version[]=" > $(OFILE_DIR)/$@ echo "\"cctools-$(RC_ProjectSourceVersion)\";" >> $(OFILE_DIR)/$@ -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c -o $(OFILE_DIR)/$*.o $< @@ -257,21 +222,6 @@ lto.o: lto.c -I/Developer/usr/local/include \ -I$(DT_TOOLCHAIN_DIR)/usr/local/include \ -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c \ - -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d - -lto.o: lto.c - $(CC) -std=c99 $(CFLAGS) $(RC_CFLAGS) $(COPTS) -c \ - -I/Developer/usr/local/include \ - -I$(DT_TOOLCHAIN_DIR)/usr/local/include \ - -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif clean shlib_clean: -rm -r -f $(OFILE_DIRS) @@ -307,5 +257,3 @@ fromGASsrc: $(OBJROOT)/dynamic_obj $(OFILE_DIRS) $(SYMROOT): $(MKDIRS) $@ - --include $(OFILE_DIR)/Makedep diff --git a/cctools/libstuff/arch.c b/cctools/libstuff/arch.c index 93f7dc6..48873ab 100644 --- a/cctools/libstuff/arch.c +++ b/cctools/libstuff/arch.c @@ -94,10 +94,13 @@ static const struct arch_flag arch_flags[] = { { "armv5", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V5TEJ}, { "xscale", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_XSCALE}, { "armv6", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V6 }, + { "armv6m", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V6M }, { "armv7", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7 }, { "armv7f", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7F }, { "armv7s", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7S }, { "armv7k", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7K }, + { "armv7m", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7M }, + { "armv7em", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_V7EM }, { NULL, 0, 0 } }; diff --git a/cctools/libstuff/best_arch.c b/cctools/libstuff/best_arch.c index c6722db..c2cb32f 100644 --- a/cctools/libstuff/best_arch.c +++ b/cctools/libstuff/best_arch.c @@ -492,6 +492,21 @@ uint32_t nfat_archs) } for(i = 0; i < nfat_archs; i++){ if(fat_archs[i].cputype == cputype && + fat_archs[i].cpusubtype == CPU_SUBTYPE_ARM_V6M) + return(fat_archs + i); + } + for(i = 0; i < nfat_archs; i++){ + if(fat_archs[i].cputype == cputype && + fat_archs[i].cpusubtype == CPU_SUBTYPE_ARM_V7M) + return(fat_archs + i); + } + for(i = 0; i < nfat_archs; i++){ + if(fat_archs[i].cputype == cputype && + fat_archs[i].cpusubtype == CPU_SUBTYPE_ARM_V7EM) + return(fat_archs + i); + } + for(i = 0; i < nfat_archs; i++){ + if(fat_archs[i].cputype == cputype && fat_archs[i].cpusubtype == CPU_SUBTYPE_ARM_ALL) return(fat_archs + i); } diff --git a/cctools/libstuff/bytesex.c b/cctools/libstuff/bytesex.c index 2f21cd3..baee924 100644 --- a/cctools/libstuff/bytesex.c +++ b/cctools/libstuff/bytesex.c @@ -2561,6 +2561,17 @@ enum byte_sex target_byte_sex) __private_extern__ void +swap_linker_option_command( +struct linker_option_command *lo, +enum byte_sex target_byte_sex) +{ + lo->cmd = SWAP_INT(lo->cmd); + lo->cmdsize = SWAP_INT(lo->cmdsize); + lo->count = SWAP_INT(lo->count); +} + +__private_extern__ + void swap_dyld_info_command( struct dyld_info_command *ed, enum byte_sex target_byte_sex) diff --git a/cctools/libstuff/get_arch_from_host.c b/cctools/libstuff/get_arch_from_host.c index c4a54c3..e9b4428 100644 --- a/cctools/libstuff/get_arch_from_host.c +++ b/cctools/libstuff/get_arch_from_host.c @@ -439,6 +439,14 @@ struct arch_flag *specific_arch_flag) if(specific_arch_flag != NULL) specific_arch_flag->name = "armv6"; return(1); + case CPU_SUBTYPE_ARM_V6M: + if(family_arch_flag != NULL){ + family_arch_flag->name = "arm"; + family_arch_flag->cpusubtype = CPU_SUBTYPE_ARM_ALL; + } + if(specific_arch_flag != NULL) + specific_arch_flag->name = "armv6m"; + return(1); case CPU_SUBTYPE_ARM_V7: if(family_arch_flag != NULL){ family_arch_flag->name = "arm"; @@ -471,6 +479,22 @@ struct arch_flag *specific_arch_flag) if(specific_arch_flag != NULL) specific_arch_flag->name = "armv7k"; return(1); + case CPU_SUBTYPE_ARM_V7M: + if(family_arch_flag != NULL){ + family_arch_flag->name = "arm"; + family_arch_flag->cpusubtype = CPU_SUBTYPE_ARM_ALL; + } + if(specific_arch_flag != NULL) + specific_arch_flag->name = "armv7m"; + return(1); + case CPU_SUBTYPE_ARM_V7EM: + if(family_arch_flag != NULL){ + family_arch_flag->name = "arm"; + family_arch_flag->cpusubtype = CPU_SUBTYPE_ARM_ALL; + } + if(specific_arch_flag != NULL) + specific_arch_flag->name = "armv7em"; + return(1); } break; } diff --git a/cctools/libstuff/llvm.c b/cctools/libstuff/llvm.c index 35e3a6e..04356e5 100644 --- a/cctools/libstuff/llvm.c +++ b/cctools/libstuff/llvm.c @@ -17,11 +17,15 @@ static int tried_to_load_llvm = 0; static void *llvm_handle = NULL; +static void (*initialize)(void) = NULL; static LLVMDisasmContextRef (*create)(const char *, void *, int, LLVMOpInfoCallback, LLVMSymbolLookupCallback) = NULL; +static LLVMDisasmContextRef (*createCPU)(const char *, const char *,void *, int, + LLVMOpInfoCallback, LLVMSymbolLookupCallback) = NULL; static void (*dispose)(LLVMDisasmContextRef) = NULL; static size_t (*disasm)(LLVMDisasmContextRef, uint8_t *, uint64_t, uint64_t, char *, size_t) = NULL; +static int (*options)(LLVMDisasmContextRef, uint64_t) = NULL; /* * Wrapper to dynamically load LIB_LLVM and call LLVMCreateDisasm(). @@ -30,6 +34,7 @@ __private_extern__ LLVMDisasmContextRef llvm_create_disasm( const char *TripleName, +const char *CPU, void *DisInfo, int TagType, LLVMOpInfoCallback GetOpInfo, @@ -78,23 +83,42 @@ LLVMSymbolLookupCallback SymbolLookUp) dispose = dlsym(llvm_handle, "LLVMDisasmDispose"); disasm = dlsym(llvm_handle, "LLVMDisasmInstruction"); + /* Note we allow these to not be defined */ + options = dlsym(llvm_handle, "LLVMSetDisasmOptions"); + createCPU = dlsym(llvm_handle, "LLVMCreateDisasmCPU"); + if(create == NULL || dispose == NULL || disasm == NULL){ + dlclose(llvm_handle); if(llvm_path != NULL) free(llvm_path); llvm_handle = NULL; create = NULL; + createCPU = NULL; dispose = NULL; disasm = NULL; + options = NULL; return(NULL); } } if(llvm_handle == NULL) return(NULL); - DC = create(TripleName, DisInfo, TagType, GetOpInfo, SymbolLookUp); + /* + * Note this was added after the interface was defined, so it may + * be undefined. But if not we must call it first. + */ + initialize = dlsym(llvm_handle, "lto_initialize_disassembler"); + if(initialize != NULL) + initialize(); + + if(*CPU != '\0' && createCPU != NULL) + DC = createCPU(TripleName, CPU, DisInfo, TagType, GetOpInfo, + SymbolLookUp); + else + DC = create(TripleName, DisInfo, TagType, GetOpInfo, SymbolLookUp); return(DC); } @@ -128,3 +152,18 @@ size_t OutStringSize) return(0); return(disasm(DC, Bytes, BytesSize, Pc, OutString, OutStringSize)); } + +/* + * Wrapper to call LLVMSetDisasmOptions(). + */ +__private_extern__ +int +llvm_disasm_set_options( +LLVMDisasmContextRef DC, +uint64_t Options) +{ + + if(options == NULL) + return(0); + return(options(DC, Options)); +} diff --git a/cctools/libstuff/lto.c b/cctools/libstuff/lto.c index 6f5758d..a829a15 100644 --- a/cctools/libstuff/lto.c +++ b/cctools/libstuff/lto.c @@ -231,6 +231,11 @@ char *target_triple) arch_flag->cputype = CPU_TYPE_ARM; arch_flag->cpusubtype = CPU_SUBTYPE_ARM_V6; } + else if(strncmp(target_triple, "armv6m", n) == 0 || + strncmp(target_triple, "thumbv6m", n) == 0){ + arch_flag->cputype = CPU_TYPE_ARM; + arch_flag->cpusubtype = CPU_SUBTYPE_ARM_V6M; + } else if(strncmp(target_triple, "armv7", n) == 0 || strncmp(target_triple, "thumbv7", n) == 0){ arch_flag->cputype = CPU_TYPE_ARM; @@ -251,6 +256,16 @@ char *target_triple) arch_flag->cputype = CPU_TYPE_ARM; arch_flag->cpusubtype = CPU_SUBTYPE_ARM_V7K; } + else if(strncmp(target_triple, "armv7m", n) == 0 || + strncmp(target_triple, "thumbv7m", n) == 0){ + arch_flag->cputype = CPU_TYPE_ARM; + arch_flag->cpusubtype = CPU_SUBTYPE_ARM_V7M; + } + else if(strncmp(target_triple, "armv7em", n) == 0 || + strncmp(target_triple, "thumbv7em", n) == 0){ + arch_flag->cputype = CPU_TYPE_ARM; + arch_flag->cpusubtype = CPU_SUBTYPE_ARM_V7EM; + } else{ return(0); } diff --git a/cctools/libstuff/notes b/cctools/libstuff/notes index 9aae7f8..0097369 100644 --- a/cctools/libstuff/notes +++ b/cctools/libstuff/notes @@ -5,6 +5,31 @@ TODO: - Deal with LC_PREPAGE and unknown load commands that don't need to be swapped. +Changes for the 5.33 release (the cctools-845 release): +- Added the lib_static_ofiles Makefile target to be used by the top level + Makefile so that it does not use the all target and causing libstuff.a to + be overwritten when built with the SED_RC_CFLAGS without the 64-bit archs. + Radar bug #13461906. + +Changes for the 5.33 release (the cctools-841 release): +- Added support for the LC_LINKER_OPTION load command. Radar bug #12906665. + - Added swap_linker_option_command() to bytesex.c . + - Added support for the LC_LINKER_OPTION command in check_Mach_O() in + ofile.c and in swap_object_headers() in swap_headers.c . +- Changed llvm_create_disasm() in llvm.c and added a CPU argument. + Radar bug #12839170. + +Changes for the 5.33 release (the cctools-840 release): +- Changed llvm_create_disasm() in llvm.c to now call lto_initialize_disassembler + if it exists. Radar bug #12750395. +- Added support for new archs: armv6m / armv7m / armv7em . Radar bug #11314463. + - Added entries to the arch_flags[] table in arch.c . + - Updated cpusubtype_findbestarch() in best_arch.c . + - Updated get_arch_from_host() in get_arch_from_host.c . + - Updated get_lto_cputype() in lto.c . +- Added support for marked up llvm disassembler output. Radar bug #11764962. + - Added llvm_disasm_set_options() to llvm.c . + Changes for the 5.32 release (the cctools-835 release): - Added support for the LC_ENCRYPTION_INFO_64 load command. Radar bug #11862845. - Added swap_encryption_command_64() to bytesex.c . @@ -237,7 +262,7 @@ Changes for the 5.27 release (the cctools-760 release): Radar bug #7016121. - Changed the Makefile and removed the OPEN macro which was -D__OPEN_SOURCE__ and removed it from CFLAGS. - - Removed #ifndef __OPEN_SOURCE__ from arch.c, best_arch.c and lto.c which + - Removed #ifndef __OPEN_SOURCE__ bracketed armv7 references. Changes for the 5.27 release (the cctools-759 release): @@ -414,7 +439,7 @@ Changes for the 5.25 release (the cctools-697 release): Radar bug #5844124. - Changed the Makefile to add the OPEN macro as -D__OPEN_SOURCE__ and added it to the CFLAGS. - - Added #ifndef __OPEN_SOURCE__ to arch.c and best_arch.c to bracket armv7 + - Added #ifndef __OPEN_SOURCE__ references. Changes for the 5.25 release (the cctools-696 release): @@ -481,7 +506,7 @@ Changes for the 5.25 release (the cctools-673 release): - Changed the sources so the arm stuff is not in the open source version. Radar bug #5326431. - Changed the Makefile to build with -D__OPEN_SOURCE__ with $(OPEN) - - Added #ifndef __OPEN_SOURCE__ to the following files to bracket arm code: + - Added #ifndef __OPEN_SOURCE__ arch.c, best_arch.c, bytesex.c, get_arch_from_host.c, ofile.c, reloc.c and swap_headers.c . diff --git a/cctools/libstuff/ofile.c b/cctools/libstuff/ofile.c index 1fcf0a2..49c43e3 100644 --- a/cctools/libstuff/ofile.c +++ b/cctools/libstuff/ofile.c @@ -3369,6 +3369,7 @@ struct ofile *ofile) struct prebind_cksum_command *cs; struct encryption_info_command *encrypt_info; struct encryption_info_command_64 *encrypt_info64; + struct linker_option_command *lo; struct dyld_info_command *dyld_info; struct uuid_command *uuid; struct rpath_command *rpath; @@ -4216,6 +4217,23 @@ check_linkedit_data_command: } break; + case LC_LINKER_OPTION: + if(l.cmdsize < sizeof(struct linker_option_command)){ + Mach_O_error(ofile, "malformed object (LC_LINKER_OPTION " + "cmdsize too small) in command %u", i); + goto return_bad; + } + lo = (struct linker_option_command *)lc; + if(swapped) + swap_linker_option_command(lo, host_byte_sex); + if(lo->cmdsize < + sizeof(struct linker_option_command)){ + Mach_O_error(ofile, "malformed object (LC_LINKER_OPTION " + " command %u cmdsize too small)", i); + goto return_bad; + } + break; + case LC_DYLD_INFO: case LC_DYLD_INFO_ONLY: if(l.cmdsize < sizeof(struct dyld_info_command)){ diff --git a/cctools/libstuff/swap_headers.c b/cctools/libstuff/swap_headers.c index ea39ab6..88e1349 100644 --- a/cctools/libstuff/swap_headers.c +++ b/cctools/libstuff/swap_headers.c @@ -93,6 +93,7 @@ struct load_command *load_commands) struct rpath_command *rpath; struct encryption_info_command *ec; struct encryption_info_command_64 *ec64; + struct linker_option_command *lo; struct dyld_info_command *dc; struct version_min_command *vc; uint32_t flavor, count; @@ -1155,6 +1156,15 @@ check_dylinker_command: } break; + case LC_LINKER_OPTION: + lo = (struct linker_option_command *)lc; + if(lo->cmdsize < sizeof(struct linker_option_command)){ + error("in swap_object_headers(): malformed load commands " + "(LC_LINKER_OPTION command %lu is too small", i); + return(FALSE); + } + break; + case LC_DYLD_INFO: case LC_DYLD_INFO_ONLY: dc = (struct dyld_info_command *)lc; @@ -1652,6 +1662,11 @@ check_dylinker_command: swap_encryption_command_64(ec64, target_byte_sex); break; + case LC_LINKER_OPTION: + lo = (struct linker_option_command *)lc; + swap_linker_option_command(lo, target_byte_sex); + break; + case LC_DYLD_INFO: case LC_DYLD_INFO_ONLY: dc = (struct dyld_info_command *)lc; diff --git a/cctools/man/Makefile b/cctools/man/Makefile index 48e98ec..5be1575 100644 --- a/cctools/man/Makefile +++ b/cctools/man/Makefile @@ -6,10 +6,11 @@ endif DYLD_MAN1 = dyld.1 OS_MAN1 = strings.1 lipo.1 -COMMON_MAN1 = as.1 gprof.1 nm.1 otool.1 ranlib.1 segedit.1 size.1 \ +COMMON_MAN1 = as.1 nm.1 otool.1 ranlib.1 segedit.1 size.1 \ strip.1 libtool.1 cmpdylib.1 pagestuff.1 \ redo_prebinding.1 nmedit.1 install_name_tool.1 \ codesign_allocate.1 ctf_insert.1 +DEAD = gprof.1 DYLD_MAN3 = dyld.3 NSModule.3 NSObjectFileImage.3 dyld_debug.3 MAN3 = kld.3 arch.3 get_end.3 end.3 getsectbyname.3 \ diff --git a/cctools/man/gprof.1 b/cctools/man/gprof.1 deleted file mode 100644 index b7a6272..0000000 --- a/cctools/man/gprof.1 +++ /dev/null @@ -1,284 +0,0 @@ -.\" $OpenBSD: gprof.1,v 1.4 1996/10/15 23:55:56 deraadt Exp $ -.\" $NetBSD: gprof.1,v 1.6 1995/11/21 22:24:55 jtc Exp $ -.\" -.\" Copyright (c) 1983, 1990, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. All advertising materials mentioning features or use of this software -.\" must display the following acknowledgement: -.\" This product includes software developed by the University of -.\" California, Berkeley and its contributors. -.\" 4. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" @(#)gprof.1 8.1 (Berkeley) 6/6/93 -.\" -.TH GPROF 1 "July 28, 2005" "Apple Computer, Inc." -.SH NAME -gprof \- display call graph profile data -.SH SYNOPSIS -.B gprof -[ \fIoptions\fR ] [ a.out [ gmon.out ... ] ] -.SH DESCRIPTION -.I gprof -produces an execution profile of a C, Pascal, or Fortran77 program. -The effect of called routines is incorporated in the profile of each caller. -The profile data is taken from the call graph profile file -.RI ( gmon.out -by default), which is created by programs -compiled with the -.B \-pg -option of -.IR cc , -.IR pc , -and -.IR f77 . -The symbol table in the -named object file -.RI ( a.out -by default) -is read and correlated with the -call graph profile file. -If more than one profile file is specified, -the -.I gprof -output shows the sum of the profile information in the given profile files. -.PP -First, a flat profile is given. -This listing gives the total execution times -and call counts for each of the functions -in the program, sorted by decreasing time. -.PP -Next, these times are propagated along the edges of the call graph. -Cycles are discovered, and calls into a cycle are made to share the time -of the cycle. -A second listing shows the functions -sorted according to the time they represent -including the time of their call graph descendents. -Below each function entry is shown its (direct) call graph children, -and how their times are propagated to this function. -A similar display above the function shows how this function's time and the -time of its descendents is propagated to its (direct) call graph parents. -.PP -Cycles are also shown, with an entry for the cycle as a whole as well as a -listing of the members of the cycle and their contributions to the -time and call counts of the cycle. -.SH "UNIVERSAL FILE SUPPORT" -.I gprof -accepts a ``universal'' file for the -.I a.out -file, using the host architecture from the file. (It is an error if the -``universal'' file does not contain the host architecture.) -.SH OPTIONS -.TP -The following options are available: -.TP -.B \-a -suppresses the displaying of statically declared functions. -If this option is given, all relevant information about the static function -(such as time samples, calls to other functions, calls from other functions) -belongs to the function loaded just before the static function in the -.I a.out -file. -.TP -.B \-b -suppresses the displaying of a description of each field in the profile. -.TP -.B \-c -the static call graph of the program is discovered by a heuristic -which examines the text space of the object file. -Static-only parents or children are indicated -with call counts of 0. (The -.B \-c -option is currently not supported.) -.TP -.BI \-e " name" -suppresses the displaying of the graph profile entry for routine -.I name -and all its descendants -(unless they have other ancestors that aren't suppressed). -More than one -.B \-e -option may be given. -Only one -.I name -may be given with each -.B \-e -option. -.TP -.BI \-E " name" -suppresses the displaying of the graph profile entry for routine -.I name -(and its descendants) as -.BR \-e , -above, and also excludes the time spent in -.I name -(and its descendants) from the total and percentage time computations. -(For example, -.B \-E -.I mcount -and all of the other -.IR monitor (3) -routines are excluded by default.) -.TP -.BI \-f " name" -displays the graph profile entry of only the specified routine -.I name -and its descendants. -More than one -.B \-f -option may be given. -Only one -.I name -may be given with each -.B \-f -option. -.TP -.BI \-F " name" -displays the graph profile entry of only the routine -.I name -and its descendants (as -.BR \-f, -above) and also uses only the times of the displayed routines -in total time and percentage computations. -More than one -.B \-F -option may be given. -Only one -.I name -may be given with each -.B \-F -option. -The -.B \-F -option -overrides -the -.B \-E -option. -.TP -.B \-s -a profile file -.I gmon.sum -is produced which represents -the sum of the profile information in all the specified profile files. -This summary profile file may be given to subsequent -executions of gprof (probably also with a -.BR \-s ) -to accumulate profile data across several runs of an -.I a.out -file. -.TP -.B \-S -produces four order files suitable as input to -.IR ld (1): -.I gmon.order -is an ordering based on a closest is best algorithm, -.I callf.order -is based on call frequency, -.I callo.order -is based on call order and -.I time.order -is based on time. -The order files contain only those functions which were called or -sampled (including spontaneous functions). For library functions to -appear correctly in the order file, a -.I whatsloaded -file produced by -.IR ld (1) -should exist in the working directory. Filenames in the order file -will be missing for: files compiled without the -.BR \-g -option, assembly files, and stripped executables. -This option does not work with executables that have already been scattered. -The -.I gmon.order -file can take a long time to produce and can be suppressed with the -.B \-x -option. -.TP -.B \-z -displays routines which have zero usage (as indicated by call counts -and accumulated time). -This is useful in conjunction with the -.B \-c -option for discovering which routines were never called. -.SH FILES -.ta 1.5i -a.out -the namelist and text space. -.br -gmon.out -dynamic call graph and profile. -.br -gmon.sum -summarized dynamic call graph and profile. -.br -gmon.order -ordering based on closest is best algorithm. -.br -callf.order -ordering based on call frequency. -.br -callo.order -ordering based on call order. -.br -time.order -ordering based on time. -.SH "SEE ALSO" -monitor(3), profil(2), cc(1) -.br -dyld(1) and the DYLD_IMAGE_SUFFIX environment variable -.br -``gprof: A Call Graph Execution Profiler'', by -Graham, S.L., Kessler, P.B., McKusick, M.K.; -.IR "Proceedings of the SIGPLAN '82 Symposium on Compiler Construction" , -SIGPLAN Notices, Vol. 17, No. 6, pp. 120-126, June 1982. -.SH BUGS -Beware of quantization errors. -The granularity of the sampling is shown, but remains -statistical at best. -We assume that the time for each execution of a function -can be expressed by the total time for the function divided -by the number of times the function is called. -Thus the time propagated along the call graph arcs to parents of that -function is directly proportional to the number of times that -arc is traversed. -.PP -Parents which are not themselves profiled will have the time of -their profiled children propagated to them, but they will appear -to be spontaneously invoked in the call graph listing, and will -not have their time propagated further. -Similarly, signal catchers, even though profiled, will appear -to be spontaneous (although for more obscure reasons). -Any profiled children of signal catchers should have their times -propagated properly, unless the signal catcher was invoked during -the execution of the profiling routine, in which case all is lost. -.PP -The profiled program must call -.IR exit (2) -or return normally for the profiling information to be saved -in the -.B gmon.out -file. diff --git a/cctools/man/notes b/cctools/man/notes index f9bbb47..130b0dd 100644 --- a/cctools/man/notes +++ b/cctools/man/notes @@ -2,8 +2,12 @@ TODO: - Add -v description to checksyms. - The 4.4bsd a.out(5) man page is wrong for Rhapsody. +Changes for the 5.30 release (the cctools-841 release): +- Changed the Makefile to stop installing gprof.1 . Radar bug #12206921. +- Added the -mcpu= option to otool.1 . Radar bug #12839170. + Changes for the 5.33 release (the cctools-838 release): -- Change the otool(1) man age to indicate that -q is the default. Radar bug +- Change the otool(1) man page to indicate that -q is the default. Radar bug #9801054. Changes for the 5.32 release (the cctools-830 release): diff --git a/cctools/man/otool.1 b/cctools/man/otool.1 index fe05cde..9ae233e 100644 --- a/cctools/man/otool.1 +++ b/cctools/man/otool.1 @@ -1,4 +1,4 @@ -.TH OTOOL 1 "August 28, 2012" "Apple, Inc." +.TH OTOOL 1 "December 11, 2012" "Apple, Inc." .SH NAME otool \- object file displaying tool .SH SYNOPSIS @@ -137,6 +137,11 @@ Don't print leading addresses or headers with disassembly of sections. .B \-q Use the llvm disassembler when doing disassembly, this is available for the x86 and arm architectures. This is the default. +.TP +.BI \-mcpu= arg +When doing disassembly using the llvm disassembler use the cpu +.I arg. +.TP .B \-Q Use .IR otool (1)'s diff --git a/cctools/misc/Makefile b/cctools/misc/Makefile index 6ced1f8..63b1d9b 100644 --- a/cctools/misc/Makefile +++ b/cctools/misc/Makefile @@ -1,31 +1,23 @@ export USE_APPLE_PB_SUPPORT = all -OFLAG = -Os -LTO = -DLTO_SUPPORT -TRIE = -DTRIE_SUPPORT -RC_OS = macos -X_CFLAGS = ifneq "" "$(SDKROOT)" SDK = -isysroot $(SDKROOT) CC = $(shell xcrun -find -sdk $(SDKROOT) cc) CXX = $(shell xcrun -find -sdk $(SDKROOT) c++) -endif -ifeq "clang" "$(notdir $(CC))" - CFLAGS = $(OFLAG) $(LTO) $(TRIE) -g -Wall -Wno-format-nonliteral \ - -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) \ - -I$(DT_TOOLCHAIN_DIR)/usr/local/include + DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) else - CFLAGS = $(OFLAG) $(LTO) $(TRIE) -g -Wall $(X_CFLAGS) \ - -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) \ - -I$(DT_TOOLCHAIN_DIR)/usr/local/include + DSYMUTIL = dsymutil endif -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) +OFLAG = -Os +LTO = -DLTO_SUPPORT +TRIE = -DTRIE_SUPPORT +CFLAGS = $(OFLAG) $(LTO) $(TRIE) -g -Wall \ + -I$(SRCROOT) -I$(SRCROOT)/../include -I$(OFILE_DIR) $(SDK) \ + -I$(DT_TOOLCHAIN_DIR)/usr/local/include LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff +CXXLIB = -stdlib=libc++ ifeq "" "$(TRIE)" LIB_PRUNETRIE = @@ -33,12 +25,7 @@ ifeq "" "$(TRIE)" LIB_PRUNETRIE = -L$(DT_TOOLCHAIN_DIR)/usr/local/lib -lprunetrie endif -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif - +MKDIRS = /bin/mkdir -p SRCROOT = . OBJROOT = . OFILE_DIR = $(OBJROOT) @@ -65,35 +52,18 @@ PROGS = $(OS_PROGS) size.NEW nm.NEW libtool.NEW checksyms.NEW \ pagestuff.NEW redo_prebinding.NEW seg_addr_table.NEW check_dylib.NEW \ seg_hack.NEW install_name_tool.NEW codesign_allocate.NEW ctf_insert.NEW -teflon_all macos_all: $(PROGS) - -nextstep_all: $(PROGS) - -all: $(OFILE_DIR) $(SYMROOT) $(RC_OS)_all lib_ofiles +all: $(OFILE_DIR) $(SYMROOT) $(PROGS) lib_ofiles os_tools: $(OFILE_DIR) $(SYMROOT) $(OS_PROGS) lib_ofiles: $(OFILE_DIR) $(SYMROOT) libredo_prebinding.a -ifeq "NO" "$(USE_DEPENDENCY_FILE)" .c.o: $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -MD -dependency-file \ - $(OFILE_DIR)/$*.d -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif libredo_prebinding.o: redo_prebinding.c -ifeq "NO" "$(USE_DEPENDENCY_FILE)" $(CC) $(CFLAGS) $(RC_CFLAGS) -c \ -o $(OFILE_DIR)/$*.o $(SRCROOT)/redo_prebinding.c -DLIBRARY_API -else - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $(SRCROOT)/redo_prebinding.c -DLIBRARY_API - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif checksyms.NEW: checksyms.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -101,6 +71,7 @@ checksyms.NEW: checksyms.o $(OFILE_DIR)/checksyms.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/checksyms.NEW \ $(OFILE_DIR)/checksyms.private.o + $(DSYMUTIL) $(SYMROOT)/checksyms.NEW cmpdylib.NEW: cmpdylib.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -108,6 +79,7 @@ cmpdylib.NEW: cmpdylib.o $(OFILE_DIR)/cmpdylib.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/cmpdylib.NEW \ $(OFILE_DIR)/cmpdylib.private.o + $(DSYMUTIL) $(SYMROOT)/cmpdylib.NEW lipo.NEW: lipo.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -115,6 +87,7 @@ lipo.NEW: lipo.o $(OFILE_DIR)/lipo.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/lipo.NEW \ $(OFILE_DIR)/lipo.private.o + $(DSYMUTIL) $(SYMROOT)/lipo.NEW size.NEW: size.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -122,6 +95,7 @@ size.NEW: size.o $(OFILE_DIR)/size.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/size.NEW \ $(OFILE_DIR)/size.private.o + $(DSYMUTIL) $(SYMROOT)/size.NEW strings.NEW: strings.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -129,6 +103,7 @@ strings.NEW: strings.o $(OFILE_DIR)/strings.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/strings.NEW \ $(OFILE_DIR)/strings.private.o + $(DSYMUTIL) $(SYMROOT)/strings.NEW nm.NEW: nm.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -136,6 +111,7 @@ nm.NEW: nm.o $(OFILE_DIR)/nm.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/nm.NEW \ $(OFILE_DIR)/nm.private.o + $(DSYMUTIL) $(SYMROOT)/nm.NEW libtool.NEW: libtool.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -143,6 +119,7 @@ libtool.NEW: libtool.o $(OFILE_DIR)/libtool.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/libtool.NEW \ $(OFILE_DIR)/libtool.private.o + $(DSYMUTIL) $(SYMROOT)/libtool.NEW redo_prebinding.NEW: redo_prebinding.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -150,6 +127,7 @@ redo_prebinding.NEW: redo_prebinding.o $(OFILE_DIR)/redo_prebinding.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/redo_prebinding.NEW \ $(OFILE_DIR)/redo_prebinding.private.o + $(DSYMUTIL) $(SYMROOT)/redo_prebinding.NEW libredo_prebinding.a: libredo_prebinding.o $(CC) $(RC_CFLAGS) -nostdlib -r -o $(OBJROOT)/libredo.o \ @@ -162,6 +140,7 @@ seg_addr_table.NEW: seg_addr_table.o $(OFILE_DIR)/seg_addr_table.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/seg_addr_table.NEW \ $(OFILE_DIR)/seg_addr_table.private.o + $(DSYMUTIL) $(SYMROOT)/seg_addr_table.NEW check_dylib.NEW: check_dylib.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -169,6 +148,7 @@ check_dylib.NEW: check_dylib.o $(OFILE_DIR)/check_dylib.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/check_dylib.NEW \ $(OFILE_DIR)/check_dylib.private.o + $(DSYMUTIL) $(SYMROOT)/check_dylib.NEW inout.NEW: inout.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -176,6 +156,7 @@ inout.NEW: inout.o $(OFILE_DIR)/inout.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/inout.NEW \ $(OFILE_DIR)/inout.private.o + $(DSYMUTIL) $(SYMROOT)/inout.NEW codesign_allocate.NEW: codesign_allocate.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -184,6 +165,7 @@ codesign_allocate.NEW: codesign_allocate.o $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/codesign_allocate.NEW \ -sectcreate __TEXT __info_plist Info.plist \ $(OFILE_DIR)/codesign_allocate.private.o + $(DSYMUTIL) $(SYMROOT)/codesign_allocate.NEW ctf_insert.NEW: ctf_insert.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -191,6 +173,7 @@ ctf_insert.NEW: ctf_insert.o $(OFILE_DIR)/ctf_insert.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/ctf_insert.NEW \ $(OFILE_DIR)/ctf_insert.private.o + $(DSYMUTIL) $(SYMROOT)/ctf_insert.NEW seg_hack.NEW: seg_hack.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -198,6 +181,7 @@ seg_hack.NEW: seg_hack.o $(OFILE_DIR)/seg_hack.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/seg_hack.NEW \ $(OFILE_DIR)/seg_hack.private.o + $(DSYMUTIL) $(SYMROOT)/seg_hack.NEW install_name_tool.NEW: install_name_tool.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -205,6 +189,7 @@ install_name_tool.NEW: install_name_tool.o $(OFILE_DIR)/install_name_tool.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/install_name_tool.NEW \ $(OFILE_DIR)/install_name_tool.private.o + $(DSYMUTIL) $(SYMROOT)/install_name_tool.NEW indr.NEW: indr.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -212,13 +197,15 @@ indr.NEW: indr.o $(OFILE_DIR)/indr.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/indr.NEW \ $(OFILE_DIR)/indr.private.o + $(DSYMUTIL) $(SYMROOT)/indr.NEW strip.NEW: strip.o $(CC) $(RC_CFLAGS) -nostdlib -r \ -o $(OBJROOT)/strip.private.o \ $(OFILE_DIR)/strip.o $(LIBSTUFF) $(CXX) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/strip.NEW \ - $(OFILE_DIR)/strip.private.o $(LIB_PRUNETRIE) + $(OFILE_DIR)/strip.private.o $(LIB_PRUNETRIE) $(CXXLIB) + $(DSYMUTIL) $(SYMROOT)/strip.NEW nmedit.NEW: nmedit.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -226,16 +213,11 @@ nmedit.NEW: nmedit.o $(OFILE_DIR)/nmedit.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/nmedit.NEW \ $(OFILE_DIR)/nmedit.private.o + $(DSYMUTIL) $(SYMROOT)/nmedit.NEW nmedit.o: strip.c -ifeq "NO" "$(USE_DEPENDENCY_FILE)" $(CC) $(CFLAGS) $(RC_CFLAGS) -c \ -o $(OFILE_DIR)/nmedit.o $(SRCROOT)/strip.c -DNMEDIT -else - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/nmedit.o $(SRCROOT)/strip.c -DNMEDIT - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif segedit.NEW: segedit.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -243,6 +225,7 @@ segedit.NEW: segedit.o $(OFILE_DIR)/segedit.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/segedit.NEW \ $(OFILE_DIR)/segedit.private.o + $(DSYMUTIL) $(SYMROOT)/segedit.NEW pagestuff.NEW: pagestuff.o $(CC) $(RC_CFLAGS) -nostdlib -r \ @@ -250,6 +233,7 @@ pagestuff.NEW: pagestuff.o $(OFILE_DIR)/pagestuff.o $(LIBSTUFF) $(CC) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/pagestuff.NEW \ $(OFILE_DIR)/pagestuff.private.o + $(DSYMUTIL) $(SYMROOT)/pagestuff.NEW clean: shlib_clean @@ -322,9 +306,10 @@ shlib_clean: $(OFILE_DIR)/cmpdylib.private.o \ $(OFILE_DIR)/nmedit.private.o \ $(OFILE_DIR)/strip.private.o \ - -rm -f $(OFILE_DIR)/Makedep make.out + -rm -f make.out + -rm -r -f *dSYM -install: all $(RC_OS)_install os_tools_install +install: all dt_install os_tools_install install_os_tools: os_tools os_tools_install @@ -334,7 +319,7 @@ os_tools_install: $(DSTROOT)$(USRBINDIR)/strings install -c -s -m 555 $(SYMROOT)/lipo.NEW $(DSTROOT)$(USRBINDIR)/lipo -teflon_install macos_install: common_install +dt_install: $(MKDIRS) $(DSTROOT)$(USRBINDIR) install -c -s -m 555 $(SYMROOT)/strip.NEW $(DSTROOT)$(USRBINDIR)/strip install -c -s -m 555 $(SYMROOT)/size.NEW $(DSTROOT)$(USRBINDIR)/size @@ -357,27 +342,6 @@ teflon_install macos_install: common_install $(DSTROOT)$(USRBINDIR)/codesign_allocate install -c -s -m 555 $(SYMROOT)/ctf_insert.NEW \ $(DSTROOT)$(USRBINDIR)/ctf_insert - -nextstep_install: common_install - $(MKDIRS) $(DSTROOT)$(BINDIR) - $(MKDIRS) $(DSTROOT)$(LOCBINDIR) - install -c -s -m 555 $(SYMROOT)/strip.NEW $(DSTROOT)$(BINDIR)/strip - install -c -s -m 555 $(SYMROOT)/strings.NEW $(DSTROOT)$(BINDIR)/strings - install -c -s -m 555 $(SYMROOT)/size.NEW $(DSTROOT)$(BINDIR)/size - install -c -s -m 555 $(SYMROOT)/nm.NEW $(DSTROOT)$(BINDIR)/nm - install -c -s -m 555 $(SYMROOT)/libtool.NEW $(DSTROOT)$(BINDIR)/libtool - (cd $(DSTROOT)$(BINDIR); rm -f ranlib; ln -s libtool ranlib) - install -c -s -m 555 $(SYMROOT)/lipo.NEW $(DSTROOT)$(BINDIR)/lipo - install -c -s -m 555 $(SYMROOT)/segedit.NEW $(DSTROOT)$(BINDIR)/segedit - install -c -s -m 555 $(SYMROOT)/cmpdylib.NEW \ - $(DSTROOT)$(BINDIR)/cmpdylib - install -c -s -m 555 $(SYMROOT)/pagestuff.NEW \ - $(DSTROOT)$(BINDIR)/pagestuff - install -c -s -m 555 $(SYMROOT)/redo_prebinding.NEW \ - $(DSTROOT)$(BINDIR)/redo_prebinding - install -c -s -m 555 $(SYMROOT)/nmedit.NEW $(DSTROOT)$(LOCBINDIR)/nmedit - -common_install: $(MKDIRS) $(DSTROOT)$(LOCBINDIR) install -c -s -m 555 $(SYMROOT)/checksyms.NEW \ $(DSTROOT)$(LOCBINDIR)/checksyms @@ -402,5 +366,3 @@ installsrc: $(OFILE_DIR) $(SYMROOT): $(MKDIRS) $@ - --include $(OFILE_DIR)/Makedep diff --git a/cctools/misc/install_name_tool.c b/cctools/misc/install_name_tool.c index d576e62..a549865 100644 --- a/cctools/misc/install_name_tool.c +++ b/cctools/misc/install_name_tool.c @@ -978,6 +978,7 @@ uint32_t *header_size) rpath2->path.offset = sizeof(struct rpath_command); path2 = (char *)rpath2 + rpath2->path.offset; strcpy(path2, add_rpaths[i].new); + lc2 = (struct load_command *)((char *)lc2 + lc2->cmdsize); } ncmds += nadd_rpaths; ncmds -= ndelete_rpaths; diff --git a/cctools/misc/lipo.c b/cctools/misc/lipo.c index 538faca..3d49563 100644 --- a/cctools/misc/lipo.c +++ b/cctools/misc/lipo.c @@ -822,6 +822,7 @@ void create_fat(void) { uint32_t i, j, offset; + char *rename_file; int fd; /* fold in specified segment alignments */ @@ -878,16 +879,10 @@ create_fat(void) offset += thin_files[i].fat_arch.size; } - /* - * Create the output file. The unlink() is done to handle the - * problem when the outputfile is not writable but the directory - * allows the file to be removed and thus created (since the file - * may not be there the return code of the unlink() is ignored). - */ - (void)unlink(output_file); - if((fd = open(output_file, O_WRONLY | O_CREAT | O_TRUNC, + rename_file = makestr(output_file, ".lipo", NULL); + if((fd = open(rename_file, O_WRONLY | O_CREAT | O_TRUNC, output_filemode)) == -1) - system_fatal("can't create output file: %s", output_file); + system_fatal("can't create temporary output file: %s", rename_file); /* * If this is an extract_family_flag operation and the is just one @@ -899,8 +894,8 @@ create_fat(void) #endif /* __LITTLE_ENDIAN__ */ if(write(fd, &fat_header, sizeof(struct fat_header)) != sizeof(struct fat_header)) - system_fatal("can't wtite fat header to output file: %s", - output_file); + system_fatal("can't write fat header to output file: %s", + rename_file); #ifdef __LITTLE_ENDIAN__ swap_fat_header(&fat_header, LITTLE_ENDIAN_BYTE_SEX); #endif /* __LITTLE_ENDIAN__ */ @@ -911,7 +906,7 @@ create_fat(void) if(write(fd, &(thin_files[i].fat_arch), sizeof(struct fat_arch)) != sizeof(struct fat_arch)) system_fatal("can't write fat arch to output file: %s", - output_file); + rename_file); #ifdef __LITTLE_ENDIAN__ swap_fat_arch(&(thin_files[i].fat_arch), 1, LITTLE_ENDIAN_BYTE_SEX); @@ -921,13 +916,17 @@ create_fat(void) for(i = 0; i < nthin_files; i++){ if(extract_family_flag == FALSE || nthin_files > 1) if(lseek(fd, thin_files[i].fat_arch.offset, L_SET) == -1) - system_fatal("can't lseek in output file: %s", output_file); + system_fatal("can't lseek in output file: %s", rename_file); if(write(fd, thin_files[i].addr, thin_files[i].fat_arch.size) != (int)(thin_files[i].fat_arch.size)) - system_fatal("can't write to output file: %s", output_file); + system_fatal("can't write to output file: %s", rename_file); } if(close(fd) == -1) - system_fatal("can't close output file: %s", output_file); + system_fatal("can't close output file: %s", rename_file); + if(rename(rename_file, output_file) == -1) + system_error("can't move temporary file: %s to file: %s", + output_file, rename_file); + free(rename_file); } /* @@ -1471,7 +1470,7 @@ cpu_subtype_t *cpusubtype) #endif /* LTO_SUPPORT */ } } - } + } offset += rnd(strtoul(ar_hdr->ar_size, NULL, 10), sizeof(short)); } @@ -1541,15 +1540,18 @@ enum bool swapped) enum byte_sex host_byte_sex; /* - * Special case ppc, ppc64, i386 and x86_64 architectures and return 12. + * Special case ppc and i386 architectures and return 12. * We know that with those architectures that the kernel and mmap only * need file offsets to be page (4096 byte) aligned. */ if(mhp->cputype == CPU_TYPE_POWERPC || - mhp->cputype == CPU_TYPE_POWERPC64 || - mhp->cputype == CPU_TYPE_I386 || - mhp->cputype == CPU_TYPE_X86_64) + mhp->cputype == CPU_TYPE_I386) return(12); + /* + * Special case ARM and return 14. As it has 16k pages. + */ + if(mhp->cputype == CPU_TYPE_ARM) + return(14); host_byte_sex = get_host_byte_sex(); @@ -1630,13 +1632,11 @@ enum bool swapped) enum byte_sex host_byte_sex; /* - * Special case ppc, ppc64, i386 and x86_64 architectures and return 12. + * Special case ppc64 and x86_64 architectures and return 12. * We know that with those architectures that the kernel and mmap only * need file offsets to be page (4096 byte) aligned. */ - if(mhp64->cputype == CPU_TYPE_POWERPC || - mhp64->cputype == CPU_TYPE_POWERPC64 || - mhp64->cputype == CPU_TYPE_I386 || + if(mhp64->cputype == CPU_TYPE_POWERPC64 || mhp64->cputype == CPU_TYPE_X86_64) return(12); @@ -1912,6 +1912,9 @@ struct fat_arch *fat_arch) case CPU_SUBTYPE_ARM_V6: printf("armv6"); break; + case CPU_SUBTYPE_ARM_V6M: + printf("armv6m"); + break; case CPU_SUBTYPE_ARM_V7: printf("armv7"); break; @@ -1924,6 +1927,12 @@ struct fat_arch *fat_arch) case CPU_SUBTYPE_ARM_V7K: printf("armv7k"); break; + case CPU_SUBTYPE_ARM_V7M: + printf("armv7m"); + break; + case CPU_SUBTYPE_ARM_V7EM: + printf("armv7em"); + break; default: goto print_arch_unknown; } @@ -2181,6 +2190,34 @@ cpu_subtype_t cpusubtype) printf(" cputype CPU_TYPE_ARM\n" " cpusubtype CPU_SUBTYPE_ARM_V6\n"); break; + case CPU_SUBTYPE_ARM_V6M: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V6M\n"); + break; + case CPU_SUBTYPE_ARM_V7: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V7\n"); + break; + case CPU_SUBTYPE_ARM_V7F: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V7F\n"); + break; + case CPU_SUBTYPE_ARM_V7S: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V7S\n"); + break; + case CPU_SUBTYPE_ARM_V7K: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V7K\n"); + break; + case CPU_SUBTYPE_ARM_V7M: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V7M\n"); + break; + case CPU_SUBTYPE_ARM_V7EM: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V7EM\n"); + break; case CPU_SUBTYPE_ARM_ALL: printf(" cputype CPU_TYPE_ARM\n" " cpusubtype CPU_SUBTYPE_ARM_ALL\n"); diff --git a/cctools/misc/notes b/cctools/misc/notes dissimilarity index 90% index 3bae53a..91ff303 100644 --- a/cctools/misc/notes +++ b/cctools/misc/notes @@ -1,3106 +1,305 @@ -To Do: -- Add the -prebind_allow_overlap and -prebind_all_two_level_modules to libtool - see Radar bug 3417137. -- Change to Doug's approach to relayout, namely something like reserving the - last 10% of the load region for new dylibs and then evenly spacing the - existing dylibs in the other 90% (for split libs). See email of 11/6/2000. -- Have cmpdylib check Objc info Tracker bug #78124. -- Fix a bug in strip on line 1105 where it uses missing_reloc_symbols when it - could have been set otherwise and does not print the next line. -- Maybe add fat support for segedit(1) - -Changes for the 5.33 release (the cctools-839 release): -- Changed the Makefile so that strip(1)'s use of and - libprunetrie.a so that it comes from DT_TOOLCHAIN_DIR. Radar bug #12296255. - -Changes for the 5.32 release (the cctools-835 release): -- Fixed a bug in strip(1) when the input was a .o file containg - LC_FUNCTION_STARTS load command. The code in get_starting_syminfo_offset() in - strip.c did not look for the load command which can be the start of the - symbolic offset in the file. Radar bug #11913911. - -Changes for the 5.32 release (the cctools-833 release): -- Changed strip(1) to always use ld -r on ARM .o files to rename thumb symbols - so they don't get stripped. Radar bug #11795809. - -Changes for the 5.32 release (the cctools-830 release): -- Fixed a bug in nmedit(1) when the input was a .o file containg a - LC_DATA_IN_CODE load command. The code in get_starting_syminfo_offset() in - strip.c did not look for the load command which can be the start of the - symbolic offset in the file. Radar bug #11554503. -- Fixed a bug in libtool(1) when run as ranlib(1) to not update the table of - contents if the input archive's table of content's member name is not using - the extended long name format and we create an table of contents with a - extended long name format (or vice a versa). Radar bug #10399314. - -Changes for the 5.31 release (the cctools-827 release): -- Added #ifdef guards for LTO_SUPPORT in lipo.c . Radar bug #11296366. - -Changes for the 5.31 release (the cctools-825 release): -- Fixed the full strip case with -no_uuid that was not stripping the LC_UUID - load command. A call to strip_LC_UUID_commands() was added to strip_object() - in strip.c for the full strip case. Radar bug #11136733. - -Changes for the 5.31 release (the cctools-824 release): -- Removed the creation of the link to /usr/local/bin/nmedit from - $(DSTROOT)$(LOCBINDIR)/nmedit in the Makefile. Radar bug #10688477. -- Fixed a bunch of places in libtool(1) that was using 32-bit variables to hold - offsets and sizes. Radar bug #10645295. - -Changes for the 5.30 release (the cctools-822 release): -- The "low risk fix to strip(1)" below in cctools-821 for Radar bug #10718585 - breaks striping .o files with dwarf debug info. Because the input file has - an "ld -r" run on it so it is not the original input file. That change has - been backed out. -- The correct fix for strip(1) in dealing with code signed binaries is to - added up the sizes of the output and input parts in the right order. So the - code in strip_object() has been updated to do this. Radar bug #10709632. - -Changes for the 5.30 release (the cctools-821 release): -- Made a low risk fix to strip(1) to fix bugs when stripping objects with - code signature data. The problem is that the code in strip_object() that is - calculating object->input_sym_info_size is incorrect as it is not adding the - elements up in their order and rounding the size for elements that are aligned - like the code signature info. So as a low risk fix code was added in - dyld_order() in checkout.c in libstuff that records the size of the symbolic - information. Then in strip_object() it simply overwrites the previously - incorrectly calculated value for object->input_sym_info_size with that. - Radar bug #10718585. -- Fixed a bug in codesign_allocate(1) that was incorrectly using the value of - sizeof(struct mach_header) for a 64-bit binary when testing if there was - enough room to add the load command. Radar bug #10652697. -- Updated the code in pagestuff(1) to have parts for the dyld info and correctly - handle dylib stubs who's section contents do not appear in the binary. - -Changes for the 5.30 release (the cctools-820 release): -- Removed the use of vers_string(1) from the Makefile. Radar bug #10596469. - - Updated libtool.c to print "Apple Inc." not "Apple Computer, Inc." and the - comment where apple_version[] comes from. - - Added a reference to apple_version[] in checksyms.c, cmpdylib.c, lipo.c, - size.c, strings.c, nm.c, redo_prebinding.c, seg_addr_table.c, check_dylib.c - codesign_allocate.c, ctf_insert.c, seg_hack.c, install_name_tool.c, indr.c, - strip.c and pagestuff.c. - -Changes for the 5.30 release (the cctools-818 release): -- Fixed strip(1) to account for the size of the function starts data when the - binary does not have a dynamic symbol table command. It should have - conditionalized on having a dynamic symbol table command but just the load - command that has the data. Radar bug #10506809. - -Changes for the 5.30 release (the cctools-816 release): -- Changed ctf_insert(1) to allow a static binary with a dynamic symbol table - load command that has local relocation entries. Radar bug #10405248. - -Changes for the 5.30 release (the cctools-815 release): -- Added the os_tools_install target in the Makefile that only builds lipo(1) - and strings(1). Radar bug #10391158. - -Changes for the 5.30 release (the cctools-814 release): -- Changed strip(1) to use "ld -r" on 32-bit objects now that the blocking - bug in ld(1) is fixed. Radar bug #7076828. -- Added support for new load commands LC_MAIN, LC_DATA_IN_CODE, - LC_SOURCE_VERSION and LC_DYLIB_CODE_SIGN_DRS. - - Updated install_name_tool.c, pagestuff.c, redo_prebinding.c, strip.c, - codesign_allocate.c, ctf_insert.c, indr.c and inout.c . - Radar bug #10290817. -- Fixed ctf_insert(1) to correctly handle the LC_FUNCTION_STARTS load command - and update it and move its data. Radar bug #10171548. - -Changes for the 5.30 release (the cctools-811 release): -- Changed the Makefile setting CXX to use c++ not g++. Radar bug #10057952. - -Changes for the 5.30 release (the cctools-809 release): -- Changed lipo(1) to determine the architecture of bitcode files, including - as archive members. Radar bug #9087924. - -Changes for the 5.30 release (the cctools-808 release): -- Fixed a bug in create_library() in the loop that adjusted the ranlib structs - ran_off was using the incorrect index value for: - archs[0].toc_ranlibs[i].ran_off = archs[0].members[i].input_member_offset; - which should have been: - archs[0].toc_ranlibs[i].ran_off = archs[0].members[j].input_member_offset; - Radar bug #9830754. - -Changes for the 5.29 release (the cctools-805 release): -- Changed create_library() in libtool.c to check the new ofile bad_toc field - and cause it to create a new library when this happens. Radar bug #9475790. - -Changes for the 5.29 release (the cctools-803 release): -- Changed libtool.c when running as ranlib(1) to attempt to update the table - of contents in place for the common case for thin archives. And removed the - the time stamp checking for the "nop" ranlib case, which now ends up with just - "touching" the file and adjusting the timestamps. Radar bug #9354605. - - Factored out existing code into new routines get_target_byte_sex() and - put_toc_member(). - - Changed process() and removed the time stamp checking for the "nop" ranlib - case. - - Added the input_member_offset field to the struct member and added code to - set its value in add_member(). - - Changed create_library() to take an ofile which is non-NULL if run as - ranlib(1) and a thin archive. - - Added code in create_library() to update the table of contents in place. - And code to only "touch", write the SARMAG, if the table of contents is - the same. This code has to use the input_member_offset in cases that the - thin input archive would not be same as produced by libtool(1) but still - has member offsets at acceptable alignments. - -Changes for the 5.29 release (the cctools-802 release): -- Fixed a problem with the change to libtool(1) for Radar bug #9354501. It was - not setting toc_uptodate to TRUE and was not doing this only when - cmd_flags.ranlib == TRUE. Radar bug #9418154. - -Changes for the 5.29 release (the cctools-801 release): -- Changed process() in libtool.c to check that the table of contents was up to - date based on the file's time stamp and the table of contents time stamp for - archive files. Then if it ranlib(1) being run do nothing if it is up to date. - Radar bug #9354501. -- Fixed a bug in the error handling of pagestuff(1) when used with the -arch - argument but missing an argument for which page. Radar bug #8979851. - -Changes for the 5.29 release (the cctools-800.3 release): -- Added support for armv7[fsk] to print_arch() in lipo.c . Radar bug #8987684. - -Changes for the 5.28 release (the cctools-798 release): -- Added this line to the Makefile: - CXX = $(shell xcrun -find -sdk $(SDKROOT) g++) - so that it uses the appropriate tool to link device-side code. Radar bug - #8684965. - -Changes for the 5.28 release (the cctools-797 release): -- Added support for LC_DYLD_ENVIRONMENT in segedit.c . Radar bug #8653976. - -Changes for the 5.28 release (the cctools-796 release): -- Added checks in strings(1) to better protect against crashes if it is handed - a malformed file. Radar bug #8599283. -- Added the -arch option to pagestuff(1). Radar bug #8379048. - -Changes for the 5.28 release (the cctools-795 release): -- Changed ctf_insert(1) to allow the LC_FUNCTION_STARTS load command. The - change was in ctf_insert() in ctf_insert.c to remove the test for - object->func_starts_info_cmd != NULL . Radar bug #8490836. - -Changes for the 5.28 release (the cctools-793 release): -- Fixed a problem in nm(1) not checking that a symbol is not undefined before - checking that is a [symbol resolver] symbol. Radar bug #8429570. - -Changes for the 5.28 release (the cctools-792 release): -- Fixed more problems with incorrect support for LC_FUNCTION_STARTS. There were - missing output_func_start_info_data and output_func_start_info_data_size - fields in the struct object that should have been used. Updated the code in - codesign_allocate.c, indr.c, inout.c, install_name_tool.c, redo_prebinding.c - and strip.c which was incorrectly using output_split_info_data and - output_split_info_data_size two use the new fields. Radar bug #8401082. - -Changes for the 5.28 release (the cctools-790 release): -- Fixed problems with the incorrect support for LC_FUNCTION_STARTS. Radar bug - #8274584. - - Updated setup_code_signature() and setup_code_signature() in - codesign_allocate.c . - - Updated ctf_insert() in ctf_insert.c to treat objects with function starts - info as an error and not allowed for static binaries. - - Updated translate_dylib() in indr.c . - - Updated setup_object_symbolic_info() in inout.c . - - Updated setup_object_symbolic_info() and update_load_commands() in - install_name_tool.c . - - Updated build_new_symbol_table() in and update_load_commands() in - redo_prebinding.c . - - Updated strip_object(), strip_LC_UUID_commands() and - strip_LC_CODE_SIGNATURE_commands() in strip.c - -Changes for the 5.28 release (the cctools-787 release): -- Changed libtool(1) and added testing the environment variable ZERO_AR_DATE to - set the ar date to zero to allow testing and comparing things for exact binary - equality. Radar bug #7919021. -- Changed lipo(1) to attempt to stop a crash if the file can't be paged in after - it has been successfully mapped. Added a second fstat(2) call in - process_input_file(1) just before the first bytes of the mapped file are - referenced, and then checked that it has the same size and mod time of the - first stat. Radar bug #8087586. -- Added support in nm(1) for symbols marked with N_SYMBOL_RESOLVER so that they - are printed with [symbol resolver]. This change is in print_mach_symbols() - in nm.c . Radar bug #7901954. - -Changes for the 5.28 release (the cctools-784 release): -- Fixed the -arch_only flag in libtool(1) for arm so that each subtype is - treated as separate architecture. Radar bug #7864127. - -Changes for the 5.28 release (the cctools-782 release): -- Added the -U option to nm(1) to not print undefined symbols. Radar bug - #7761111. -- Changed nm(1)'s -m printing to support 'weak symbol automatically hidden' in - print_mach_symbols() in nm.c. Radar bug #5021217. - -Changes for the 5.28 release (the cctools-781 release): -- Changed codesign_allocate(1) to allow it to be used on any Mach-O file. - Radar bug #7689781. -- Added the program ctf_insert(1) to add a (__CTF,__ctf) section to a statically - linked Mach-O file. Radar bug #7016839. -- Added support for LC_LOAD_UPWARD_DYLIB in update_load_commands() in - install_name_tool.c, in nm() in nm.c and in replace_sections() in segedit.c . - Radar bug #7659206. - -Changes for the 5.28 release (the cctools-780 release): -- Changed trunc() to trnc() in libtool.c and removed -fno-builtin-trunc from the - Makefile. -- Improved the error checking in the redo_prebinding code so that - contents_pointer_for_vmaddr() checks to make sure the pointer is not in the - object's headers or link edit information. Radar bug #6081358. - -Changes for the 5.28 release (the cctools-779 release): -- Fixed bugs in install_name_tool.c in parsing -change and -rpath. Radar bug - #7477104. - -Changes for the 5.28 release (the cctools-777 release): -- Changed round() to rnd() and stuff/round.h to stuff/rnd.h in all files and - removed -fno-builtin-round from the Makefile. Radar bug #7475139. -- Changed the Makefile to use -Os for OFLAG. Radar bug #7475093. -- Change contents_pointer_for_vmaddr() in redo_prebinding.c to ignore segments - with a zero vmaddr since these are unmapped segments. Radar bug #7467115. - -Changes for the 5.28 release (the cctools-776 release): -- Improved the error checking in the redo_prebinding code so that - contents_pointer_for_vmaddr() checks to make sure the pointer is in the - section's contents of the segment. Checks also added to libstuff's - check_Mach_O() in ofile.c to make sure that sections are contained in - their segments. Radar bug #6081358. - -Changes for the 5.27 release (the cctools-773 release): -- Fixed a typo in two lipo(1) error messages where "it's" should have been - "its". Radar bug 7362293. - -Changes for the 5.27 release (the cctools-772 release): -- Fixed a bug in lipo(1) with the -extract option in main() in the loop that - was removing those thin files not marked for extraction where the inner loop - was looping once to many times. Radar bug #7255585. - -Changes for the 5.27 release (the cctools-768 release): -- Fixed a bug in checksyms() that was not verifying read-only-relocs in 64-bit - binaries. The routine check_dynamic_binary() had a typo where LC_SEGMENT - should have been LC_SEGMENT_64. Also changed checksyms() to not call - check_dynamic_binary() if the filetype is MH_KEXT_BUNDLE. Radar bug #7236271. - -Changes for the 5.27 release (the cctools-762 release): -- Changed the Makefile to set CC when when SDKROOT is set. Radar bug #7078805. - -Changes for the 5.27 release (the cctools-760 release): -- Changed the lipo(1) so the the armv7 stuff is a no longer - #ifndef __OPEN_SOURCE__ Radar bug #7016121. - -Changes for the 5.27 release (the cctools-759 release): -- Changed check_dynamic_binary() in checksyms.c to allow read-only relocs in - CPU_TYPE_ARM files in any segment with a section name of "__symbol_stub" or - "__stub_helper" or section type of S_SYMBOL_STUBS. Radar bug #6958263. -- Changed the Makefile to add -isysroot $(SDKROOT) to compile and link lines - when SDKROOT is set. Radar bug #6965029. - -Changes for the 5.27 release (the cctools-757 release): -- Fixed problems with pagestuff.c that caused it to crash when run on 64-bit - Mach-O files. Radar bug #6871695. - -Changes for the 5.27 release (the cctools-756 release): -- Changed libtool.c, redo_prebinding.c and strip.c to prefix the commands they - run with the path to the executable. Radar bug #6821441. - -Changes for the 5.27 release (the cctools-753 release): -- Fixed a warning about 'inew_nextdefsym' defined but not used by adding an - #if defined(TRIE_SUPPORT) && !defined(NMEDIT) around the definition and - #ifdef TRIE_SUPPORT around the use. - -Changes for the 5.27 release (the cctools-752 release): -- Ported to build with clang. - - Changed Makefile to work around bugs 6761248, 6765807 and 6756912. - - Fixed two if() statements at the edit_symtab() in strip.c that incorrectly - had ';' after them. - - Fixed warnings about extra tokens at end of #endif directive in lipo.c - by putting them in a comment. - -Changes for the 5.27 release (the cctools-751 release): -- Fixed a typo in the usage message of install_name_tool(1) where it was using - -rpaths that should have been -rpath. Radar bug #6707169. - -Changes for the 5.26 release (the cctools-750 release): -- Fixed problems with libtool(1) if it is run on an archive with llvm bit code - files. Radar bug #6654890. -- Changed nm(1) to print information from llvm bit code files. Radar bug - #6067110. -- Changed strip(1) to produce an error when attempted to be run on an MH_DSYM - file. Radar bug #6569909. -- Added the -rpath, -add_rpath and -delete_rpath options to install_name_tool(1) - to change, and and delete the paths in LC_RPATH load commands. Radar bug - #5684850. -- Changed install_name_tool(1)'s error message when the program needs to be - relinked to suggest the use of -headerpad or -headerpad_max_install_names . - Rdar bug #6632968. - -Changes for the 5.26 release (the cctools-748 release): -- Fixed a problem in codesign_allocate(1) where it could produce a value for - the filesize field of the LC_SEGMENT_64 for the __LINKEDIT segment that was - too large. The problem was in setup_code_signature() in codesign_allocate.c - where it was using and expression of "X += Y - Z" where X was a 64 bit - unsigned value and Y and Z were 32 bit unsigned values and Z was greater than - Y. This casued the expressing become a large positive number rather than a - small negative number. The fix was to simply change it to two statements, - X += Y and X -= Z; Radar bug #6591303. -- Fixed a problem in segedit(1) that caused it to crash when replacing a section - in a 64-bit Mach-O file. The routne replace_sections() in segedit.c was - incorrectly using mhp->ncmds in two place when it should have been using - mh_ncmds . - -Changes for the 5.26 release (the cctools-743 release): -- Fixed the handling of LC_REEXPORT_DYLIB in redo_prebinding.c so that libraries - with this load command are treated as sub images. The change was in - setup_sub_images() to add a two case lables for LC_REEXPORT_DYLIB and the - code to match up the dylib_name in the dependents list and add them to the - sub_images if not already there. Radar bug #6555215. - -Changes for the 5.26 release (the cctools-738 release): -- Removed the code and files for the old ProjectBuilder interface including the - use of mig(1) in the Makefile. The files make.defs make_defs.h were removed - and the code in libtool.c had the code with these old interfaces removed. - Radar bug #6457206. - -Changes for the 5.26 release (the cctools-735 release): -- Changed strip(1) so it only calls prune_trie() when we are removing global - symbols as is done with default stripping of a dyld executable or with the - -s or -R options. Radar bug #6476423. - -Changes for the 5.26 release (the cctools-734 release): -- Fixed a problem in strip_LC_UUID_commands() routine that was not updating the - object->dyld_info pointer. Radar bug #6478235. - -Changes for the 5.26 release (the cctools-733 release): -- Added support in strip(1) to update the exports in the compressed LINKEDIT - information (trie data structure) when stripping a file that contains the - info. Radar bug #6257854. - -Changes for the 5.26 release (the cctools-725 release): -- Added support for new compressed LINKEDIT information. Radar bug #6232822. - - Changed strip(1), codesign_allocate(1) and install_name_tool(1) to copy - dyld_info in the input to the output. -- Changed check_dynamic_binary() in checksyms.c to allow read-only relocs in - CPU_TYPE_I386 files in any segment with a section name of "__symbol_stub" or - "__stub_helper". - -Changes for the 5.26 release (the cctools-714 release): -- Changed lipo(1) to handle zero sized regular files specially since mmap(2) - will not. Radar bug #6169510. -- Changed libtool(1) to create separate fat archs for all ARM cpusubtypes. The - Changes were in add_member() two places. One for matching the existing - archs[] and one for adding a new archs[]. Radar bug #6155212. - -Changes for the 5.26 release (the cctools-713 release): -- Changed lipo(1) so when the call to mmap() fails in process_input_file() it - now calls system_fatal(). Radar bug #6147708. - -Changes for the 5.26 release (the cctools-712 release): -- Fixed a bug in codesign_allocate(1) if is used on a fat file with - LC_CODE_SIGNATURE load commands and not all fat archs are specified with the - -a options. The bug was in setup_code_signature() where when it did not find - a matching -a option it attempted to adjust the object->input_sym_info_size - which already had been done. Radar bug #6128288. - -Changes for the 5.26 release (the cctools-710 release): -- Fixed lipo(1)'s -i option to know about armv7. Radar bug 4545225. - -Changes for the 5.26 release (the cctools-709 release): -- Added support for CPU_SUBTYPE_ARM_ALL to lipo -info command. Radar bug 6025863 -- Fixed a bug in libtool(1)'s producing a table of contents for LTO. The loop - to size the table of contents was using the same outer loop variable in - make_table_of_contents(). Radar bug #6064634. - -Changes for the 5.26 release (the cctools-708 release): -- Changed libtool(1) to use use the ar long string format for the __.SYMDEF - table of contents member so it will produce archive member offsets after - that that are 8 byte aligned. -- Changed strip(1) to not produce an empty string table (but still include the - pad) for 64-bit objects to work around Radar bug 6048484. - -Changes for the 5.26 release (the cctools-707 release): -- Fixed a bug it the change to strip(1) to always run ld -r on 64-bit - MH_OBJECT files. The second place where it was calling make_ld_r_object() was - missing a test for object->mh_filetype == MH_OBJECT. - -Changes for the 5.26 release (the cctools-706 release): -- Fixed a bug in checksyms(1) that an MH_DYLIB_STUB filetype would incorrectly - get a "malformed dynamic library (no LC_ID_DYLIB command)" error. Radar bug - #6035486. -- Changed strip(1) to always run ld -r on 64-bit MH_OBJECT files and then - always keep all the resulting symbols. This still has problems because - the unified linker does not strip symbols not in its -exported_symbols_list - file. Radar bug #5829662. -- Fixed a bug in codesign_allocate(1) for 64-bit objects it did not correctly - extend the __LINKEDIT segment. Radar bug #6000731. - -Changes for the 5.26 release (the cctools-705 release): -- Removed the old ar.c, file.c, atom.c, check_hints.c, dylib_pcsampler.c, - kern_tool.c and main.c sources and references to them in the Makefile. -- Added the private -l flag to strip(1) to do the "ld -r" even with the known - bugs in the unified linker. -- Ported checksyms(1) and segedit(1) to work with 64-bit binaries. -- Ported all programs to run on 64-bit hosts. Radar bug #6022298. - - Changed the unsigned long type of nremove_symbols and nsave_symbols in - strip.c to a uint32_t . And narchs in strip_file(), ld_r_narchs in - make_ld_r_object. - - Changed the unsigned long type of narchs in main() in indr.c to a uint32_t . - - Changed the unsigned long type of table_size in main() in checksyms.c to a - uint32_t . - - Changed the unsigned long type of temp in main() in libtool.c to a - uint32_t . - - Changed seg_addr_table.c use of unsigned long types to uint32_t types and - its use of long types to int32_t types. And changed %lu format strings to - %u. - -Changes for the 5.26 release (the cctools-704 release): -- Changed redo_prebinding(1) so the zeroing out the UUID and the code signature - data only happens with -u. Radar bug #5984993. - -Changes for the 5.26 release (the cctools-703 release): -- Ported libtool(1) to build as a 64-bit program. Radar bug #5780008. - - Changed two places that used SWAP_LONG to SWAP_INT. - - Changed so the table of contents in now built with a new toc struct and - tocs field in the arch struct. And the toc_ranlibs field is now only used - for writing to the file. - - Changed all uses of unsigned long to uint32_t and updated printf format - characters as needed. - - Also changed to use mmap() instead of map_fd(). - -Changes for the 5.26 release (the cctools-702 release): -- Changed checksyms(1) to allow the local symbol created by strip(1) for the - fix to 5614542. The fix was in checksyms() in checksyms.c to test for the - symbol name "radr://5614542" and not count that as a local symbol or stab. - Radar bug #5938033. - -Changes for the 5.26 release (the cctools-701 release): -- Fixed a bug in install_name_tool(1) that was crashing when trying to print - an error as it did not test for which mach header to use. The fix was in - update_load_commands() to add a test of the 32-bit mach header pointer and if - NULL use the 64-bit mach header pointer. Radar bug 5932327. -- Changed the needs_redo_prebinding() API to use the allow_missing_architecture - parameter so the check only applys to the slice requested isn't prebound. - The change was in process_archs() in redo_prebinding.c to test the - cputype of the file being processed against arch_cant_be_missing and if not - the same just continue. Radar bug #4701556. -- Changed strip(1) to avoid creating a file with an indirect symbol table entry - with an index of zero into the symbol table. This is due to a work around in - the dynamic linker for a bug it is working around that was in the old classic - static linker. The change was in strip_symtab() in strip.c add a local symbol - if there are no local symbols and there are indirect symbols. Radar bug - #5614542. - -Changes for the 5.26 release (the cctools-700 release): -- Removed the #include from redo_prebinding.c. Radar bug #5911680. -- Changed redo_prebinding(1) -u to zero out the UUID and the code signature - data. Radar bug #5631467. -- Rewrote the -arch_blank implementation in lipo(1) so it handles all known - arch flags. Radar bug #5547634. - -Changes for the 5.26 release (the cctools-699 release): -- Backed out the changes for radar bug #3751608 which added code to - redo_prebinding.c which sets a default value for __dyld section contents. - Radar bug #5902653. -- Changed codesign_allocate(1) work with MH_OBJECT file types. Radar bug - #5545465. - - Changed setup_code_signature(): - - Changed the check for the flags having MH_DYLDLINK to also allow a - file type of MH_OBJECT and updated the error message for that check. - - Added a check for MH_OBJECT and in that case used the object file size - for the "link edit end" to be used for the code sign data offset. - - Changed two places where to check for object->seg_linkedit64 != NULL is - now needed because the code can't assume the object has a link edit - segment. - - Also fixed a warning in main() where it needed a cast to (char *) for the - assignment of the value returned by get_arch_name_from_types(). - -Changes for the 5.25 release (the cctools-698 release): -- Added support for LLVM bitcode files to libtool(1). Radar bug #5712460. - It was added undef the ifdef LTO_SUPPORT and can be disabled by setting the - LTO Makefile macro to nothing instead of its default -DLTO_SUPPORT . - - Changed the Makefile and added the LTO macro defined to -DLTO_SUPPORT to - enable LLVM bitcode file support. - - Added support for LLVM bitcode files to libtool.c : - - Added the lto field to the member struct. - - Changed process(): - - To check the ofile->lto field for archives and if not NULL also call - add_member(). - - Added a check for the ofile's file_type being OFILE_LLVM_BITCODE and so - call add_member(). Added error if the program is ranlib(1). - - Changed add_member(): - - to set the size of OFILE_LLVM_BITCODE files. - - added checks when ofile->lto is not NULL and when -arch_only is - specified and the arch does not match to return - - added code when ofile->lto is not NULL and to select the matching - archs[] if any. - - added code when ofile->lto is not NULL to set the archs[].arch_flag of - a newly allocated archs[] - - added code when ofile->lto is not NULL to set the arch->arch_flag of - and existing arch if not set. - - added code when file->file_type is OFILE_LLVM_BITCODE to set the - member fields. - - added code when ofile->lto is not NULL to copy the lto field to the - member struct and set the object_byte_sex field. - - Changed make_table_of_contents(): - - Added code when member->lto != NULL to count the toc symbols from - the lto module then add them to the table of contents. - -Changes for the 5.25 release (the cctools-694 release): -- Fixed a bug in strip(1) where it was crashing when stripping an MH_PRELOAD - filetype because the code is dereferencing a pointer to the dynamic symbol - table in get_starting_syminfo_offset() in strip.c. The fix was to test - object->dyst for not being NULL before using it. Radar bug #5834516. - -Changes for the 5.25 release (the cctools-692 release): -- Updated strip(1) to support binaries that use lazy dylibs. Radar bug #5828589. - -Changes for the 5.25 release (the cctools-688 release): -- Maded changes for the new LC_LAZY_LOAD_DYLIB load command. Radar bug #5760930. - - Added case labels for LC_LAZY_LOAD_DYLIB in update_load_commands() in - install_name_tool.c in two places. - - Added testing for LC_LAZY_LOAD_DYLIB in lc->cmd in two places in nm() in - nm.c . - -Changes for the 5.25 release (the cctools-681 release): -- Removed all __OPEN_SOURCE__ references in Makefile, notes, lipo.c, nm.c, - redo_prebinding.c and strip.c . -- Added the -A option to codesign_allocate(1) to accept numeric architecture - specifications. Radar bug #5681427. -- Changed codesign_allocate to be a member of com.apple.tool.codesign_allocate . - This is done by adding the new Info.plist file into the binary as part of the - (__TEXT,__info_plist) section with a -sectcreate option on the link line - in the Makefile. Radar bug #5681503. - -Changes for the 5.25 release (the cctools-679.1 release): -- Because of the bugs in ld(1), 5675774 and 5658046, the change to strip - dwarf for 5343015 has to be backed out. The change is to simply #ifdef - NOTDEF the test of has_dwarf and the call to make_ld_r_object() in - strip_symtab(). Radar bug #5660086. - -Changes for the 5.25 release (the cctools-679 release): -- Fixed a problem with the change made for Radar bug #5008421 where it would - crash if doing a full strip on a file without a dynamic symbol table. - The new code in strip_object() to account for the input symbolic info - size needed to test that the dynamic symbol table pointer load command was - not NULL. Radar bug #5588769. - -Changes for the 5.25 release (the cctools-677 release): -- Changed the Makefile to not use -Wno-long-double and -no-cpp-precomp . - Radar bug #5563553. - -Changes for the 5.25 release (the cctools-676 release): -- Changed it so ranlib(1) would not overwrite a file that is not writable when - running in UNIX standard conformance mode (the default). The change was to - libtool.c in create_library() to add a check before it calls unlink(2). - Radar bug #4242330. -- Added -fno-builtin-trunc to the Makefile to removed a warning when compiling - libtool.c . -- Fixed a problem in lipo(1)'s -extract_family when used on a fat file with - multiple cpusubtypes. The fix was in an if() statement in create_fat() at the - end where the if() before the seek() needed to also check nthin_files > 1 or - extract_family_flag == FALSE. Radar bug #4695968. -- Fixed the spelling of 'malformed' in redo_prebinding error messages. - Radar bug #5188349. - -Changes for the 5.25 release (the cctools-675 release): -- Fixed strip(1) to correctly do a full symbol strip and set the offsets to the - indirect symbol table and local relocation enties. The changes were to factor - out finding the starting offset of the symbolic info from strip_object() into - a new routine get_starting_syminfo_offset() and fixed the code in - strip_object() for the full symbol strip case to correctly account for the - symbolic info size and set the output offset to the local relocation enties - and indirect symbol table. Radar bug #5008421. -- Changed strip(1) to strip DWARF debugging info from object files. Radar bug - #5343015. - - Added a new routine make_ld_r_object() that is passed the info for the - current object file, writes that to a temporary file, runs "ld -r" plus the - specified stripping option creating a second temporary file, reads that file - in and replaces the object file contents with that and resets the variables - pointing to the symbol, string and indirect tables. The new ld_r_ofile - field in the struct object from "stuff/breakout.h" is set in - make_ld_r_object() so later free_archs() can call ofile_unmap() on it. - - Changed strip_symtab() to see if the current object is an MH_OBJECT filetype - and -S or -x is specified and the object has DWARF debugging sections to - strip and if so calls the new routine make_ld_r_object(). - - Moved the local variables from strip_object for the symbol, string and - indirect tables to file level statics so that the can be reset by the new - routine make_ld_r_object(). And removed them as parameters to - strip_symtab(). - - Changed the call to breakout() in strip_file() to save its ofile struct - pointer return value so ofile_unmap() can later be called to clean up the - space for the mapped object. -- Changed redo_prebinding to not put LC_PREBOUND_DYLIB commands in prebound - images if MACOSX_DEPLOYMENT_TARGET is 10.4 or later. The change was in - update_load_commands() in redo_prebinding.c to test that if it is not - not unprebinding and the target greater than 10.4 it returns before finishing - up and updateing the LC_PREBOUND_DYLIB commands. - -Changes for the 5.25 release (the cctools-673 release): -- Changed the sources so the arm stuff is not in the open source version. - Radar bug #5326431. - - Changed the Makefile to build with -D__OPEN_SOURCE__ with $(OPEN) - - Added #ifndef __OPEN_SOURCE__ to the following files to bracket arm code: - lipo.c, nm.c, redo_prebinding.c and strip.c - -Changes for the 5.25 release (the cctools-667.3 release): -- Changed codesign_allocate(1) to never update the LC_ID_DYLIB timestamp. - The change is in process() in codesign_allocate.c to set the - dont_update_LC_ID_DYLIB_timestamp field in the arch struct to TRUE. - Radar bug #5374218. - -Changes for the 5.25 release (the cctools-667 release): -- Fixed two problems with the change below to strip(1) for Radar bug #5207629. - - The new routine strip_LC_CODE_SIGNATURE_commands() should have tested the - object's mh field to know which of seg_linkedit or seg_linkedit64 to use - to reset the fileoff. - - The object's output_code_sig_data field should not have been set when the - cflags was specified. - -Changes for the 5.25 release (the cctools-666 release): -- Changed strip(1) with the -c option to always remove any LC_CODE_SIGNATURE - load command and signature data from the output. The new routine - strip_LC_CODE_SIGNATURE_commands() was added and it is called just after - accounting for the signature data size in the input file and not accounting - for it in the output file when the -c flag is specified. Radar bug #5207629. - -Changes for the 5.25 release (the cctools-664 release): -- Fixed a problem with the changes below to libtool(1) for Radar bug #5132019. - When used in ranlib(1) on more than one file it would get an internal error - in final_output_flush() on the second file as the last block from the first - file was not cleared from the list. The fix was to set output_blocks to NULL. - Radar bug #5169741. - -Changes for the 5.25 release (the cctools-663 release): -- Changed the code in checksyms.c, seg_addr_table.c and redo_prebinding.c for - the new get_macosx_deployment_target() interface. Radar bug #5132019. -- Changed libtool(1) to make it not make the machine unresponsive when building - large static libraries. Radar bug #5052598. - 1) Added the output_flush() and supporting code from ld_classic(1) and - modified create_library() to use it. - 2) Added a call to fcntl() with the flag F_NOCACHE on the output file. - 3) Added a call to vm_msync() with the flag VM_SYNC_DEACTIVATE on the - input object file's memory after copying to output buffer. - -Changes for the 5.24 release (the cctools-661 release): -- Changed strip(1) to change LC_ID_DYLIB timestamp in unprebound dylibs. - The change was in strip_object() in strip.c . Radar bug #5093170. - -Changes for the 5.24 release (the cctools-656 release): -- Fixed codesign_allocate(l) as it was not updated to deal with 64-bit Mach-O - files that may or may not have padding after the indirect symbol table. This - was the same change that was made to strip in Radar bug #4759112 but that - same change did not make it into codesign_allocate(1). The approach that is - used is to use the input_indirectsym_pad field in the object struct as the - amount to pad in the output file instead of trying to round the offset. - Radar bug #5047066. - -Changes for the 5.24 release (the cctools-655 release) -- Fixed a bug in strip(1) with the -no_uuid option when it is used on a file - that has a LC_SEGMENT_SPLIT_INFO load command. In the routine - strip_LC_UUID_commands() it was not resetting the pointer to the - split_info_cmd. Radar bug #5033393. - -Changes for the 5.24 release (the cctools-654 release) -- Changed libtool(1) to prepend the value of -syslibroot to all absolute paths - of the -L flags if they exist in main() in libtool.c. Radar bug #5029099. - -Changes for the 5.24 release (the cctools-653 release): -- Updated install_name_tool(1), nm(1), redo_prebinding(1) and segedit(1) to - handle the LC_REEXPORT_DYLIB load command. Radar bug #4986624. - -Changes for the 5.24 release (the cctools-648 release): -- Changed the check in lipo(1) for the nfat_arch being too large so the check - does not overflow and later cause a crash. Radar bug #4860769. - -Changes for the 5.24 release (the cctools-647 release): -- Changed codesign_allocate.c to use CPU_SUBTYPE_MASK to mask out the capability - bits from the cpusubtype on comparisons. Radar bug #4849153. - -Changes for the 5.24 release (the cctools-644 release): -- Fixed problems with the error handling code of the libredo_prebinding API. - The local varaibles used in the error handling needed to be declared volatile - so that there were not trashed by the longjmp(). The ofile variable was - getting set to NULL so the call to ofile_unmap() was not getting done and - leaking memory (which in turn caused the file descriptor to not actually get - closed leaking a file descriptor as well). Radar bug #4800981. -- Changed lipo(1) adding code for the CPU_SUBTYPE_VEO_3 and CPU_SUBTYPE_VEO_4 - cpusubtypes. Radar bug #4799550. - -Changes for the 5.24 release (the cctools-643 release): -- Changed strip(1) so strip -X on an x86_64 .o file should do nothing. - The change was in strip_symtab() for local symbols to check if the file is - CPU_TYPE_X86_64 and the -X flag is used and if so keep all the local symbols. - Radar bug #4800628. -- Ported cmpdylib(1) to work with 64-bit Mach-O dylibs including ones without - a table of contents. Radar bug #4040804. - -Changes for the 5.24 release (the cctools-642 release): -- Changed needs_redo_prebinding() in redo_prebinding.c to return NOT_PREBOUND - instead of PREBINDING_UPTODATE when the Mach-O file only contains 64-bit - Mach-O files. A new boolean variable, seen_a_non_64_bit, was added and - initialized to FALSE. Then in process_arch() if a 32-bit Mach-O is seen it - set to true. Then in needs_redo_prebinding() if PREBINDING_UPTODATE would - have been returned and seen_a_non_64_bit is FALSE, NOT_PREBOUND is returned - instead. Radar bug #4788385. -- Fixed a problem with unprebind(3) in libredo_prebinding.a where it was calling - update_external_relocs() even when the binary was marked with MH_CANONICAL. - Radar bug #4786099. - -Changes for the 5.24 release (the cctools-640 release): -- Changed lipo.c, strip.c, libtool.c, and indr.c to use CPU_SUBTYPE_MASK to - mask out the capability bits from the cpusubtype on comparisons. Radar bug - #4754462. - -Changes for the 5.24 release (the cctools-639 release): -- Changed how strip(1) deals with 64-bit Mach-O files that may or may not have - padding after the indirect symbol table. The approach now is to use the - input_indirectsym_pad field in the object struct as the amount to pad in the - output file instead of trying to round the offset. Radar bug #4759112. - -Changes for the 5.24 release (the cctools-637 release): -- Changed strip(1), inout(1), and codesign_allocate(1) to deal with the 64-bit - Mach-O files that may or may not have padding after the indirect symbol table. - The change was to use the new input_indirectsym_pad field instead of always - rounding the size of the input indirect symbol table to 8 bytes. And then - adjust the output_sym_info_size and everything else to deal with padding the - indirect symbol table on output if needed. Radar bug #4747408. - -Changes for the 5.24 release (the cctools-637 release): -- Changed strip(1), inout(1), codesign_allocate(1), and redo_prebinding(3) to - deal with 64-bit Mach-O files with an odd number of indirect symbol table - entries. The code was changed to round the size or offset as needed in a - number of places. Radar bug #4737991. -- Fixed a bug in strip(1) when creating a shared library stub and not saving - all the symbols used by the indirect symbol table entries. In - check_indirect_symtab() in symbols.c it was trying to update the non-lazy - symbol pointers to the value of the symbol causing a memory smasher. This - happened because the offset to the section was set to 0 since its contents - are to be stripped. This casused the pointer to the contents to point to the - beginning of the object file. The fix is to not update the contents if we - are creating a shared library stub since it is to be stripped. Radar bug - #4742051. -- Changed strip(1) to deal with N_SECT symbols with the N_WEAK_DEF the same for - both 32-bit and 64-bit Mach-O files. The change was to remove a test of - object->mh64 != NULL in strip_symtab() in strip.c. Radar bug #4732639. -- Fixed libtool(1) to check n_sect values of N_SECT symbols and issue an error - if they are NO_SECT or out of range. Radar bug #4739572. -- Added the printing of the alignment of common symbols to nm(1) when the -m - option is used. Radar bug #4597166. - -Changes for the 5.24 release (the cctools-635 release): -- Added the -verify_arch ... option to lipo(1). Radar bug #4496521. -- Changed strings(1) so that if it is used with a filename with parenthesis in - the name it first checks to see if there's a filename that's an exact match. - And if so it uses that, otherwise falls back to the member syntax. The change - was in main() in strings.c to stat(2) argv[i] and set a new boolean - use_member_syntax when calling ofile_process(). Radar bug #4172811. - -Changes for the 5.24 release (the cctools-634 release): -- Updated programs to handle the LC_SEGMENT_SPLIT_INFO command and its block of - data. Radar bug #4695477. - - Updated pagestuff(1) to include a new Mach-O part, MP_SPLIT_INFO, and the - code and do the needed printing. Also updated it to deal with code - signature data. - - Updated the inout.c to work with objects with split info data. Also fixed - it to work with code signature data and fixed a cast for the indirect - symbol table now needing to be a uint32_t *. - - Updated codesign_allocate(1) to work with objects with split info data. - - Changed strip_object() in strip.c to set the output_split_info_data and - output_split_info_data_size fields and account for the size of the split - info data in the object's input_sym_info_size and output_sym_info_size - fields. Also set the data offset of the split info command for output. - - Changed build_new_symbol_table() in redo_prebinding.c to account for the - size of the split info data in its local variable sym_info_size and - set output_split_info_data and output_split_info_data_size fields. And - changed update_load_commands() in redo_prebinding.c to update the pointer - to the split info load command. - - Changed translate_dylib() in indr.c to account for the size of the split - info data, and to reset the offset to it at the end of the routine. Also - changed the code to use the mh_cputype, mh_cpusubtype and mh_filetype - fields of the object struct. - - Changed setup_object_symbolic_info() in install_name_tool.c to account for - the size of the split info data. And changed update_load_commands() in - install_name_tool.c to update the pointer to the split info load command. - Also fixed update_load_commands() and added the missing break statements. - - Fixed inout.c, strip.c, redo_prebinding.c, indr.c and install_name_tool.c - to set the output_code_sig_data and output_code_sig_data_size fields. - -Changes for the 5.24 release (the cctools-633 release): -- Ported the code for libredo_prebinding.a in redo_prebinding.c to be compiled - for 64-bit hosts. Note that the code only has been changed to work on 64-bit - hosts and the operation on 64-bit binaries is unchanged (which is they are - left untouched). Radar bug #4407440. - - Changed the macro U_ABS to use int32_t and uint32_t types. - - Changed get_arch_long() and set_arch_long() to use int32_t and uint32_t - types and SWAP_INT(). - - Changed the types of the static variables new_dylib_address and - old_dylib_address to uint32_t. - - Changed strip.c, indr.c and codesign_allocate.c to deal with the change of - type for indirect symbols to uint32_t * when ported to 64-bit. -- Fixed a typo in seg_addr_table.c . Radar bug #4677855. - -Changes for the 5.24 release (the cctools-631 release): -- Changed libtool(1) to only execute ld(1) and execute ld64(1) based on the - -arch flag. The change was to create_dynamic_shared_library() in libtool.c - Radar bug #4682470. - -Changes for the 5.24 release (the cctools-629 release): -- Fixed a bug in the codesign_allocate(1) tool that was not updating the vmsize - of the __LINKEDIT segment. The fix was in setup_code_signature() in - codesign_allocate.c . Radar bug #4666308. -- Changed strip(1) so strip -R on an x86_64 .o file should do nothing. - The change was in strip_symtab() after checking the Rflag to check if the - file is CPU_TYPE_X86_64 and if so don't remove the symbols in the - remove_symbols list. Then at the end of the routine the check to missing - symbols in the remove_symbols is not done if the file is CPU_TYPE_X86_64. - Radar bug #4568747. - -Changes for the 5.24 release (the cctools-628 release): -- Changed strip_object() in strip.c to not do anything to stub dylibs which have - no load commands. Radar bug #4511628. - -Changes for the 5.24 release (the cctools-626 release): -- Made changes to support code signature data in Mach-O files. Radar bug - #4588023. - - Updated the inout.c example tool to work with 64-bit object files and - objects with code signature data. - - Created the codesign_allocate(1) tool and updated the Makefile to build and - install it. - - Changed strip_object() in strip.c to set account for the size of the code - signature data in the object's input_sym_info_size and output_sym_info_size - fields. And update the data offset of the code signature data. And at the - end of the routine a warning is printed if the object has a code signature - saying the operation will invalidate it. - - Changed build_new_symbol_table() in redo_prebinding.c to account for the - size of the code signature data in its local variable sym_info_size. And - changed update_load_commands() in redo_prebinding.c to update the pointer - to the code signature load command. - - Changed translate_dylib() in indr.c to account for the size of the code - signature data, and to reset the offset to it at the end of the routine. - - Changed setup_object_symbolic_info() in install_name_tool.c to account for - the size of the code signature data. And changed update_load_commands() in - install_name_tool.c to update the pointer to the code signature load - command. - -Changes for the 5.23 release (the cctools-618 release) -- Changed checksyms(1) to not check for prebound files when - MACOSX_DEPLOYMENT_TARGET >= 10.4 . The change was in check_dynamic_binary() - in checksym.c to test the value returned by get_macosx_deployment_target(). - Radar bug #4110782. - -Changes for the 5.23 release (the cctools-617 release) -- Changed create_fat() in lipo(1) to not set the timestamp of the output file - if it contains archives. Radar bug #4492604. - -Changes for the 5.23 release (the cctools-616 release) -- Changed lipo(1) to special case ppc, ppc64, i386 and x86_64 architectures and - to assume a segment alignment of 12. Changes were made in get_align() and - get_align_64() in lipo.c . Radar bug #4178258. -- Ported pagestuff(1) to work with 64-bit Mach-O's. Radar bug #4375624. -- Added the needed code in for nmedit(1) in strip.c in check_object_relocs() to - handle making global coalesced symbol in 64-bit Mach-O's private. Basically - it is the same as the 32-bit case but with quad sized relocation entries and - 64-bit values. Radar bug #4414533. - -Changes for the 5.23 release (the cctools-612 release) -- Changed strip(1) so strip -x on an x86_64 .o file should do nothing. - The change was in strip_symtab() for local symbols to check if the file is - CPU_TYPE_X86_64 and the -x flag is used and if so keep all the local symbols. - Radar bug #4541291. - -Changes for the 5.23 release taken from cctools-590.23.6 (the cctools-610 -release): -- Fixed a bug in the redo_prebinding code where it would call chmod(2) and - chown(2) unnecessarily when no output_file is specified. The fix was in - unprebind() in redo_prebinding.c to remove the else clause of the - if(output_file != NULL && outbuf == NULL) so the chmod() and chown() are not - called on the file_name parameter. Radar bug #4503724. -- Fixed a leak in the redo_prebinding code where error_message_buffer is not - freed when system_error() is called. The fix is in unprebind() in - redo_prebinding.c after the first call to cleanup(). It checks to see if - error_message_buffer is not NULL and if so calls free() on it. Radar Bug - #4503576. - -Changes for the 5.22 release (the cctools-590.41.4 release): -- Change the previous fix to not reference the reserved1 field when fixing up - indirect symbols in the non-lazy symbol pointer section. Radar bug #4522347. - -Changes for the 5.22 release (the cctools-590.41.3 release): -- Fixed nmedit(1) so that it sets the value of symbol pointers when it changes - the indirect symbol table entries for them into INDIRECT_SYMBOL_LOCAL. The - change was in check_indirect_symtab() in symbols.c and a bit of code was added - to take the n_value from the symbol table entry swap it if needed and write - into the section contents for that symbol pointer. The additional parameters - contents and host_byte_sex were added to the routine and pass from the two - places it was called. Radar bug #4514531. - -Changes for the 5.22 release (the cctools-590.41.2 release): -- When stripping coalesced symbols from 64-bit files, only save symbols which - are used as weak definitions. Radar bug #4487972. - -Changes for the 5.22 release (the cctools-590.40.1 release): -- Ignore multiple -syslibroot flags if they specify the same argument. Radar - bug #4354876. - -Changes for the 5.22 release (the cctools-590.38.3 release): -- Fix a typo for 64-bit code in an error case in strip(1) which would cause it - to crash. Radar bug #4502835. -- Add a new -arch_blank option to lipo(1). Radar bug #4473483. - -Changes for the 5.22 release (the cctools-590.38.2 release): -- Don't convert external relocation entries to internal ones when looking at - x86-64 relocation entries in nmedit(1). Radar bug #4497429. - -Changes for the 5.22 release (the cctools-590.34.1 release): -- Revert the 4-byte alignment change in lipo from the previous release. Radar - bug #4428605. - -Changes for the 5.22 release (the cctools-590.31.4 release): -- Modified lipo to only require 4-byte alignment for load commands. Radar bug - #4428605. -- Added x86_64 support to the relocation entry functions in misc/reloc.c, used - by strip and other tools. Radar bug #4430570. -- Fix a typo in mach-o/reloc.h. Radar bug #3754196. - -Changes for the 5.21 release (the cctools-590.40 release): -- Fixed a bug in pagestuff(1) where it would crash if it was processing a Mach-O - file with no LC_SYMTAB command. It crashed in print_symbols() because it - lacked a check for fp->st not being NULL. The fix was to add a check for - fp->st being NULL and just returning in that case. Radar bug #4495141. - -Changes for the 5.21 release (the cctools-590.37 release): -- Changed check_indirect_symtab() in strip.c so that nmedit(1) and strip(1) - would allow an indirect symbol table entry to just have INDIRECT_SYMBOL_ABS - as well as (INDIRECT_SYMBOL_LOCAL | INDIRECT_SYMBOL_ABS). This is because - ld(1) puts this out in some cases. Radar bug #4461173. -- Added passing ld(1)'s -t flag through libtool(1). Radar bug #4213190. - -Changes for the 5.21 release (the cctools-590.35 release): -- Added a warning to nmedit(1) when it sees a global coalesced symbol to say it - can't make global coalesced symbols into a static symbols and suggest the use - of ld(1)'s -exported_symbols_list option for a final linked images. The - change was in strip.c in edit_symtab() to add the warning an a boolean to - only print it once. Radar bug #4269492. -- Changed seg_hack so it doesn't affect debug sections. Radar bug #4421656. - -Changes for the 5.21 release (the cctools-590.34 release): -- Make 'nm: no name list' a warning, not an error. Radar bug #4421611. - -Changes for the 5.21 release (the cctools-590.32 release): -- Change edit_symtab in strip.c to handle the different format - of the DWARF debug map. Add new functions cmp_bsearch_global and - cmp_bsearch_global_64. Radar bug #4421583. - -Changes for the 5.21 release (the cctools-590.31 release): -- Added the -no_uuid flag to strip(1) to remove LC_UUID load commands. Radar - bug #4415536. -- Added the -no_uuid flag to libtool(1) to pass on to ld(1). Radar bug - #4415529. - -Changes for the 5.20 release (the cctools-590.20 release): -- Removed the warnings when building. Radar bug #4340147. - - Added -fno-builtin-round to the Makefile. - - Changed the local variable p to a char * in print_symbols() in nm.c . - - Changed the cast of argument 3 of the call to bootstrap_look_up() to - (unsigned int *) in tellProjectBuilder() in libtool.c . -- Fixed a bug in redo_prebinding in the support for new i386 self (dyld) - modifiying code stubs. The problem was with calculation for the new - displacement of the jmp instruction for non-prebound undefined symbols not - taking in to account that the symbol is also being slid. The fix was in - update_self_modifying_stubs() in redo_prebinding.c code. Radar bug #4335281. - -Changes for the 5.19 release (the cctools-590.18 release): -- Fixed a bug in nmedit(1) when it tried to change a global coalesced symbol - into a static and did not get the r_symbolnum for relocation entries set - correctly. The fix is in check_object_relocs() in strip.c where an extra - check was needed of relocs[k].r_extern == 1 before updating the r_symbolnum - field with the new symbol index. Radar bug #4318688. - -Changes for the 5.19 release (the cctools-590.17 release): -- Fixed a bug in strip(1) if there is more than one non-lazy pointer section - with the same indirect symbol that is being stripped. The fix was in - check_indirect_symtab() in strip.c that needed to have a new made_local - boolean and not always set saves[index] = -1 because that would cause the - sections after the first one with this symbol not to be updated. Radar bug - #4316021. - -Changes for the 5.19 release (the cctools-590.10 release): -- Added support for new i386 self (dyld) modifiying code stubs in the - redo_prebinding.c code. Radar bug #4202415. - - Added the new routine update_self_modifying_stubs() to set the JMP - instruction values. - - Changed process_arch() to call the new update_self_modifying_stubs(). - - Added the new routine reset_self_modifying_stubs() to set the self modifying - stubs section back to halt instructions. - - Changed unprebind_arch() to call the new reset_self_modifying_stubs(). - -Changes for the 5.19 release (the cctools-590.7 release): -- Changed libtool(1) to pass the new -macosx_version_min flag to ld. Radar - bug #4195253 - -Changes for the 5.18 release (the cctools-590.5 release): -- Added the N_OSO stab entry to stabnames[] array in nm.c to print the new - stab. Radar bug #4202462. -- Added passing the -Sp flag from libtool(1) to ld(1). Radar bug #4202462. - -Changes for the 5.18 release (and SUTiCambridge) (the cctools-590 release): -- Added a call to update_dyld_section() in unprebind_arch() in - redo_prebinding.c to set the (__DATA,__dyld) section contents to a - canonical value. Radar bug #4126660. -- In reset_symbol_pointers() in redo_prebinding.c added a conditional resetting - symbol pointers defined in the image. The conditional is if either the - MH_WEAK_DEFINES or MH_BINDS_TO_WEAK flags are present then the symbol pointer - is set back to zero or to the value for lazy binding and assumed that if - the symbol is defined it is being used from the image. This is because the - Tiger dyld when prebinding may set the symbol pointer to an address in another - image even if the symbol is defined in the image being prebound. Radar bug - #4126666. - -Changes for the 5.18 release (and SUTiAtlanta) (the cctools-588 release): -- Added more code in build_new_symbol_table() in redo_prebinding.c for fix up - the FCS Tiger dyld prebinding problem with stabs that are in the AppKit well - enough to allow the Software Update patching that uses the undo prebinding - operation to work. Radar bug #4113681. - - If the module table gets updated when unprebinding with the change below and - that adjustment is not the same as the vmslide then the N_STSYM and N_SO - stabs are corrected. - -Changes for the 5.18 release (and in SUTiAtlanta) (the cctools-587 release): -- Added code build_new_symbol_table() in redo_prebinding.c to fix up the FCS - Tiger dyld prebinding problems well enough to allow the Software Update - patching that uses the undo prebinding operation to work. Radar bug #4108651. - - When updating the module table when unprebinding code was added to calculate - the value to adjust the objc_module_info_addr entries from the difference - between the the address of the (__OBJC,__module_info) section and the module - table entry with the lowest objc_module_info_addr value. - - Code was added at the end of the routine to set the n_value of absolute - global symbols that start with ".objc" or end with ".eh" to zero. -- Changed process_archs() in redo_prebinding.c to set - arch->dont_update_LC_ID_DYLIB_timestamp to TRUE for 64-bit archs so their - time stamps don't get changed. Radar bug #4105452. - -Changes for the 5.18 release (the cctools-583 release): -- Changed the Makefile so that when RC_XBS is set to YES then the compiler - options -MD and -dependency-file as well as the md(1) program are not used. - Radar bug #4029936. - -Changes for the 5.18 release (the cctools-580 release): -- Changed it so that the default for MACOSX_DEPLOYMENT_TARGET is 10.4 for i386. - Radar bug #4081062. - - Changed the call to get_macosx_deployment_target() in unprebind_arch() in - redo_prebinding.c to pass the additional cputype parameter from the arch's - cputype. - - Changed the call to get_macosx_deployment_target() in main() in - seg_addr_table.c to pass the additional cputype parameter as CPU_TYPE_ANY. - -Changes for the 5.17 release (the cctools-577 release): -- Fixed a bug in the libredo_prebinding code that caused it to report an error - when there was a relocation entry at the very end of a segment. The problem - was in contents_pointer_for_vmaddr() in redo_prebinding.c where it was using - < when it should have been using <= in checking to see which segment a vmaddr - is in. Radar bug #4054854. - -Changes for the 5.17 release (the cctools-572 release): -- Changed nm(1) when the -P option is used to print a 0 for the size. Radar - bug #3652346. - -Changes for the 5.17 release (the cctools-566 release): -- Ported strings(1) to work with 64-bit object files. Radar bug #3943477. -- Fixed another problem with nmedit(1) and fat files with 64-bit Mach-O dylibs - that have no modules. The variable new_nextrefsyms was not being reset for - the next arch being processed if it had no modules. This is now done in - edit_symtab() just after new_ntoc is reset. Radar bug #3949527. - -Changes for the 5.17 release (the cctools-565 release): -- Fixed a problem with nmedit(1) with -p option and 64-bit Mach-O object files - that caused it to crash. The problem was in edit_symtab() in strip.c where - it was incorrectly using the variable changed_globals not changed_globals64. - Radar bug #3945219. - -Changes for the 5.17 release (the cctools-564 release): -- Fixed a problem with nmedit(1) and fat files with 64-bit Mach-O dylibs that - have no modules. The variable new_ntocs was not being reset for the next arch - being processed if it had no modules. This is now done in edit_symtab() just - after new_nmodtab is reset. Radar bug #3940965. - -Changes for the 5.17 release (the cctools-563 release): -- Changed the code in redo_prebinding.c which sets a default values for the - first two pointers in the (__DATA,__dyld) section, the routine - update_dyld_section() was changed to use constant values. Also a missing - error check was added and calls to set_arch_long() to correctly deal with - cross bytesex and alignment issues. Radar bug #3828403. - -Changes for the 5.17 release (the cctools-562 release): -- Ported the install_name_tool(1) to work with 64-bit Mach-O files. Radar bug - #3930775. - -Changes for the 5.17 release (the cctools-561 release): -- Fixed a problem with the code for nmedit(1) that could not deal with a dylib - without a module table. The fix was in edit_symtab() in strip.c to test for - the number of modules being zero as well as it being a dylib. Radar bug - #3926028. - -Changes for the 5.17 release (the cctools-560 release): -- Changed strip(1) to call realpath(3) on arguments to allow it to work with - symlinks. Radar bug #3889109. - -Changes for the 5.17 release (the cctools-559 release): -- Changed the printing in nm(1) with the -A option to add a space after the ':' - is printed for the file name. Radar bug #3652346. -- Fixed a problem with strip(1) -c which was not correctingly setting the - filetype to MH_DYLIB_STUB. This was caused by the changes to the 64-bit - port and the fix was in strip_object() to set object->mh->filetype or - object->mh64->filetype as well as object->mh_filetype. Radar bug #3909472. -- Fixed a problem with the change for Radar bug #3766901 that was causing extra - newlines in strings(1) output to be printed. The fix was in ofile_find() in - strings.c by only printing the +1 size of the string when it was at the end - of the buffer and the last character was not a '\n' . Radar bug #3907726. - -Changes for the 5.17 release (the cctools-558 release): -- Changed seg_addr_table(1) avoid outputing libraries when they are built - nonsplit but are listed as split in the table. This situation happens when - B&I moves libraries to the split region from the nonsplit region, but then - they fail to build. Radar bug #3903547. - -Changes for the 5.17 release (the cctools-557 release): -- Removed support for the INTERIM_PPC64. The changes were to remove the - #ifdef INTERIM_PPC64 source changes in lipo.c and strip.c . Radar bug - #3600419. -- Ported the size(1) command to work with 64-bit Mach-O files. Radar bug - #3900014. - -Changes for the 5.17 release (the cctools-556 release): -- For ranlib(1) with the -q option, used by ar(1) for UNIX standard conformance, - a warning about an "empty library: XXX (no table of contents added)" must not - be printed. Again the change was in create_library() in libtool.c . Radar - bug #3893339. -- For ranlib(1) with the -q option, used by ar(1) for UNIX standard conformance, - changed it not to change the file if there are no table of contents entries. - The change was in create_library() in libtool.c . Radar bug #3893392. -- Added the -syslibroot option as another way to specifiy NEXT_ROOT - in libtool(1). Radar bug #3886145. - -Changes for the 5.17 release (the cctools-554 release): -- Fixed a bug with the strings(1) -a option printing the last string at the end - of a section. The fix was in ofile_find() in strings.c by adding "+1" to the - argument of printf()'s string size format. Radar bug #3766901. -- Changed strip(1) to handled filenames with paths lengths near PATH_MAX. - Radar bug #3878381. -- Made more changes to nm(1) for UNIX standard conformance. Radar bug #3878451. - - Added "--" to be the same as "-" and treat all remaining arguments as - file names. Change in main() in nm.c. - - Changed nm(1) to print the file name before the output with -A just like - the -o option. - - Changed nm(1) with the -P option to use hex as the default. Change in - main() to the initialization of cmd_flags.format . -- For ranlib(1) with the -q option, used by ar(1) for UNIX standard conformance, - changed it to not print the warning about creating a library with no symbols - in the table of contents. The change was in create_library() in libtool.c . - Radar bug #3878332. - -Changes for the 5.17 release (the cctools-553 release): -- Fixed a bug in nmedit(1) for 64-bit Mach-O files that was causing it to - incorrectly produce an error about bad n_sect values. The fix was in - edit_symtab() in strip.c where LC_SEGMENT was used when LC_SEGMENT_64 should - have been used. Radar bug #3880780. -- Changed seg_addr_table(1) for enhancements for 10.4 prebinding. Radar bug - #3871826 - - Only round addresses to the nearest page. - - Only output split addresses. - - Refrain from outputting the next debug and the next flat address to assign. - - Allow addresses to be in the full 256 mb range (0x90000000 - 0x0x9fffffff). -- Changed redo_prebinding.c to ignore 64-bit Mach-O files and leave them - unchanged. Radar bug #3877703. - -Changes for the 5.17 release (the cctools-552 release): -- Added the 'q' option to ranlib(1) to do nothing if a fat file would be - created as the output file. This is used by ar(1) for UNIX standard - conformance. Radar bug #3762136. -- Added the 'f' option to the usage line for nm(1). Radar bug #3856321. -- Added the UNIX standard conformance flags -P, -A and -t to nm(1). Radar - bug #3652346. -- Added the -n number and -t format options to strings(1). Radar bug #3644256. -- Added the "--" option to strings(1) to treat all argument after this as file - names. Radar bug #3571788. -- Changed strip(1) to not write over a non-writeable file when in UNIX standard - conformance mode and produce an error instead. The change was in strip_file() - in strip.c to call the new libstuff routine get_unix_standard_mode() and if - TRUE call access(2) for W_OK to see if we can write on the file. Radar bug - #3852702. - -Changes for the 5.17 release (the cctools-551 release): -- Fixed a bug in the -u option for redo_prebinding(1) that cause it to not set - the MH_ALLMODSBOUND flag. The fix was in unprebind_arch() after the call to - update_load_commands() to re-read the value of the mach header flags it had - in the local variable mh_flags. Radar bug #3851599. -- Fixed a bug in print_mach_symbols() in nm.c that was causing a crash when the - -m option was used because it was using ofile->mh64 when ofile->mh was not - NULL. - -Changes for the 5.17 release (the cctools-550 release): -- Changed nm.c to handle both 64-bit and 32-bit binaries. Changed the Makefile - back to the cctools-528 Makefile since there are no longer any *64(1) tools - built in this directory. Radar bug #3859090. -- Changed seg_addr_table(1) to ignore 64-bit files. The changes were in - sizes_and_addresses() and get_seg1addr() in seg_addr_table.c to simply return - if ofile->mh is NULL. Radar bug #3861276. -- Changed the constant CPU_IS64BIT in libtool.c to CPU_ARCH_ABI64. - Radar bug #3806447. -- Fixed a warning in build_new_symbol_table() in redo_prebinding.c that the - variables new_symbols64 and new_symbols may be used uninitialized. - -Changes for the 5.17 release (the cctools-548 release): -- Fixed a bug in strip(1) in strip_object() for 64-bit Mach-O binaries that - caused it to not correctly update the indirect symbol table entries. There - was an incorrect cast in setting up the pointer to the section_64 struct where - it was using "struct segment_command" where it should have been - "struct segment_command_64". Also there was an incorrect check of - object->seg_linkedit that should have been object->seg_linkedit64. - Radar bug #3848104. - -Changes for the 5.17 release (the cctools-547 release): -- Changed the code in redo_prebinding.c to not crash when presented with a - 64-bit Mach-O binary. The APIs except redo_prebinding(3) should now handle - binaries with 64-bit Mach-O binaries. There is not yet support for actually - redoing the prebinding on a 64-bit Mach-O binary. Radar bug #3851599. - -Changes for the 5.17 release (the cctools-545 release): -- Fixed a bug in strip_object() in strip.c for 64-bit Mach-O files that - incorrectly had the size on the indirect symbol table entries as 8 byte - sizeof(long long) in two places. This is an index into the symbol table and - is 4 bytes in both 64-bit Mach-O files and 32-bit Mach-O files. - Radar bug #3836060. - -Changes for the 5.17 release (the cctools-542 release): -- Fixed 64-bit math bug in strip when computing the size of the __LINKEDIT - segment. Radar bug #3831401. - -Changes for the 5.17 release (the cctools-541 release): -- Fixed a bug in strip_symtab() in strip.c that was not correctly copying the - undefined symbols out for both 32-bit and 64-bit Mach-O files. Radar bug - #3829545. - -Changes for the 5.17 release (the cctools-540 release): -- Fixed a bug in strip_symtab() in strip.c that was using the value of a - symbol's n_sect value before checking that it was in the valid range. - Radar bug #3829149. - -Changes for the 5.17 release (the cctools-539 release): -- Changed strip(1) to support 32-bit & 64-bit binaries. Radar bug #3812858. - - Changed the code in strip.c to to test the mach header field, mh for - NULL, to see which type of object it has and then added/modified the code - to deal with both. - -Changes for the 5.17 release (the cctools-537 release): -- Changed the redo_prebinding(3) API to return REDO_PREBINDING_SUCCESS any time - a new file is created. Radar bug #3818477. -- Fixed a problem with libtool/ranlib that was causing it to increase the size - of archive member's long names each time it was run. The fix was in - add_member() to first trim the long name size to not include any trailing '\0' - before rounding the size up. Radar bug #3817546. - -Changes for the 5.17 release (the cctools-534 release): -- Changed libtool to call ld64 for CPU_IS64BIT architectures. Radar - bug #3807911 -- Fixed lipo(1)'s -info and -detailed_info options to handle 64-bit Mach-O - files. Radar bug #3793539. -- Changed libtool.c to force using long archive names and pad them with the - rounding needed to get members on 8 byte offsets. This is needed because the - struct ar_hdr is not a multiple of 8 bytes. Radar bug #3808740. - -Changes for the 5.17 release (the cctools-533 release): -- Changes to support 32-bit & 64-bit tools in the same binary. Radar bug - #3793394. - - Changed the Makefile to only build libtool and no longer build libtool64 . - - In libtool.c, changed the struct member, to have both 32-bit and 64-bit - mach header pointers and array section pointers. And changed all the code - to test the mach header field, mh for NULL, to see which type of object - it has and then added/modified the code to deal with both. Also changed - all rounding to 8 from 4 so members end up on a 8-byte boundary. - - Changed the code in nm.c to use the swap_nlist_t and the swap_dylib_module_t - new macros from "stuff/target_arch.h". And added one ifdef ARCH64 to use - the ofile->dylib_module64 . Also added an - - In process() and in print_mach_symbols() in nm.c added a new ofile_mh local - variable and added a new ifdef ARCH64 to set it to ofile->mh64 or ofile->mh. - And changed places where it used ofile->mh to ofile_mh. -- Changed strip.c and segedit.c to initialize the variable progname and declare - it to be a __private_extern__ to avoid having a common private extern be - created when built with gcc-3.5. -- Changed the used of NXZone* APIs to malloc_zone* APIs in redo_prebinding.c. - Radar bug #3461591. - -Changes for the 5.17 release (the cctools-532 release): -- Fixed some problems with the Makefile and building libredo_prebinding.a when - the support for 64-bit tools was first added. - -Changes for the 5.17 release (the cctools-531 release): -- Made more changes to support 64-bit tools. Radar bug #3600431. - - Changed the Makefile to build a libtool64 command and create a link to - it for ranlib64. - - Changed the libtool.c sources to build a libtool64 by changeing the uses - of structs and constants that are different for 64-bit files to the - typedefs in "stuff/target_arch.h". -- Made some changes to the changes in redo_prebinding.c in cctools-530 so that - it does not compile with warnings. And changed some of the comments to me - more accurate. - -Changes for the 5.17 release (the cctools-530 release): -- Added code to redo_prebinding.c which sets a default value for - __dyld section contents. Radar bug #3751608. - -Changes for the 5.17 release (the cctools-529 release): -- Made changes to support 64-bit tools. Radar bug #3600431. - - Changed the Makefile to build the tools using a sub-directory for the - objects and building both 32-bit and 64-bit tools. Things are no longer - built with -DINTERIM_PPC64 and the 64-bit tools are built with -DARCH64 and - linked with libstuff64 . - - Made changes to build an nm64 by changing the uses of structs, constants - and names that are different for 64-bit files to the typedefs in - "stuff/target_arch.h". - - In some places that used nlist symbols this was changed to the new type - in "stuff/symbol.h" to struct symbol. Which contains a name, an indr_name - and an nlist_t. - -Changes for the 5.17 release (the cctools-528.6 release): -- Change the code in nmedit that checks for relocation entries of - global coalesced symbols to allow pcrel being 0 or 1. This works as - we are not moving the instruction and the pc value added in does not - change. Needed for x86 compilers after -1800 (3.3-based), and - eventually necessary for 3.5-based x86 compilers. Radar bug #3806356. - -Changes for the 5.17 release (the cctools-528.5 release): -- Fixed a problem with seg_addr_table(1) when it detects overlaps in both the - read write and read only portions of a split address. However it only will - zero out the portion that has the overlap. Later in seg_addr_table there is - a check to determine if the address has been zeroed out and should have a new - address assigned. This check only looks at the read only portion of the - address to decide if it should assign a new address. The result of this bug - is a library with a read only address that is non zero and a read write - address that is non zero. The fix is in main.c in the update and - update_overlaps code. Radar bug #3767036. -- Fixed unprebind's processing of nonprebound dylibs to allow it to - properly handle relocation entries. Radar bug #3652989. - -Changes for the 5.17 release (the cctools-527 release): -- Fixed a problem with the change for Radar #3738616 in that the checksyms(l) - needs to have a what(1) string. The Makefile was changed to put both the - what(1) string and the apple_version[] info in vers.c . Radar bug #3746707. - -Changes for the 5.17 release (the cctools-526 release): -- Added the -V flag to libtool(1) to print the version. Changed the Makefile - to produce the same version info in vers.c as is done for ld(1). Radar bug - #3738616. -- Fixed warnings for the changes in mach-o headers for types changing from - unsigned long to uint32_t and from long to int32_t. Radar bug #3744082. - - Changed a number of uses of "%lu" to "%u" and "%ld to "%d" in lipo.c, - size.c, nm.c, checksyms.c, cmpdylib.c and redo_prebinding.c . - -Changes for the 5.16 release (the cctools-524 release): -- Fixed a bug in strip(1) that when used on the dynamic linker with no options, - to strip all symbols, it crashed. The fix was in strip_object() in strip.c to - change it to make it call strip_symtab() when the file is an MH_DYLINKER. - Radar bug #3697374. - -Changes for the 5.16 release (the cctools-520 release): -- Fixed a bug in strip(1) that when used on a dynamic library with no options, - to strip all symbols, it produced a malformed file that had bad offsets - to various tables. The fix was in strip_object() in strip.c to change it to - make it call strip_symtab() when the file is an MH_DYLIB. Radar bug #3641669. -- Changed libtool(1) that printed "Logging for Build & Integration] Used static - library" to print the realpath() name of the file name. Radar bug #3585834. -- Changed libtool(1) to take -executable_path as a linker flag. Radar bug - #3489733. -- Changed libtool(1) and ranlib(1) to not generate warnings about multiple - archive members defining the same symbol. This is was done by adding the - boolean parameter library_warnings to the function check_sort_ranlibs() in - libtool.c and always passing this a FALSE. This matches the way it is done - in writeout() in libstuff. Radar bug #3653845 . - -Changes for the 5.16 release (the cctools-512 release): -- Changed the two calls to writeout_to_mem() in redo_prebinding.c to pass the - new enum bool * seen_archive parameter (it is not used in this code however). - See the notes in libstuff for this, as it is part of the fix for Radar bug - #3645280. - -Changes for the 5.16 release (the cctools-509 release): -- Added #ifdef INTERIM_PPC64 to the source changes to support the interim ppc64 - file format. And added -DINTERIM_PPC64 to the Makefile. - -Changes for the 5.16 release (the cctools-500 release): -- Added in nm(1) when -m is specified printing "[no dead strip] " for symbols - with the N_NO_DEAD_STRIP bit set. This change is in print_mach_symbols() in - nm.c . Radar bug #2284500. -- Changed libtool(1) to take -dead_strip and -no_dead_strip_inits_and_terms - as linker flags. Radar bug #2284500. - -Changes for the 5.16 release (the cctools-499.1 release): -- Added support for the interim ppc64 file format. Radar bug #3562133 and - #3562232. - - Updated lipo.c to know about CPU_TYPE_POWERPC64 in print_arch() and - print_cputype(). - - Updated strip_object() in strip.c so the stride for symbol pointers is set - 8 when arch_flag.cputype == CPU_TYPE_POWERPC64 and 4 otherwise. - -Changes for the 5.14 release (the cctools-497 release): -- Added passing the -prebind_allow_overlap from libtool(1) to ld(1). Radar bug - #3452484. - -Changes for the 5.14 release (the cctools-496 release): -- Fixed a bug that caused the seg_addr_table(1) tool to reserves more space - than necessary for flat dylibs. Radar bug #3440884. - -Changes for the 5.13.2 release (the cctools-495.3 release): -- Added a -u option to redo_prebinding(1) and the unprebind(3) API to allow - binaries to be "unprebound". Unprebound binaries are identified by the - MH_PREBINDABLE flag. The unprebind operation will remove all - LC_PREBOUND_DYLIB load commands, set LC_LOAD_DYLIB load command's timestamps - to zero, slide dynamic libraries to address 0x0, set prebound symbols' symtab - entries to be of type N_UNDF and address zero, resets lazy symbol pointers to - their original values as specified in their corresponding relocation entries, - sets non-lazy symbol pointers to zero, and sets two-level hints to zero. If - a dynamic library has all two-level namespace modules bound, the unprebound - binary will also have the MH_ALLMODSBOUND flag set (because this fact is lost - when the LC_PREBOUND_DYLIB commands are removed). It is also - possible to unprebind non-prebound dylibs, executables, and bundles. - These files do not gain the MH_PREBINDABLE flag, however they will have - their dependent library timestamps and versions zeroed, and their hints - table will be zeroed as well. As unprebind is intended to produce a - canonical Mach-O, all unprebound binaries are identified with the - MH_CANONICAL flag. Radar bug #3176679. -- Added a -s option to redo_prebinding(1). If -s is specified, the resulting - output file will be written to standard output, rather than to an output file. - Radar bug #3176679. -- Added a -seg1addr option to redo_prebinding(1). If -seg1addr is specified, - the next command-line argument should be a valid hexadecimal address. - redo_prebinding(1) will then slide the input dynamic library to this address. - This option does not apply when -u, -seg_addr_table or - -seg_addr_table_filename are specified. -- Modified the redo_prebinding code to support reprebinding of unprebound - binaries. This included recognizing binaries with MH_PREBINDABLE as opposed - to MH_PREBOUND as binaries acceptable for reprebinding, using the - MH_ALLMODSBOUND flag (or lack thereof) to determine if all two-level namespace - modules should be bound for input binaries with MH_PREBINDABLE, and changing - the type of the input symbols to N_PBUD if the type was read in as N_UNDF and - the file has MH_PREBINDABLE set in setup_initial_undefined_list() (this is - because these symbols can be assumed to have been prebound symbols prior to - the file being unprebound, and these symbols must be treated as prebound - during the reprebinding process). Radar bug #3176679. - -Changes for the 5.13 release (the cctools-493 release): -- Fixed a bug in the redo_prebinding code that was incorrectly checking that an - executable does not have any extra LC_PREBOUND_DYLIB load commands for - libraries that don't exist. This can cause an error if an indirectly - referenced dylib's install name changes. This is not needed since - update_load_commands() will recreate the LC_PREBOUND_DYLIB load commands for - the indirectly referenced dynamic libraries. Including both adding and - removing ones as needed to match the libraries on the system. Radar bug - #3408696. - -Changes for the 5.13 release (the cctools-492 release): -- Changed the seg_addr_table(1) tool to assign addresses for _debug and _profile - libraries addresses to start at 0x40000000 through lower addresses. Radar - bug #3360593. -- Fixed a bug in the seg_addr_table(1) tool where the bounds checking in - next_flat_seg1addr was not entirely correct. The fix is two places in - next_flat_seg1addr() in seg_addr_table.c . Radar bug #3359505. - -Changes for the 5.13 release (the cctools-483 release): -- Fixed a bug in libtool(1)'s handling of -weak_framework and -weak_library - flags. The code in the routine process() in libtool.c needed the same check - for -framework to avoid thinking the flag as a file name and trying to open - it. Radar bug #3318491. -- Changed libtool(1) to pass the -m flag on to the linker. Radar bug #3305123. - -Changes for the 5.12 release (the cctools-474 release): -- Fixed a bug in redo_prebinding that was leaking memory if the - allow_missing_architectures parameter was used and the fat file did not - contain an architecture. The fix was in load_library() in 4 places it - checks to see if the missing architecure is allowed to be missing and it now - unmap's the ofile before returning. Radar bug #3144803. - -Changes for the 5.12 release (the cctools-472 release): -- Fixed a bug in seg_addr_table(1) when run with -relayout the <<< Next split - address to assign >>> isn't getting set properly. The fix in in main() to add - relayout == FALSE to the if() condition for the code that loops and updates - the NEXT_SPLIT_ADDRESS_TO_ASSIGN. Radar bug #3245958. - -Changes for the 5.12 release (the cctools-470 release): -- Added the -c option to strip(1) to strip the section contents of a dynamic - shared library and create a stub library. Radar bug #3235093. -- Changed install_name_tool(1) to not change MH_DYLIB_STUB filetypes. - Radar bug #3235093. -- Added the flag -search_paths_first to cause -lx flags to search each path - for .dylib then .a before searching next path to libtool(1). Radar bug - #3176974. - - Added the enum bool variable search_paths_first to the cmd_flags struct and - code to parse out the option, set variable and add it to the ldflags[] in - main() . - - The new static routines search_paths_for_lname() and search_path_for_lname() - were added. - - In file_name_from_l_flag() a test of the new search_paths_first variable is - done and if TRUE then search_paths_for_lname() is called. - -Changes for the 5.12 release (the cctools-469 release): -- Added support for the -weak-lx, -weak_library and -weak_framework flags to - libtool(1). Radar bug #3069758. -- Fixed a bug seg_addr_table(1) in next_flat_seg1addr() where the variable i - was previously changed to unsigned. The second loop uses this varaiable as - signed and thus this change was causing the loop to never terminate. Radar - bug 3225931. - -Changes for the 5.12 release (the cctools-466 release): -- Fixed a bug in libtool(1) for the -static option that caused it to crash if - the objects contained no symbols to put in the table of contents. Radar bug - #3217471. -- Fixed the incorrect casts on the comparison of the nlist struct's n_strx field - where the value being compared to was casted to a long. The correct fix was - to cast n_strx to an unsigned long. -- Changed print_mach_symbols() in nm.c to print "(dynamically looked up)" for - the library ordinal DYNAMIC_LOOKUP_ORDINAL which are looked up dynamically - with flat namespace semantics in two-level namespace images. Radar bug - #3210803. -- Changed get_primary_lib() in redo_prebinding.c to check for the library - ordinal DYNAMIC_LOOKUP_ORDINAL and return NULL. Radar bug #3210803. - -Changes for the 5.12 release (the cctools-464 release): -- Made changes to build cleanly with gcc3.3 - - Removed -Wno-precomp from the Makefile - - Fixed warnings for "comparison between signed and unsigned" in lipo.c, - size.c, strings.c, nm.c, libtool.c, checksyms.c, indr.c, strip.c, segedit.c, - kern_tool.c, cmpdylib.c, dylib_pcsampler.c, pagestuff.c, redo_prebinding.c, - seg_addr_table.c, check_dylib.c, seg_hack.c and install_name_tool.c. - -Changes for the 5.12 release (the cctools-463 release): -- Added support for MH_DYLIB_STUB libraries. Radar bug #3193744. - - Added the testing for MH_DYLIB_STUB along with MH_DYLIB in add_member() - in libtool.c . - - Added the testing for MH_DYLIB_STUB along with MH_DYLIB in - translate_object() in indr.c in the error check. - - Added a case for MH_DYLIB_STUB in type_buf() in file.c (note this is the - old file(1) command and is no longer used). - - Added the testing for MH_DYLIB_STUB along with MH_DYLIB in check_dylib() - in cmpdylib.c in 2 places. - - Added the testing for MH_DYLIB_STUB along with MH_DYLIB in checksyms() and - in check_dynamic_binary() in checksyms.c in 3 places in all. - - Added the testing for MH_DYLIB_STUB along with MH_DYLIB in check_hints.c . - -Changes for the 5.12 release (the cctools-461 release): -- Fixed a bug in install_name_tool(1) that caused it to crash when the new - load commands were smaller than the old load commands. Radar bug #3161586. - -Changes for the 5.12 release (the cctools-456 release): -- Fixed a bug in the redo_prebinding code when the allow_missing_architectures - parameter to the redo_prebinding() API is non-zero. In the routine - load_library() an extra check is needed to not cause an error if we are - allowing missing architectures. The case where this happens is when there - is a fat file that the architecture we don't care about depends on a library - in another fat file but the time stamps for the libraries don't match. - Radar bug #3144552. - -Changes for the 5.12 release (the cctools-455 release): -- Fixed a bug in the redo_prebinding code in the routine link_library_module() - in redo_prebinding.c. The problem was that when a reference to a private - extern was found only the module containing it was marked linked. A call - to link_library_module() for that module was needed to pull in its - dependencies and get those modules marked as LINKED. Radar bug #3126383. - -Changes for the 5.12 release (the cctools-454 release): -- Fixed a bug where seg_addr_table doesn't catch when an address is assigned in - the "alternate" area. seg_addr_table(1) was using the wrong constant to - check the validity of newly assigned addresses, the fix is to use the correct - constant. Radar bug #3138181. - -Changes for the 5.12 release (the cctools-452 release): -- Fixed the bug fix done for Radar bug #3124262 below in the redo_prebinding - code. The copied code from the above loop was wrong as it changed this: - if(libs[i].module_states[j] == LINKED) - to this: - if(libs[j].module_states[k] == LINKED || - (prebind_all_twolevel_modules == TRUE && - (libs[j].ofile->mh->flags & MH_TWOLEVEL) == - MH_TWOLEVEL)) - which should have been this: - if(libs[i].module_states[j] == LINKED || - (prebind_all_twolevel_modules == TRUE && - (libs[i].ofile->mh->flags & MH_TWOLEVEL) == - MH_TWOLEVEL)) - which used the correct index variables. Radar bug #3133589. - -Changes for the 5.12 release (the cctools-451 release): -- Fixed a bug in the redo_prebinding code that did not set the all the bits - in the linked_modules bit vector for any new LC_PREBOUND_DYLIB load commands - when prebind_all_twolevel_modules was TRUE. Radar bug #3124262. - -Changes for the 5.12 release (the cctools-448 release): -- Added an entry stabnames[] array in nm.c for N_OPT that is emitted with - gcc2_compiled and in gcc source. Radar bug #3104328. - -Changes for the 5.12 release (the cctools-447 release): -- Fixed a bug in add_member() in libtool.c when get_arch_family_from_cputype() - returns NULL. - -Changes for the 5.11 release (the cctools-446 release): -- Added passing -x from libtool to ld. Radar bug #3088301. - -Changes for the 5.11 release (the cctools-444 release): -- Added passing -exported_symbols_list & -unexported_symbols_list from libtool - to ld. Radar bug #3083844. -- Factored out some of the symbol list stuff out of strip.c into libstuff so - ld(1)'s -exported_symbols_list and -unexported_symbols_list options can use - it. Radar bug #3083844. - -Changes for the 5.11 release (the cctools-443 release): -- Added passing -single_module & -multi_module from libtool to ld. Also added - passing -u flags. Radar #3080780. - -Changes for the 5.11 release (the cctools-440 release): -- Fixed the warnings about extra tokens at end of #endif directive in - check_hints.c, strip.c and make_defs.h (Radar bug #3072042). - -Changes for the 5.11 release (the cctools-439 release): -- Made the needed changes to lipo.c for VEO support. Radar bug #3068161. -- Added the install_name() API to redo_prebinding.c . Radar bug #3065586. -- Changed needs_redo_prebinding() in redo_prebinding.c to check all archs if - allow_missing_archs is zero. Radar bug #3065577. -- Added parsing out -no_arch_warnings to libtool(1), which is then ignored, - so it can be passed to it. Radar bug #3064819. - -Changes for the 5.11 release (the cctools-437 release): -- Backed out Radar bug #2922145 and changed the Makefile back to only create - only -dynamic compiled libredo_prebinding.a. Radar bug #3000895. -- Add support in nm(1) for printing the new stab entries for Radar bug #2940311 - which should be: - N_PARAMS 0x86 - N_VERSION 0x88 - N_OLEVEL 0x8A - Also needed to fix a couple of places that did not check the N_STAB being zero - before checking the N_TYPE bits to be N_INDR (which N_OLEVEL has). - Radar bug #3000792. -- Fixed a bug in setup_symbol_list() in strip.c in the code that removes - duplicates from the list. The second loop limit needed to loop for one - less. Radar bug #2962899. - -Changes for the 5.10 release (the cctools-435 release): -- Fixed bugs in the libredo_prebinding API's of object_file_type() and - get_prebind_cksums() that were not calling setjmp() to set up for handling - of errors. Radar bug #2992414. -- Changed redo_prebinding to not attempt to redo the prebinding on any file - that has a resource fork. The test is made deep in the code just before it - would actually do the work. It is done this way to not mess up the other - options like -i that is trying to ignore non-Mach-O files, etc. Radar bug - #2987656. - -Changes for the 5.10 release (the cctools-434 release): -- Changed nmedit -p to not change the indirect table entries to - INDIRECT_SYMBOL_LOCAL since the symbols are still global. Radar bug 2986703. - -Changes for the 5.10 release (the cctools-432 release): -- Changed libtool(1) when the -static option is in effect to not put a dynamic - library file into the static library it is creating. This can happen if a - libx.a file is really a dynamic library and someone is using -lx when creating - a static library. The change is in add_member() in libtool.c. Radar bug - #2970223. - -Changes for the 5.10 release (the cctools-430 release): -- Changed the experimental code in nmedit that changes global coalesced symbols - into statics to do very limited relocation. It can do VANILLA long sized - non-pcrel relocation. It does not correctly convert it to a scattered - relocation entry when it should. - -Changes for the 5.10 release (the cctools-429 release): -- Fixes a bug with the experiment in cctools-428 that was changing global - coalesced symbols into statics. A static symbol can't be a weak_definition - and ld(1) catches this as an error. So in edit_symtab() just after it cleared - the N_EXT bit it also clears the N_WEAK_DEF bit. - -Changes for the 5.10 release (the cctools-428 release): -- As an experiment changed nmedit(1) when using the -s option on an MH_OBJECT - file change change global coalesced symbols into statics. Then if there are - external relocation entries to just turn them into local entries without - knowing if they should be scattered relocation entries. Radar bug #2957909. - -Changes for the 5.10 release (the cctools-427 release): -- Changed nmedit(1) -p to also change global coalesced symbols into private - externs. The change was in edit_symtab() in strip.c. Radar bug #2956057. - -Changes for the 5.10 release (the cctools-422 release): -- Changed strip_symtab() in strip.c to strip local symbols in sections that have - the S_ATTR_STRIP_SYMS section attribute in files linked for dyld. Radar bug - #2945659. - -Changes for the 5.10 release (the cctools-421 release): -- Fixed a bug in the redo_prebinding(3) API where the internal static variable - check_if_needed was not reset in reset_statics(). Radar bug #2933102. -- Picked up the changes to seg_addr_table(1) for the new -relayout_nonsplit - option. Radar bug #2935630. - -Changes for the 5.10 release (the cctools-420 release): -- Added the -M flag to libtool to passing through to ld(1). Radar bug #2935497. -- Changed what the needs_redo_prebinding() API and the redo_prebinding() API - (when the only_if_needed parameter is non-zero) returns for statically linked - executables. In this case needs_redo_prebinding() now returns NOT_PREBINDABLE - and redo_prebinding() returns REDO_PREBINDING_NOT_NEEDED. Radar bug #2934831. - -Changes for the 5.10 release (the cctools-417 release): -- Changed the Makefile to create both a -static compiled and a -dynamic - compiled libredo_prebinding.{dylib,a} pair. Radar bug #2922145. - -Changes for the 5.10 release (the cctools-416 release): -- Changed print_mach_symbols() in nm.c to also print "weak" for symbols with - the N_WEAK_DEF bit set. Removed the code to test for sections with the - S_ATTR_WEAK_DEFS attribute. Radar bug #2919646. -- Fixed a problem with redo_prebinding updating the LC_ID_DYLIB time_stamp for - archs that were missing. This is done in build_new_symbol_table() by setting - the new dont_update_LC_ID_DYLIB_time_stamp field. Radar bug #2914003. - -Changes for the 5.10 release (the cctools-415 release): -- Changed redo_prebinding(1) to detect when an executable was built with the - -prebind_all_twolevel_modules and then bind all twolevel modules on output. - Radar bug #2909518. -- Added pass the -ObjC flag from libtool to ld. - -Changes for the 5.10 release (the cctools-414 release): -- Changed print_mach_symbols() in nm.c to also print "weak" for symbols in a - section with the S_ATTR_WEAK_DEFS attribute. Radar bug #2898558. -- Changed seg_addr_table(1)'s default adresses for Mac OS X 10.2 to be - 0x8fe00000 not 0x7fe00000. Radar bug #2897418. -- Added the new routine check_for_extra_LC_PREBOUND_DYLIB() in redo_prebinding.c - and a call to it in process_arch(). This is done to match dyld's checking - for extra LC_PREBOUND_DYLIB commands an not use the prebinding. Radar bug - #2894021. -- Fixed the arguments to the fprintf() call on line 762 in redo_prebinding.c . - -Changes for the 5.10 release (the cctools-413 release): -- Changed seg_addr_table(1)'s default adresses for Mac OS X 10.2 to be - 0x7fe00000 not 0x7ffc0000. - -Changes for the 5.10 release (the cctools-412 release): -- Fixed a problem with the redo_prebinding(3) library routine when it is passed - zero for the slide_to_address parameter. The static variable dylib_vmslide - did not get reset in reset_statics() like it should. Radar bug #2882844. -- Changed seg_addr_table() to not cause an error when the project that builds - a library can't be found in the -update or -update_overlaps mode. This was - done by passing a new no_error_if_missing parameter to get_image_file_name() - which pass it down to get_symfile_for_dylib() and get_dstfile_for_dylib(). - Radar bug #2882324. -- Fixed a bug in strings(1) that was passing the process_non_objects to - ofile_process() as FALSE when it should have been TRUE. Radar bug #2868578. - -Changes for the 5.10 release (the cctools-411 release): -- Changed seg_addr_table(1)'s default adresses for Mac OS X 10.2 to be based on - the value MACOSX_DEPLOYMENT_TARGET. Also added the flag -allocate_flat - with the increasing or decreasing argument to allow the flat libraries to be - allocated in decreasing addresses. Radar bug #2848945. - -Changes for the 5.10 release (the cctools-406 release): -- Changed dependent_libs(3) to work for MH_BUNDLE type objects. Radar bug - #2862297. - -Changes for the 5.10 release (the cctools-405 release): -- Changed the implementation of the fix to strip below slightly. The code to - check if a local private extern was on the save list was moved ahead of - other checks in strip_symtab(). This is needed to avoid an error saying the - symbols names listed in save file was not in the object file. - -Changes for the 5.10 release (the cctools-404 release): -- Changed strip(1) to fix the problem with the fix to strip private externs - that were turned into statics which was Radar bug #2853161. This change - caused some private extern coalesced symbols used through indirect symbols - not to be saved. The fix was to copy the code to check for coalesced symbols - used by indirect symbols into the local symbol if case. Then as it turned out - some other non-coalesced local symbols were being used via indirect symbols - so the test for the symbol being coalesced was removed and only the test for - using it through an indirect symbol remains. The new Radar bug is 2860291. -- Changed weak_module to be static in redo_prebinding.c. Radar bug #2859919. - -Changes for the 5.10 release (the cctools-403 release): -- Changed the all target in the Makefile to also depend on lib_ofiles so - everything gets built by default. - -Changes for the 5.10 release (the cctools-402 release): -- Changed strip(1) to strip private externs that were turned into statics that - are in a dynamic library that are not referenced by a module other than where - the symbols is defined. Radar bug #2853161. - -Changes for the 5.10 release (the cctools-400 release): -- Changed the Makefile back to again use the -dependency-file with gcc. -- Changed seg_addr_table to not generate errors about table entries that do not - exist when -update or -update_overlapps are specified. Radar bug #2848667. -- Changed check_syms to not check dynamic shared library addresses. The code - in check_dylib() was ifdef'ed out. Radar bug #2847857. -- Fixed a bug in the change to strip that stripped coalesced symbols that are - not used with an indirect symbol table entry by default. Radar bug #2689894. - The problem is that the setting of output_indirect_symtab was not done for the - strip (not NMEDIT case) when it was moved up. Radar bug #2851013. -- Added the new throttle parameter to the redo_prebinding() API to allow it to - be used used for prebinding on demand to throttle back its I/O when running - in the back ground. Radar bug #2850642. -- Changed indr.c, strip.c, seg_hack and install_name_tool to add the new - throttle parameter to writeout(). Radar bug #2850642. - -Changes for the 5.10 release (the cctools-399 release): -- Changed seg_addr_table(1) in the -update or -update_overlapps case to not - check that non-zero addresses in the table match the addresses in the dynamic - library file. Radar bug #2841199. - -Changes for the 5.10 release (the cctools-398 release): -- Changed redo_prebinding to check if the library has already been loaded via - the dev,ino pair from stat(2). This change is in load_library() and the - fields dev,ino have been added to the lib struct. - -Changes for the 5.10 release (the cctools-397 release): -- Added the new allow_missing_architectures parameter to the - needs_redo_prebinding() API. Radar bug #2836068. -- Added the -multiply_defined_unused flag to libtool. Radar bug #2835152. - -Changes for the 5.10 release (the cctools-396 release): -- Changed seg_addr_table(1) to not use the SYMROOT file when -update is used. - Radar bug #2826945. -- Added passing the -weak_reference_mismatches flag from libtool to ld. -- Added the new allow_missing_architectures parameter to the redo_prebinding() - API in . Radar bug #2809673. - - In API redo_prebinding() the new allow_missing_architectures parameter gets - set into the static variable arch_cant_be_missing. - - In load_library() where it checks for missing architectures it tests the - static variable arch_cant_be_missing for non-zero and compares it to the - arch_flag.cputype. If set and it does not match load_library() was changed - to return FALSE (previously void) else it returns TRUE. - - In load_archs_libraries() and load_dependent_libraries() which calls - load_library() if load_library() returns FALSE these two calls also return - FALSE. - - Then in process_archs() if load_archs_libraries() and - load_dependent_libraries() return FALSE it calls to setup the symbolic info, - build a new symbol table and swap the symbol table for output before - returning. - - The routines setup_symbolic_info() and build_new_symbol_table() both had a - new boolean prameter missing_arch. And if missing_arch is passed as TRUE it - just setups up the info or builds the new symbol table without updating the - prebinding info. - -- Added the -f flag to ranlib so that it warns when it creates a fat archive - that ar(1) will not be able to operate on. This is used by ar(1) with the - -s option when it runs ranlib. Radar bug #2814831. -- Changed the use of N_WEAK_SYM to N_WEAK_REF in nm.c and redo_prebinding.c. -- Changed the Makefile to not use the -dependency-file with gcc as well as - mwccppc. - -Changes for the 5.10 release (the cctools-395 release): -- Fixed a bug in redo_prebinding that was checking for symbols being overridden - where it should have ignored two-level namespace libraries. Added checks in - check_dylibs_for_definition() and check_dylibs_for_reference(). - -Changes for the 5.10 release (the cctools-394 release): -- Fixed a bug in redo_prebinding that should not have been checking for symbols - being overridden in two-level namespace images. The change was in - process_arch() adding a check before the call to - check_for_dylib_override_symbols(). -- Changed strip to strip coalesced symbols that are not used with an indirect - symbol table entry by default. Radar bug #2689894. -- Updated redo_prebinding to support weak linking. Radar bug #2803414. - -Changes for the 5.10 release (the cctools-393 release): -- Changed nm(1)'s -m option to print "weak external" for symbols with the - N_WEAK_SYM bit set. -- Made the changes to support the LC_LOAD_WEAK_DYLIB varient of the - LC_LOAD_DYLIB load command. The following files were effected check_hints.c, - install_name_tool.c, nm.c, redo_prebinding.c and segedit.c. - - Note: the changes to redo_prebinding.c to support redoing the prebinding when - a weak library is missing or a weak symbol is missing is not done yet. - -Changes for the 5.10 release (the cctools-392 release): -- Changed the calls to ofile_process() in size.c, strings.c, nm.c and - kern_tool.c to pass TRUE for the new use_member_syntax parameter. Radar bug - #2730127. -- Changed the calls to ofile_process() in checksyms.c, cmpdylib.c, - seg_addr_table.c and check_dylib.c to pass FALSE for the new use_member_syntax - parameter. Radar bug #2730127. - -Changes for the 5.10 release (the cctools-390 release): -- Added the command install_name_tool(1). -- Fixed some bugs in the update_load_commands() routine of redo_prebinding.c . - The first was the missing check of the section flags against S_ZEROFILL when - determining the low_fileoff. The others where in not resetting all of the - pointers into the load_commands at the end of the routine. - -Changes for the 5.10 release (the cctools-389 release): -- Updated the inout.c example tool to work correctly with all the tables of - a dynamic library. -- Added the -prebind_all_twolevel_modules and the -headerpad_max_install_names - options to libtool. -- Fixed a bug with the checking of the LIBRARY_ORDINAL in redo_prebinding that - was causing a crash when SELF_LIBRARY_ORDINAL (0) was used in a malformed - executable. Radar bug #2787021. - -Changes for the 5.10 release (the cctools-387 release): -- Changed check_dylib to not check the -install_name argument of the dylib if - the dylib starts with @executable_path. -- Added the -seg_addr_table_filename option to libtool, - redo_prebinding, checksyms and check_dylib. For check_dylib this flag is - required. -- Fixed a grammatical error in redo_prebinding.c where "overridden" should have - been used where "overridded" was used. Radar bug #2764926. - -Changes for the 5.10 release (the cctools-386 release): -- Changed the breakout() calls in strip.c, indr.c and seg_hack.c to pass FALSE - as the value for the new calculate_input_prebind_cksum parameter and always - set the prebind checksum to zero (if any) on output. -- Added the -z option to redo_prebinding(1) to zero out the prebind check sum. -- Changed all the breakout() calls in redo_prebinding.c to pass the appropate - value for the new calculate_input_prebind_cksum parameter. - -Changes for the 5.10 release (the cctools-385 release): -- Fixed a bug in the parsing of the -segs_read_only_addr and - -segs_read_write_addr options to seg_addr_table.c that was missing a leading - '-'. -- Changed redo_prebinding(1) to add the -seg_addr_table option to allow it to - relocate a dynamic library to a new prefered address. Many changes to the - code were made to support this. Radar bug #2575205 and #2729976. - - Added the routine object_file_type(). - - Added the only_if_needed boolean parameter to the redo_prebinding(3) library. - - Changed the return type of the redo_prebinding(3) library API to be an enum. - - Removed the comment about the slide_to_address parameter of the - redo_prebinding(3) library API not being supported. - - Added the expected_address parameter to the needs_redo_prebinding(3) library - API. - - Changed libredo_prebinding.a from an object file to an archive. - -Changes for the 5.9 release (the cctools-380 release): -- Added the -twolevel_namespace_hints option to libtool. Radar bug #2735266. - -Changes for the 5.9 release (the cctools-379 release): -- Fixed pagestuff(1) to know about the hints table. - -Changes for the 5.9 release (the cctools-372 release): -- Picked up the changes to seg_addr_table(1) for the new -update_overlaps - option. - -Changes for the 5.9 release (the cctools-371 release): -- Fixed "uptodate" to be "up to date" in redo_prebinding.c. Radar bug #2711451. -- Fixed a bug in redo_prebinding(1) that was not testing the value of arch_hints - for NULL before using it in build_new_symbol_table() in redo_prebinding.c - before using it. So for images without hints it would crash. - -Changes for the 5.9 release (the cctools-370 release): -- Added support for updating the hints table to redo_prebinding. - - Changed swap_arch_for_output() for swapping hints on output. - - Change build_new_symbol_table() in redo_prebinding.c to also update - the hints table with its call to lookup_symbol(). Changed the various - lookup_symbol*() routines to take a pointer to a isub_image and itoc to - fill in if not NULL. - - Changed build_new_symbol_table() to account for hints in the sym_info_size. - - Added variables arch_hints and arch_nhints to redo_prebinding.c and cleared - them in reset_statics() and set and swapped them in setup_symbolic_info(). - -- Changed strip_object() in strip.c to set the object's output_hints field and - to reset the object's hints_cmd->offset field. Also to adjust the - input_sym_info_size and output_sym_info_size fields with the size of the - hints. -- Changed build_new_symbol_table() in redo_prebinding.c to know about the - hints table as in strip above. -- Changed translate_dylib() in indr.c to know about INDIRECT_SYMBOL_LOCAL and - INDIRECT_SYMBOL_ABS. And to know about prebound undefined symbols (N_PBUD). - Also made the same changes as in strip noted above for hints. - -Changes for the 5.9 release (the cctools-369.3 release): -- Fixed a bug in check_symbolic_info_tables() in redo_prebinding.c in its - checking for bad LIBRARY_ORDINAL that needed to make sure the symbol was not - a N_STAB before checking it. - -Changes for the 5.9 release (the cctools-369 release): -- Fixed redo_prebinding which had the same problem as dyld that was fixed in - cctools-366 with undefined symbol references from two-level images where - the definition of the symbol is in a sub-framework of a flat namespace - umbrella framework that would come up undefined. The fixes were in - load_archs_libraries() and load_dependent_libraries() for counting the - dependent libraries no longer being conditional on the image being - MH_TWOLEVEL. And in load_dependent_libraries() so the call to - setup_sub_images() is also longer conditional on if the image is MH_TWOLEVEL. - -Changes for the 5.9 release (the cctools-367 release): -- Added support for sub-libraries like sub-umbrellas to redo_prebinding. - Radar bug #2697458. - - Added the following field to the lib struct: - char *library_name; - and changed the of the following field from umbrella_name_size to: - unsigned long name_size; - for use both by umbrella_name and library_name. The code was changed to use - the new field name. - - Changed load_archs_libraries() and load_library() to set the library_name - field from the return value of guess_short_name(). - - Changed print_two_level_info() to print the library_name in the various lists. - - Changed setup_sub_images()'s header comments to include sub-libraries and - added code to deal with sub-libraries like sub-umbrellas. -- Added the -sub_library flag to libtool. Radar bug #2697458. - -Changes for the 5.9 release (the cctools-363 release): -- Changed libtool so that if -arch_only is specified with a specific cpusubtype - other than the family cpusubtype it does not use -force_cpusubtype_ALL and - passes the -arch_only argument to ld(1) as the -arch flag so that the output - is to be tagged with that cpusubtype. - -Changes for the 5.9 release (the cctools-362 release): -- Fixed a bug in redo_prebinding.c in main() where the mask it uses to get - the mode from the stat mode should be 07777 not 06777 so the sticky bit - gets set. -- Added progname to file.c as the changes to libstuff needs it (this is the - Openstep version of file). -- Fixed the same bug in load_dependent_libraries() as in dyld in - redo_prebinding.c that was only calling setup_umbrella_images() if the library - was a MH_TWOLEVEL. This needed to call setup_umbrella_images() for all - libraries as it is possible that a sub-framework of an umbrella library is - flat and the umbrella library is two-level. In that case other images could - have two-level namespace references recorded to the umbrella library for - symbols defined in the flat sub-framework. - -Changes for the 5.9 release (the cctools-360 release): -- Added the -e option to redo_prebinding(1) to take the executable_path. -- Changed the code in redo_prebinding to be ifdef'ed with LIBRARY_API for the - API in Radar bug #2604014. - -Changes for the 5.9 release (the cctools-359 release): -- Changed libtool(1) to pass -multiply_defined to the linker. -- Made a great number of changes to redo_prebinding(1) so it would support - two-level namespace images. -- Fixed a bug in redo_prebinding(1) that would overwrite the output_file with - a partially written file if the filesystem fills up. Radar bug #2639352. -- Added code in nm.c to deal with the library ordinal being EXECUTABLE_ORDINAL. -- Changed checksyms(1) to open the default segment address table if none is - specified via a -seg_addr_table argument. -- Added -Wno-long-double to shutup the compiler for - . - -Changes for the 5.8 release (the cctools-357 release): -- Added support for the CPU_SUBTYPE_POWERPC_7450 in lipo.c. Radar bug #2599869. -- Fixed a bug in seg_addr_table(1) when the -update option was used that it - did not preserve the non-zero addresses in the table. Instead it changed the - non-zero entries to the values in the libraries were built with. Radar bug - #2575214. - -Changes for the 5.8 release (the cctools-356 release): -- Changed the algorithm in seg_addr_table(1) for split libraries to add in the - rounding factor (0x10000) before calling round(). - -Changes for the 5.8 release (the cctools-355 release): -- Fixed a bug in strip that needed to save local symbols that were private - extern symbols that were in COALESCED sections. Radar bug #2584111. - -Changes for the 5.8 release (the cctools-354 release): -- Fixed a bug in libtool(1) when using -filelist that did not allocate the - correct amount of memory due to a '*' needing to be a '+' on lines 388 and - on 390. - -Changes for the 5.8 release (the cctools-352 release): -- Fixed yet another bug with nmedit(1) that did not set the fields nlocalsym and - nextdefsym to zero before incrementing them. - -Changes for the 5.8 release (the cctools-351 release): -- Fixed a bug in nmedit(1) that did not swap the correct module table. -- Fixed a bug with nm(1) dealing with a dynamic library that had bad iextdefsym - or nextdefsym fields of a dylib_module which caused it to crash. - -Changes for the 5.8 release (the cctools-350 release): -- Fixed a bug in seg_addr_table(1) where the -disablewarnings flag did not - disable the split overlap messages. - -Changes for the 5.8 release (the cctools-349 release): -- Added passing -Y through from libtool to ld. - -Changes for the 5.8 release (the cctools-348 release): -- Changed nmedit to remove duplicate names in the -s file so it does not - later complain that a symbol did not appear in the input file. - -Changes for the 5.8 release (the cctools-347 release): -- Fixed a bug in the handing of -final_output on the command line of libtool. - -Changes for the 5.8 release (the cctools-346 release): -- Added the -final_output flag to libtool to pass along to ld(1). - -Changes for the 5.8 release (the cctools-345 release): -- Changed redo_prebinding -c so that it also checks the installed dynamic - library against the file it is running against for the correct time - stamp. Radar bug #2541232. -- Fixed a bug in redo_prebinding that did not correctly exit when an - executable's dependent libraries were out of date. Radar bug #2544407. -- Fixed a bug in redo_prebinding that did not correctly redo the relocation - for split libraries as it was not based on the -seg_read_write_address as it - should have been for split libraries. Radar bug #2544599. -- Fixed a bug in seg_addr_table(1) that caused it to crash as it was doing - a memset on a malloc()'ed memory larger than was allocated. Also fixed - a bug that was not allocating enough layout_info structs. Radar bug #2540744. - -Changes for the 5.8 release (the cctools-344 release): -- Changed nm(1) -m to print the name of the libraries undefined symbols are - bound from when MH_TWOLEVEL is in the header. Radar bug #2538835. - -Changes for the 5.8 release (the cctools-342 release): -- Added parsing the -flatname_space and -twolevel_namespace options and - -allowable_client option to libtool(1). Radar bug #2533649. -- Changed seg_addr_table(1) in its checking of sorted flat libraries for - overlaps so that when checking the next flat address to be assigned it checks - that the next address is also greater than the start of the as well as less - than the end of the region and that the region is not a fixed region. - Radar bug #2531831. - -Changes for the 5.8 release (the cctools-341 release): -- Changed setup_symbol_list() in strip.c to allocate and stuff in an extra - newline in the symbol list file so that files that end without a new line - work. Radar bug #2520711. -- Added the tool seg_hack to change the names of Mach-O segments for use by KLD. - Radar bug #2523649. -- Changed nmedit to not change global coalesced symbols into statics and changed - strip not not strip global coalesced symbols. Radar bug #2503670. - Also made a fix to this to because if a coalesced symbol were listed in the - -s file it complained that the symbol was not in the input. - -Changes for the 5.7 release (the cctools-337 release): -- Changed seg_addr_table(1) to use 0x70000000 as the default segs_read_only_addr - and 0x80000000 as the seg_read_write_addr. Also added two entries in - sorted_flat_layout_info so that next_flat_seg1addr() will step over these - areas. Radar bug #2496843. -- Added a check in edit_symtab() in strip.c (for nmedit) that checks to see - that the N_FUN name is not NULL. This prevents a error message about a - missing ':' in the stab name of a N_FUN when the name is NULL. The compiler - emits this as the end of the function stab. Radar bug #2495413. - -Changes for the 5.7 release (the cctools-336 release): -- Added code in libtool.c that did not place N_SECT symbols marked with the - attribute NO_TOC into the table of contents. Radar bug #2494286. - -Changes for the 5.7 release (the cctools-334 release): -- Changed checksyms(l) to not generate an error if a segment address table is - used and the library is not found in it. As the B&I tools will add it - automaticly. Also removed all checks for paths and use guess_short_name(). - Also changed guess_short_name()'s has_suffix argument to return a pointer - to the suffix so checksyms could check for "_debug". This effected - seg_addr_table(l)'s and ld(1)'s guess_short_name() call too. Radar bug - #2490411. -- Changed seg_addr_table(l) to not use the factor for allocating the size of - split libraries. Also added some checking so that only the first 128meg of - a 256meg split segment is allocated. Radar bug #2490413. -- Added the -run_init_lazily flag to libtool. Radar bug #2490396. - -Changes for the 5.7 release (the cctools-333 release): -- Fixed a bug introduced with the changes to strip.c to allow nmedit to work - on shared libraries. It produced bad output files for fat files as it was - free()'ing data structures to be written out. Radar bug #2484851. - -Changes for the 5.7 release (the cctools-332 release): -- Added the -disablewarnings flag to seg_addr_table(1). This flag is also - passed to the various routines used in libstuff (Radar bug #2482327). -- Fixed a bug in seg_addr_table(1) where -update did not ignore the fixed and - next entries which caused address assigned for -update to be very messed up - (Radar bug #2482327). -- Major changes to strip.c to allow nmedit to work on dynamic shared libraries. - Also fixes to nmedit so that the symbol table was in the right order after - symbols were change to statics. Other changes in dyld and ld are also needed - for this change (Radar bug #2420307). - -Changes for the 5.7 release (the cctools-330 release): -- Changed the call to netname_look_up() in check_for_ProjectBuilder() in - libtool.c to bootstrap_look_up() when __OPENSTEP__ and - __GONZO_BUNSEN_BEAKER__ is not defined (Radar bug #2473864). - -Changes for the 5.7 release (the cctools-329 release): -- Fixed a bug in the command line parsing of the strings command where if you - gave it any argument it would think there were also files listed on the - command line so it would never parse standard input if "strings -4 < file" - was used (Radar bug #2459126). -- Added code in seg_addr_table.c to not assign addresses over the maximum - intel user space address. Radar bug #2418080. -- Removed the core.c file from this directory since the new API to create a - task from a core file was added. Radar bug #2155790. -- Changed libtool to pass -whatsloaded to ld(1). Radar bug #2469803. -- Fixed a bug in seg_addr_table when in update mode an new flat entry with a - zero address in the table (and a non-matching address in the file) is to be - updated and there are existing entries with the same short name. To solve - this a new field current_entry was added to the layout_info struct for - sizes_and_addresses() to use. It is set to the current seg_addr_table entry - before calling ofile_process() which will call sizes_and_addresses(). Then - sizes_and_addresses() can tell if the current entry has a zero address not to - generate the warning message about the ofile not having the correct seg1addr. - Radar bug #2469876. -- Fixed a bug in seg_addr_table in sizes_and_addresses() where it was updating - the layout_info->seg1addr after it printed an error message that the seg1addr - did not match. That error message also did not print the architecture. This - problem then caused a later error message to think that the original file had - the wrong address. Radar bug #2469876. -- Fixed a bug in libtool/ranlib that did not deal with zero length archive - members that had long names and used 4.4BSD extended format #1. The code in - libtool in two places was subtracting the size of the name from the member - size which had already been done by the ofile routines. Radar bug #2460604. -- Changed checksyms(l) to allow debug symbols in libraries and frameworks with - _debug suffixes. Radar bug #2469760. -- Changed strip.c to allow '\r' as well as '\n' in the strip list file. Radar - bug #2458346. - -Changes for the 5.7 release (the cctools-327 release): -- Changed checksyms(l) to used "/AppleInternal" going forward and only use - "/Local" when __GONZO_BUNSEN_BEAKER__ is defined for older builds (DP3, PR2, - etc). - -Changes for the 5.6 release (the cctools-324 release): -- Fixed a bug in seg_addr_table(l) so that it checks all entries in the table - against all other entries for overlaps. -- Fixed a bug in seg_addr_table(l) so that -checkonly does not check entries - with 0 addresses. -- Fixed a bug in seg_addr_table(l) in its next_flat_seg1addr() not correctly - stepping over the fixed regions. -- Fixed a bug in seg_addr_table(l) in reporting the correct line in checking - for overlap with fixes regions (the have the same "install_name") so the new - routine search_seg_addr_table_for_fixed() was added. - -Changes for the 5.6 release (the cctools-323 release): -- Fixed a bug in redo_prebinding(1) that did not correctly mark the module with - the shared library initialization routine as linked in cases where the module - was not directly referenced. This could cause the shared library - initialization routine not to be called. Radar bug #2450931. -- Added passing -arch_errors_fatal from libtool(1) to ld(1). -- Changed the check_install_name(l) tool to be check_dylib(l) to preform - a series of checks on a dynamic library as per B&I's request. -- Changed seg_addr_table(1) to not fall back an try to open the install_name - if a -release option was specified. As this is the way B&I intends to use - the tool. Also added the -checkonly option. -- Removed the ifdef's that avoided calling find_dylib_in_root() as the bug - in there that was missing an fts_close() is fixed. - -Changes for the 5.6 release (the cctools-322 release): -- Added ifdef'ed for __SPACE__ and created a macro SYSTEM_LIBRARY in checksyms.c - in preparation for the directory changes. /System/Library changing to - /MacOSX/System. -- Created the check_install_name(l) tool for B&I to check the a dynamic library - is installed in its $(DSTROOT) in its -install_name. - -Changes for the 5.6 release (the cctools-321 release): -- Picked up Chris Kane's changes to checksyms(l) to not check for objcunique - sections. Radar bug #2448096. -- Added overlap checking to seg_addr_table(l) and support for fixed regions. - Currently there are bugs in fts(3) so its used is ifdef'ed out with - ifdef NO_BUGS_IN_FTS which means that the DSTROOT file is searched for but - not the SYMROOT file. - -Changes for the 5.6 release (the cctools-320 release): -- Fixed a bug in libtool to not passing -arch_multiple when fat files are in the - input files to ld when -arch_only is passed to libtool. -- Added the -dylib_file option to libtool. -- Added the -umbrella option to libtool. Radar bug #2443212. - -Changes for the 5.6 release (the cctools-319 release): -- Removed the check for execute bits in a dynamic library in checksyms(l). -- Added the -seg_addr_table option and the LD_SEG_ADDR_TABLE environment - variables as alternate ways to check the address of shared libraries in - checksyms(l). -- Created the seg_addr_table(1) program to layout and update a segment address - table for use when building dynamic libraries. - -Changes for the 5.5 release (the cctools-315 release): -- Removed the installing of the bom file as this has not been used since - NeXTstep 2.1. - -Changes for the 5.5 release (the cctools-314 release): -- Changed where nmedit gets installed from /usr/local/bin to /usr/bin. Radar - bug #2396595. - -Changes for the 5.5 release (the cctools-310 release): -- Added passing the -Sn, -Si, -S, -X flags from libtool to ld. - -Changes for the 5.5 release (the cctools-307 release): -- Added two private options for nm. -b name and -iN to print the N_BINCL symbols - from the 'name' include file starting at index N not printing the file#'s. - This was used to track down differences in stabs. Radar bug #2410704. -- Fixed a bug in nmedit(l) (and strip(1)) that did not process the -arch flags - as arch family flags. Radar bug #2405763. -- Added the the STAB types: N_BNSYM, N_ENSYM, N_BINCL, N_EINCL and N_EXCL to - the table in nm for printing. Radar bug #2410704. -- Added support for the CPU_SUBTYPE_POWERPC_7400 in lipo.c. Radar bug #2397523. - -Changes for the 5.4 release (the cctools-303 release): -- Changed libtool so that the message that about creating a library with an - empty table of contents is calling warning() not error() as it is a warning - message. Also added "define global symbols" to the end of the message "(no - object file members in the library define global symbols)". -- Changed a message in checksyms(l) to use "Build & Integration" and not - "release control". Radar bug #2377929. - -Changes the 5.4 release (the cctools-300 release): -- Fixed a bug in nmedit(1) when using -R and processing more than one - architecture it printed an error stating "more than one symbol" for a symbol - listed in the -R file appeared in the input file. Radar bug #2367598. -- Changed nmedit(l) to strip all arch's when no -arch flags are specified to - match the behavoir of strip(1). Radar bug #2367598. -- Added the "-init " argument to libtool to be passed through to - ld(1) for the dynamic shared library initialization routine symbol - -Changes the 5.4 release (the cctools-296 release): -- Added the -v (verification flag) to checksyms to print out a single line for - each type of error checksyms finds. Also added hacks #ifdef'ed - ALLOW_MACOSX_PR1_PATHS to allow all MacOS X PR1 paths. - -Changes the 5.3 release (the cctools-292 release): -- Added some braces to get rid of the warning message from the egcs compiler - "warning: suggest explicit braces to avoid ambiguous `else'". This was done - to cmpdylib.c . -- Changed the return type of main() in redo_prebinding.c, pagestuff.c, - dylib_pcsampler.c, cmpdylib.c, kern_tool.c, segedit.c, strip.c, indr.c, - checksyms.c, libtool.c, nm.c, strings.c, size.c and lipo.c from void to int to - remove a warning from the egcs compiler. Also changed the exit() calls at the - end to return()'s. - -Changes the 5.3 release (the cctools-290 release): -- Fixed a bug in nmedit in the code that was added to support the -p flag. - -Changes the 5.3 release (the cctools-289 release): -- Added the -p flag to nmedit to change symbols into private externs rather - than static. - -Changes the 5.3 release (the cctools-288 release): -- Changed nmedit(l) to change the indirect symbol table entries for global - symbols it makes static. The indirect symbols are changed to - INDIRECT_SYMBOL_LOCAL or INDIRECT_SYMBOL_ABS. This problem showed up in - using nmedit for the work around with the egcs compiler and C++ RTTI common - data in a dynamic shared library. -- Added passing -whyload through libtool to ld. -- Changed some type and casts to make strip.c compile with the MetroWerks - compiler. -- Changed the message printed when the environment variable RC_TRACE_ARCHIVES - is set from: "RC_TRACE_ARCHIVES archive_name" to: "[Logging for Build & - Integration] Used static archive: archive_name". Radar bug #2310273. - -Changes for the the 5.3 release (the cctools-285 release): -- Fixed a bug in libtool(1) that was not using NEXT_ROOT when set to expand - -l flags. -- Added printing a line like "RC_TRACE_ARCHIVES archive_name", where - archive_name is a archive being put into the output of libtool(1) -static. - This is done when the environment variable RC_TRACE_ARCHIVES is set. - Radar bug #2303376. -- Removed the #ifdef NeXT from atom.c . -- Fixed a bug in ranlib (aka libtool) where when dealing with multiple symbols - defined in the same members, it trys to only print each table of contents - entry once by marking the symbol by changing the sign on the ran_off field. - There were two missing casts on two comparisons because the ran_off is - unsigned. -- Fixed a bug in strip in strip_symtab() where when it was walking the reference - table looking for symbols not yet listed as saved it would added them to the - changes[] array without testing to see it it already added them to the - changes[] array. This happens because a symbol may be referenced by more the - one module in dynamic shared library. This showed up when the CoreGraphics - framework was stripped with the -s option and undefined symbols were not - expicitedly listed. This caused the code in strip to allocate more new - undefined symbols maps than it filled it. The extra maps were garbage and - caused the module table in the CoreGraphics to be updated wrong which caused - the static linker to generate the malformed object error: - ilocalsym field plus nlocalsym field of module table entry 1 past the - end of the symbol table - -Changes for the 5.3 release, MacOS X bring up (the cctools-282 release): -- Added libtool to the Metrowerks source target. -- Changed host_self() and task_self() to mach_host_self() and mach_task_self() - for MacOS X. Also included "stuff/openstep_mach.h" for macros to allow it - to still build on Openstep. Also changed ifdef's __SLICK__ to __OPENSTEP__. -- Ifdef'ed __MACH30__ make.defs for mach_port_t vs mach_port. Also ifdef'ed out - netname_look_up() call and #include for __MACH30__ in - libtool.c (these are not yet in the SDK). -- Changed the Makefile to allow for RC_OS=macos for MacOS X builds. -- Added a few casts in places to get it to compile with the MetroWerks compiler - without -relax_pointers. -- Changed the Makefile to nolonger compile checksyms with -static. When linking - with -static the MetroWerks compiler uses -framework System which is not - leagal with ld(1) and -static. -- Changed arch_flag_processed = FALSE; to arch_flag_processed = NULL; in - translate_input() in indr.c so it would compile with the MetroWerks compiler. - -Changes for the 5.2 release (the cctools-281 release): -- Changed redo_prebinding to exit with a error code of 3 if the dependent - libraries are out of date. Radar bug #2259447. - -Changes for the 5.2 release (the cctools-280 release): -- Changed libtool to pass the -F and -L flags to objcunique. Radar bug #2257931. - -Changes for the 5.2 release (the cctools-276 release): -- The fix in cctools-275 was using the variable "changes" after it was free'ed. - Move the free() past the last use. - -Changes for the 5.2 release (the cctools-275 release): -- Made a fix to strip when stripping a dynamic shared library. If a symbol is - to be stripped and it was defined in a module and also referenced in another - module, it was correctly changed to an undefined symbol but incorrecly left - in the table of contents. Radar bug #2239280. - -Changes for the 5.2 release (the cctools-274 release): -- Added the -R option to nmedit to provide a list of symbols to turn into - static symbols. If -R is specified and no -s is specified all symbols except - those in the -R file are "saved" and not turned into static symbols. - Radar bug #2235926. -- Added the -R option to strip to provide a list of symbols to strip. Also - changed the list of symbols to allow comment lines starting with '#' and to - trim leading and trailing blanks. Radar bug #2235926. -- Removed uses of CPU_SUBTYPE_586SX in lipo.c and added support for the new - intel subtypes. Radar bug #2231830. - -Changes for the 5.2 release (the cctools-271 release): -- Fixed it so libtool -static would not warn about -L and -l flags as these - are valid flags with -static. - -Changes for the 5.2 release (the cctools-269 release): -- Backed off checking libtool -dynamic and -static flags as hard errors to - allow builds to work. - -Changes for the 5.2 release (the cctools-267 release): -- The -b flag for checksyms(l) is now the default to check for prebinding and - read_only_relocs. Radar bug #2227469. -- Fixed a bug in nm(1) with -o that did not print a ':' after the module name - and before the symbol name. Radar bug #2227852. -- Fixed a bug in libtool that incorrectly put -framework flags in ld flags and - not treat it like a file. This caused -l and -framework to get out of order. - Radar bug #2227863. -- Added the core program to test dyld debug intefaces from a core file. This - program is not built as part of the install target. It requires a - libdyld/debug.c compiled with -DCORE. -- Added code to checksyms to allow blank lines in the dylib table. Radar bug - #2227872. -- Added all the suport needed for the 4.4BSD extended format #1 to nm, size, - strip, indr, inout, redo_prebinding, checksyms and lipo. Radar bug #1670513. -- Added the -L and -T flags to libtools and ranlib to support or truncate long - archive names. Added all the suport needed for the 4.4BSD extended format #1 - for long names. The default is now -L (use long names). Radar bug #1670513. -- Make libtool -static treat flags for -dynamic as errors. Also cleaned up - and corrected other flag checking. Radar bug #2227885. - -Changes for the 5.1 release (the cctools-261 release): -- Updated lipo's printing of supported POWERPC subtypes. Radar bug #2213821. -- Fixed a bug in link_library_module() in redo_prebinding.c that did not check - if the symbol found that might be multiply defined was in a module that was - not in the UNLINKED state before saying it was multiply defined. - Radar bug #2213249. - -Changes for the 5.1 release (the cctools-260 release): -- Added -c to all the install commands in the Makefile. -- Added /Local/Library/Frameworks as a conventional path for frameworks. -- Changed "it's" to "its" in checksyms messages. - -Changes for the 5.1 release (the cctools-258 release): -- Changed checksyms to know about /usr/lib/java again. There are two sets of - java dylibs and this path should have not been removed. - -Changes for the 5.1 release (the cctools-257 release): -- Changed checksyms to reflect the new Java paths. Previously was /usr/lib/java - now is /System/Library/Frameworks/JavaVM.framework/Libraries . - -Changes for the 5.1 release (the cctools-256 release): -- Added /usr/lib/java as a conventional path for libraries in checksyms. - Radar bug #2005914. - -Changes for the 5.1 release (the cctools-253 release): -- Made checksyms check prebinding, read-only relocs and objcunique. Currently - enabled only when -b is specified. -- Fixed a bug in checksyms that was not correctly checking for N_FUN stabs. -- Changed the Makefile to only create the needed dst directories. -- Changed checksyms to match the new directory layout for Preimer. - -Changes for the 5.1 release (the cctools-249 release): -- Added the ppc relocation to redo_prebinding. -- Fixed a bug in redo_prebinding in update_load_commands() when an executable - had LC_PREBOUND_DYLIB commands for dylibs that it did not have LC_LOAD_DYLIB - commands (this was run into because of a bug in ld with $NEXT_ROOT set). The - fix is to toss all LC_PREBOUND_DYLIB except the ones that have matching - LC_LOAD_DYLIB commands. -- Changed redo_prebinding and libtool to look for objcunique in /usr/bin rather - in /bin. -- Fixed a bug where nm -n on Rhapsody did not sort correctly. The bug was in - the compare function that was returning 1 or 0 for less and greater when it - should have been 1 or -1. - -Changes for the 5.1 release (the cctools-247 release): -- Fixed a bug in libtool.c in check_sort_ranlibs() where the unsigned value - on lin 1952 was being checked for < 0. A cast to int was added. -- Added MKDIRS if code to the Makefile to build native on Rhapsody. -- Changed the Makefile to use gnutar instead of tar because it works on Rhapsody - where tar does not. -- Changed the Makefile to install non-local binaries in /usr/bin for RC_OS - teflon and in /bin for RC_OS nextstep (Radar 1673496). -- Changed the code ifdef __TEFLON__ to ifndef __SLICK__ (where __TEFLON__ will - nolonger be defined for Rhapsody builds) so the default builds will be native - Rhapsody builds. The changes were to file.c, libtool.c, lipo.c and segedit.c. - -Changes for the 5.0 release (the cctools-245 release): -- Fixed symbolic links from /usr/bin/strip to ../../bin/strip - from /usr/bin/strings to ../../bin/strings - from /usr/bin/size to ../../bin/size - from /usr/bin/nm to ../../bin/nm - (Radar 1672088). - -Changes for the 5.0 release (the cctools-243 release): -- Added symbolic links from /usr/bin/strip to $(DSTROOT)/bin/strip - from /usr/bin/strings to $(DSTROOT)/bin/strings - from /usr/bin/size to $(DSTROOT)/bin/size - from /usr/bin/nm to $(DSTROOT)/bin/nm - (Radar 1672088). - -Changes for the 5.0 release (the cctools-240 release): -- Changed so that atom only gets installed for OS=nextstep because it used the - encumbered . - -Changes for the 5.0 release (the cctools-235 release): -- Added an ifdef(ppc) in four places to atom.c to remove some warnings. -- Replace the comments with the OpenBSD comments in nm.c, size.c and strings.c. -- Removed building ar and file when $(RC_OS) is "teflon". These commands will - are in there own directories one level up based on the OpenBSD versions. - -Changes for the 5.0 release (the cctools-224 release): -- Changed including to which uses unsigned long - instead of off_t (64 bits on Teflon). - -Changes for the 5.0 release (cctools-216 release): -- Changed building checksyms to link staticly. Still does not build in Teflon - as it needs -lc_static which is currently missing. - -Changes for the 5.0 release (cctools-215 release): -- Made a hack in the Makefile to not build checksyms for teflon because it needs - -lsys because RC wants it built to run on 3.3 machines. - -Changes for the 4.2 and 5.0 releases (cctools-213 and cctools-209.4 release): -- Added ignoring -pg to libtool. - -Changes for the 5.0 release (cctools-210 release): -- Changed m98k to ppc. - -Changes for the 4.2 and 4.1 patch releases (cctools-207 release): -- Added -noall_load and -all_load to libtool. The compiler driver with the - option -dynamiclib will call libtool with the -noall_load option by default. - This is to avoid pulling all of libcc_dynamic.a in which can't be done in - all cases as it could produce a undefined reference to __DTOR_LIST__. - -Changes for the 4.0 release (cctools-202 release): -- Changed libtool to ignore -g[gdb,codeview,stab][number] flags (bug #67597). - -Changes for the 4.0 release (cctools-199 release): -- Fixed a problem in redo_prebinding(1) with setting the file's owner and group - introduced in cctools-196 (bug #65646). - -Changes for the 4.0 release (cctools-197 release): -- Added -image_base flag to libtool as synonym for -seg1addr (bug #65273). - -Changes for the 4.0 release (cctools-196 release): -- Fixed a problem in redo_prebinding(1) which was not setting the file's owner - and group (bug #65137). - -Changes for the 4.0 release (cctools-192 release): -- Changed redo_prebinding(1) to only run /bin/objcunique when it redoes the - prebinding. This was causing /bin/objcunique to fail when run on non-Mach-O - files in checking modes (bug #63509). -- Changed redo_prebinding(1) to call chmod(2) to set back the original modes so - setuid and setgid bits get set (bug #63448). - -Changes for the 4.0 release (cctools-188 release): -- Fixed a bug in redo_prebinding where it did not correctly swap the fat files - it created. The call to swap_arch_for_output() was done only once and not - once per architecture in the fat file (bug #62267). -- Fixed a bug in lipo -extract where it would not extract anything except the - first architecture in the fat file (bug #62145). - -Changes for the 4.0 release (cctools-187 release): -- Added a check to checksyms to make sure dynamic libraries have some execute - bits set (bug #61511). -- Fixed a bug in redo_prebinding in the function update_load_commands() when - the load commands had to be rewritten the pointers to the load commands for - the symtab and dysymtab commands needed to be reset (bug #61735). -- Fixed the spelling of "compatibility" (was "compaiblity") in cmpdylib error - message (bug #61697). -- Fixed a bug in redo_prebinding in the function build_new_symbol_table() where - arch_nmodtab * sizeof(struct dylib_module *) + - should have been: - arch_nmodtab * sizeof(struct dylib_module) + - That is the size of the struct not the size of a pointer (bug #61735). -- Changed calling /bin/objcunique to always pass -prebind in redo_prebinding - and libtool (bug #61735). - -Changes for the 4.0 release (cctools-186 release): -- Added passing "-r root_dir" to /bin/objcunique in redo_prebinding. -- Removed the built in table to checksyms and use ~rc/Data/DylibTable by default - (bug #61427). -- Fixed a bug in nm(1) with the undocumented value difference option (-v) which - has to be used with -n and -s. The problem was the test for no selected - symbols needed to be moved to the outer if statement (bug #61341). - -Changes for the 4.0 release (cctools-185 release): -- Added running /bin/objcunique if -prebind or LD_PREBIND is set in libtool - (bug #61230). -- Fixed a bug in checksyms as it parsed out "/usr/lib" before - "/usr/lib/NextPrinter" so it thought the name of the libFaxD library was - "NextPrinter/libFaxD" not "libFaxD" as it should have been (bug #61231). -- Added table entries to checksyms for (bug #61231): - { 0x1f000000, "InterfaceBuilder" }, - { 0x20000000, "AppTest" }, - { 0x21000000, "libRK" }, - { 0x22000000, "libRKC" }, - { 0x23000000, "libcanna" }, -- Added the directory "/usr/canna/dylib" for libRK, libRKC, and libcanna - to checksyms (bug #61231). -- Made a hack to checksyms(l) that allows MH_DYLIB's and MH_FVMLIB's to have - stabs as long as it does not have N_FUN symbols (stabs for functions) - (bug #61231). -- Fixed a bug in redo_prebinding(1) which did not deal with indrect symbols - INDIRECT_SYMBOL_LOCAL which were local symbols that were striped (bug #61232). -- Fixed a bug in redo_prebinding(1) which did not return the correct status - if an input file was mallformed and fatal_arch() was called from checkout() - or breakout(). The fix was to copy in the fatal_arch.c code and change - the exit() call in fatal_arch to switch off check_for_non_prebound (-p) and - exit(0) or exit(2) otherwise (bug #61232). - -Changes for the 4.0 release (cctools-183 release): -- Added the -dylib_table argument to checksyms. -- Changed checksyms to default to arch all if no -arch's are specified. -- Finished the redo_prebinding command and added it to cctools (bug #60110). -- Added an entry in the checksyms table for EOControl at address 0x1e000000. - -Changes for the 4.0 release (cctools-182 release): -- Added an entry in the checksyms table for libFaxD at address 0x1d000000. - Added the directory /usr/lib/NextPrinter/ to be an allowed path. -- Added an entry in the checksyms table for libMallocDebug at address 0. - -Changes for the 4.0 release (cctools-181 release): -- Fixed a typo in the Makefile that made pagestuff from lipo.private.o - (bug #59715). - -Changes for the 4.0 release (cctools-176 release): -- Fixed a bug in checksyms that did not deal with profile suffixed dylibs. - Also added entries in the table for Message and libkeymap (bug #) -- Fixed a bug in strip in stripping objects with prebound undefined symbols - (bug #58405). - -Changes for the 4.0 release (cctools-175 release): -- Changed the Makefile to ld -r builds because private externs were causing - prebinding to fail because of overlap. - -Changes for the 4.0 release (cctools-173 release): -- Added passing -arch_multiple to ld from libtool when running for more than - one architecture. Also always pass -arch flag because even if the objects - are thin dylib1.o maybe fat or of a different architecture. -- Updated strip to know about prebound undefined symbols so it would strip - objects with such symbols correctly. - -Changes for the 4.0 release (cctools-172 release): -- Fixed a bug in nm that was not selecting prebound undefined symbols as - undefined symbols when -u was used. - -Changes for the 4.0 release (cctools-168 release): -- Wrote the program pagestuff to replace pageSymbols. -- Fixed a typo in lipo "architecure" changed to "architecture" (bug #55959). -- Change the version numbers of dynamic library to the form X[.Y[.Z]] to match - how next does versioning of it's projects. This effected libtool(1), ld(1), - otool(1), dyld, libstuff(version_number.c) and man pages for ld and libtool - bug #55627). In here the changes were in libtool.c . - -Changes for the 4.0 PR1 release (the cctools-166.9 and cctools-168 releases): -- Checksyms by default should have been non-verbose. The errors messages in - check_dylib() should have only been produced when the -d (detail) flag was - on (bug #55648). - -Changes for the 4.0 PR1 release (the cctools-166.8 and cctools-168 releases): -- Updated checksyms to know about NIInterface, EOAccess, EOInterface, NeXTApps - and NIAccess. As well as changed the /LocalLibrary/Frameworks/ path to - /NextLibrary/PrivateFrameworks/ (bug #55414). Also now build this -static. -- Fixed bug #55337 in libtool(1) that parsed -read_only_relocs as - -read-only-relocs. -- Fixed bug #55334 in checksyms(l) which did not check for the Versions - directory correctly because of a copy and paste error. Also all dylib errors - are now fatal. - -Changes for the 4.0 release (cctools-167 release): -- Fixed bug #53766 in file(1) which incorrectly reported some fat files - malformed. The bug was in type_buf() where it was looping the load commands - checking for non-stripped and the test to end the loop if looking past the - end of the buffer was in the wrong place. This caused the varaible ifile to - get trashed when the symbol_table command was swapped and then the reads on - that file descriptor failed. - -Changes for the 4.0 PR1 release (the cctools-166.1 and cctools-167 releases): -- Fixed a bug in libtool for creating static libraries that did not set the - toc time and mod time based on the time of the file system that the library - was created on. To do this it involved changing create_library() to record - where the ar_date's of the toc archive headers were and rewriting them after - the file was closed when it is first created using the mod time from the file - system (bug #52612). - -Changes for the 4.0 release (the cctools-165 release): -- Added passing -read-only-relocs through from libtool to ld. - -Changes for the 4.0 release (the cctools-164 release): -- Fixed a bug in nm when -o is used on a dynamic library it did not print the - name of the module on the line. - -Changes for the 4.0 release (the cctools-161 release): -- Added an undocumented -v flag to nm(1) to be used with -n and -s to print the - difference of the values of symbols. -- Changed Foundation's address in checksyms to 0x18000000. - -Changes for the 4.0 release (the cctools-160 release): -- Update checksyms for dylib checking: - checks names for these forms: - /NextLibrary/Frameworks/AppKit.framework/Versions/A/Appkit - /LocalLibrary/Frameworks/AppKit.framework/Versions/A/Appkit - /lib/libsys_s.A.dylib - checks for correct addresses - checks for compatibility and current version being set - Currently the error condition is commented out but the checking and printing - of the error is done. This is waiting on the corresponding changes in the - app Makefiles. - -Changes for the 4.0 release (the cctools-158 release): -- Changed the spelling of dynamicly to dynamically in file(1) (bug #51635). - -Changes for the 4.0 release (the cctools-156 release): -- Fixed a bug in indr introduced by fixing the bug in stripping objects compiled - with -dynamic. The indr code did not deal with -dynamic objects either and - had to be updated with what writeout() was doing when it had an object with - a dynamic symbol table command. - -Changes for the 4.0 release (the cctools-154 release): -- Fixed a bug in checksyms that did not ignore non-object files. The call to - ofile_process() had process_non_objects FALSE when it should have been TRUE. -- To fixed a bug in stripping .o files compiled dynamic. The test in - strip_object() needed to be changed to based on if there was a dynamic symbol - table command in the object not on if it had MH_DYLDLINK in the mach header. - Then the starting offset of the link edit info need to be based on the lowest - offset if there wasn't a seg link edit command. Also a change was made in - libstuff's writeout.c -- Wrote a first cut at cmpdylib that compares global symbols and version - numbers. -- Added support for stripping defined externals that appear as indirect symbol - table entries in non-lazy pointer sections. Strip uses the values - INDIRECT_SYMBOL_LOCAL and INDIRECT_SYMBOL_ABS to represent the symbols that - are defined that were stripped. The static link editor marks defined external - symbols in the n_desc field with REFERENCED_DYNAMICALLY and the new -r flag - saves these symbols. For executables that use the dynamic linker and are - stripped with no options the default is the same as -u -r. - saves these symbols. For executables that use the dynamic linker -- Picked up kern_tool. -- Added to nm(1) printing of [referenced dynamically] for REFERENCED_DYNAMICALLY - marked external symbols with -m. - -Changes for the 4.0 release (the cctools-152 release): -- Fixed a problem with indr for dylibs with symbols listed in the indr list - that are undefined in the library. In this case the undefined symbol does - not get it's name changed to include an '_'. -- Added -arch_only to libtool. - -Changes for the 4.0 release (the cctools-150 release): -- Added the -i option to strip(1) to ignore symbols in the -s file that are not - in the objects being stripped. -- Added -arch_indr to indr(l). -- Added passing -F and -framework ld(1) options through for libtool -dynamic. -- Changed how libtool -dynamic handles dependent dynamic shared libraries and - does not use the architectures contained in them to determine which - architectures are part of output. -- Changed checksyms to allow non-stab symbols in MH_DYLDLINK files. - -Changes for the 4.0 release (the cctools-149 release): -- Added passing the -filelist list[,dirname] option through to ld (bug #50779). - -Changes for the 4.0 release (the cctools-148 release): -- Added -extract_family to lipo to extract all architectures in that family. - It creates a thin or fat file (bug #47499). -- Removed the hack in checksyms to not check dylinker files now that the - dynamic linker can be installed stripped. - -Changes for the 4.0 release (the cctools-147 release): -- Fixed a bug strip -x -S when a private extern was present it was not treated - as a global. This worked with -x but not with both -S and -x. -- Fixed a bug in nm that did not print dylibs symbol tables of the a different - byte sex correctly. select_symbols() was causing double swapping if called - more than once. - -Changes for the 4.0 release (the cctools-146 release): -- Fixed a problem with the bug fix in strip that did not update relocation - entries correctly if there are paired relocation entries. The bug fix did - not acount for the relocation entry being a scattered relocation entry. This - problem was also in indr. - -Changes for the 4.0 release (the cctools-145 release): -- Fixed bugs in size, strings and checksyms when the dylib "flat" argument was - added it was switch. -- Fixed a bug in strip when striping a dylib and a defined symbol is being - stripped and changed into an undefined symbol the undefined symbols were not - sorted by name. -- Fixed a TODO in strip when attempting to strip a private extern symbol in a - dylib that had reference table entries to it. This is treated as an error as - the static link editor relocated to these symbols and they can't be stripped. -- Added support in indr(l) for dylibs. -- Fixed a bug in strip that did not update relocation entries correctly if there - are paired relocation entries. - -Changes for the 4.0 release (the cctools-143 release): -- Added support in nm for printing the symbols of dylib modules and a -f (flat) - switch for getting symbols as one Mach-O file. -- Added passing the "-U symbol", "-i_defined:_indr", "-undefined warning" flags - through libtool to ld. Also allowed no files if flags for sections from files - or indirect symbols are present. - -Changes for the 4.0 release (the cctools-141 release): -- Added the ld flag -no_arch_warnings for libtool -dynamic which prevents - warnings for files which don't have the correct architecture for the -arch - flag. -- Fixed the spelling of "compatibility" in the compatibility_version for dylibs. - -Changes for the 4.0 release (the cctools-140 release): -- Added MH_BUNDLE to file(1). - -Changes for the 4.0 release (the cctools-136 release): -- Fixed a bug in strip where with no options on dyld causes it to core dump. - The change was to strip_object() in the case of no options if the input file - has dynamic symbol table and local relocation entries keep those relocation - entries on output. - -Changes for the 4.0 release (the cctools-134 release): -- Fixed a bug in strip that showed up when striping a 3.2 object that did not - have the symbols in the 3.3 order. The problem was the relocation entries - did not get updated correctly because the saves[] array was not updated with - the output symbol index after the symbols were ordered. -- Fixed a bug in strip that did not update N_INDR symbols correctly because it - did not account for the string of the indirect symbol indexed by n_value. - This bug was introduced in cctools-127 when strip was changed to handle - objects with the dynamic symbol table information. So it is not in the - cctool-119 strip that is in the 3.2hp release (bug #44817). - -Changes for the 4.0 release (the cctools-133 release): -- Fixed Makefile to do the mig stuff for libtool in a read-only SRCROOT. -- Fixed a problem in strip for cross byte sex striping when the dynamic - symbol table info is present. In strip.c the problem was the new symbolic - tables were not swapped to the target byte sex. And in writeout.c in libstuff - the problem was that parts of the headers were used after they were swapped. - -Changes for the 4.0 release (the cctools-132 release): -- Made libtool(1) with -dynamic ProjectBuilder aware and send it doing - messages (part of bug #40745). - -Changes for the 4.0 release (the cctools-131 release): -- Changed strip to treat non-external private externs as global symbols and - save them with -x or in the -s list file. -- Added "(was a private external)" to nm -m's printing non-external private - externs. - -Changes for the 3.3 release (the cctools-129 release): -- Fixed a bug in strip where it was free()'ing the new_* data structures it - created. - -Changes for the 3.3 release (the cctools-128 release): -- Fixed a bug strip in strip_object() where it was using object->dyst->nextrel - without checking that object->dyst could be NULL. - -Changes for the 3.3 release (the cctools-127 release): -- Major changes to strip.c to allow it to operate on objects with the dynamic - symbol table layouts. strip(1) now operates on MH_DYLIB files. -- nmedit(l) works with objects with the dynamic symbol table layouts but does - not re-group globals turned into statics with local symbols. It also does - not operate on MH_DYLIB files. -- Fixed checksyms -r to not exit non-zero if there are no stabs. - -Changes for the 3.3 release (the cctools-126 release): -- Changed strip -s when processing an archive report errors in symbols - not in for each member but rather for the whole archive. - -Changes for the 3.3 release (the cctools-125 release): -- Added -force_cpusubtype_ALL for libtool's -dynamic execution of ld(1). - -Changes for the 3.3 release (the cctools-124 release): -- Added a temporary hack to checksyms(1) to not check MH_DYLINKER files. -- Added a temporary error message in segedit.c: "current limitation, can't - process files with LC_DYSYMTAB load command". -- Added a temporary error message in libstuff to check_object() in checkout.c - to print the error "current limitation, can't process files with LC_DYSYMTAB - load command" so that strip(1), nmedit(1) and indr(l) for now print a - reasonable message when such a file is used. -- Added -dynamic to libtool to allow building dynamic shared libraries. - -Changes for the 3.3 release (the cctools-119 release): -- Picked up the changes for lipo with respect to the sparc target. - -Changes for the 3.3 release (the cctools-118 release): -- Fixed a bug that crashed strip when doing a strip -S on a library and a member - had no symbol table command. The bug was in writeout.c in libstuff at line - 490 where it indirected thought the pointer to the symbol table command - without checking if it was NULL. - -Changes for the 3.3 release (the cctools-116 release): -- Fixed a bug in nmedit that cleared the N_EXT bit from N_INDR symbols which it - shouldn't have. - -Changes for the 3.3 release (the cctools-115 release): -- Fixed a bug in lipo(1) that did not preserve set uid, set gid and sticky text - file premision bits (bug #40266). - -Changes for the 3.3 release (the cctools-109 release): -- Fixed a bug in strip(1) when multiple files were listed to strip it would - fail with "can't create output file:**** (File exists)" where **** was blank - or it cored dumped. This was because the variable output_file was not - correcly reset to NULL after it was free'ed. The fix was to move the - free(output_file) into the else clause that also did the makestr() call and - also set output_file to NULL after the free(). This is in strip.c in - strip_file() at the end of the routine. - -Changes for the 3.3 release (the cctools-102 release): -- Integrated in the hppa support. -different misc/lipo.c (integrated for cctools-102) - Using cctoolshppa-37. Has hppa cpu stuff in it. -different misc/nm.c (integrated for cctools-102) - Using cctoolshppa-37. Only comment typo change. - -Changes for the 3.3 release (the cctools-100 release): -- First major round of changes for the new shlib stuff. - 1) In nm support for .private_extern directive with -m to print - "private external". -- Fixed a bug where strip with the -S and -x ignored -x (bug #36206) -- Added the "-o output" option to strip (bug #36252) - -Changes for the 3.1 release (the cctools-22 release): -- Changed file to print out architecture for Mach-O file that were not fat and - changed lipo -i to print architectures on one line (bug #31882). -- Added printing for these (bug #32553): - { "any", CPU_TYPE_ANY, CPU_SUBTYPE_MULTIPLE }, - { "little", CPU_TYPE_ANY, CPU_SUBTYPE_LITTLE_ENDIAN }, - { "big", CPU_TYPE_ANY, CPU_SUBTYPE_BIG_ENDIAN }, - -Changes for the 3.1 release (the cctools-21 release): -- Changed in lipo when "-arch i386 a.out" was used by the compiler and a.out - turns out to be an i486 subtype lipo treated this as a hard error. A safe - fix to this was made to remove the cpusubtype compare in check_arch() which - matches what it does for archives. - -Changes for the 3.1 release (the cctools-20 release): -- Put back -O in the Makefile (previously was removed because of m88k builds -O - could't be used on lipo.c because of a bug, this is now a non-issue). -- Added cross bytesex support for segedit(1) (still no fat support). - -Changes for the 3.1 release (the cctools-17 release): -- Change made to strip to only generate a warning message when it encounters a - non-object file an not stop processing other files (bug #23144). - -Changes for the 3.1 release (the cctools-16 release): -- Fixed a bug in libtool when stat_buf.st_gid is a negitive value it was casted - to an unsigned int and sprintf()'ed with %o into a field that was expected to - have only enough characters for a short (not a sign extended short). The fix - was to cast to a unsigned short (bug #30995). - -Changes for the 3.1 release (the cctools-14 release): -- Removed the archive checking of subtype in check_archive() for lipo. - -Changes for the 3.1 release (the cctools-13 release): -- Added the m98k (PowerPC) architecture (lipo only change). - -Changes for the 3.1 release (the cctools-10 release): -- Changed the way the date is set on the output file when creating the output - file with -c to only set the it to the oldest input date when an input file - has an archive in it. -- Changed the handling of the cpusubtypes to support this design: - The design allows each architecture family (m68k, m88k, i386) to have a - cpusubtype that will run on all implementations of that architecture and - have cpusubtypes that will run only on specific implementations of an - architecture. The design also gives the programmer the option to force the - cpusubtype indicating all implementations (at build time with a flag) when - using instructions that are implementation specific leaving it up to the - program to runtime select the correct code to execute. - The library creation tools (libtool and ranlib) operation in this design: - When a library creation tool creates libraries objects of the same - cputype and differing cpusubtypes it will create at most one library for - each cputype and not a separate library in a fat file for each of the unique - cputype and cpusubtype pairs. The resulting cpusubtype for each library - will be the _ALL cpusubtype for that cputype. The goal is the library - implementor should be strongly encouraged to create one library that - chooses optimum code to run at run time rather than at link time. - -Changes for the 3.1 release (the cctools-9 release): -- Added to lipo when the -info or -detailed_info is specified printing of - architecture type for non-fat files (bug #29465). - -Changes for the 3.1 release (the cctools-8 release): -- Changed the default for strip when no -arch flag is present to strip all - archs (demanded by the NRW group). -- Removed ebadexec as the OS group has taken it over. -- Changed the checking in add_member() to only look at the cputype and not at - both the cputype and cpusubtype (this will change as the correct handling of - the cpusubtype is implemented). - -Changes for the 3.1 release (the cctools-6 release): -- Moved segedit(1) from misc3.0 directory to here (misc) and added error - recognition for fat files and cross bytesex Mach-O files (and cleaned up - -Wall warning messages). -- Moved ebadexec(1) from misc3.0 directory to here (misc) and added error - recognition for fat files (and cleaned up -Wall warning messages). -- Moved atom(1) from misc3.0 directory to here (misc) and cleaned up -Wall - warning messages. -- Moved ar(1) from misc3.0 directory to here (misc) and added error recognition - for fat files (and cleaned up -Wall warning messages). -- Added fat and cross bytesex support for file(1). -- Fixed a bug in strip(l) that did not round the size of the string table to - a multiple of 4 bytes. This caused the object file to have odd sizes in some - cases and produce trashed archives. - -Changes for the 3.1 release (the cctools-5 release): -- Created a new version of indr(l), strip(1) and nmedit(l) that handles fat - files and cross byte sex. The new strip(1) handles libraries and does not - treat already stripped objects as errors. -- Fixed a bug in libtool/ranlib that caused it to create the library even when - there were errors. This is no longer done. If there is an error then the - library is not created (or the table of contents is not recreated). -- Fixed a bug that caused problems in ranlib when an archive with a that - contained both fat objects with multiple archives and non-object files was - given as input. The "correct" thing to do in this case in not known (which - architecture archive the non-object file is to reside in in the output). So - this case is flagged as an error. - -Changes for the 3.1 release (the cctools-4 release): -- Changed the arch name of ix86 to i386 in lipo.c -- Fixed a bug in libtool that caused it to crash when sprintf() was used and - placed it's trailing '\0' past the end of the buffer. - -Changes for the 3.1 release (the cctools-3 release): -- Changed CPU_TYPE_I80x86 to CPU_TYPE_I386 in lipo.c - -Changes for the 3.0 release (the -56 compiler release): -- Changed print_argstrings() in otool.c to handle a core files that have more - than just one '\0' after the long 0 on the top of the stack (bug #19645). - -Changes for the 3.0 release (the -52 compiler release): -- Added LC_PREPAGE. Just the string "LC_PREPAGE" and the cmdsize printed in - otool. -- Fixed a bug where libtool was not setting the S_IFREG bits in the toc_mode. - -Changes for the 3.0 release (the -53 compiler release): -- Changed STACK_ADDR to USRSTACK from . - -Changes for the 3.0 release (the -51 compiler release): -- Changed otool to print the m88k thread flavors for te new thread_status.h. -- Changed otool when looping through archives so not to complain when getting - a short read on an archive header when an archive was passed to 4 bytes and - the extra 2 bytes of padding was read as an archive header. - -Changes for the 3.0 release (the -50 compiler release): -- Changed the instructions f[sd]sqrtx for operands FPm,FPn and FPm to f[sd]sqrt - (without the trailing 'x'). This was just wrong (but the moto opcode is - inconsistant with all others in this case). -- Added an nm(1) that knows about fat files. - -Changes for the 3.0 release (the -49 compiler release): -- Changed where the 3.1 tools get installed, they now get installed in - /usr/local/bin3.1 with there usual names (no 3.1 suffix). -- Fixed the printing of operands for the i860 to use external relocation - entries correctly. -- Added the LC_FVMFILE to otool. -- Changed the Makefile to meet the RC api. -- Set this directory up for the 3.1 release (fat tools and 88k and ix86 tools). +To Do: +- Add the -prebind_allow_overlap and -prebind_all_two_level_modules to libtool + see Radar bug 3417137. +- Change to Doug's approach to relayout, namely something like reserving the + last 10% of the load region for new dylibs and then evenly spacing the + existing dylibs in the other 90% (for split libs). See email of 11/6/2000. +- Have cmpdylib check Objc info Tracker bug #78124. +- Fix a bug in strip on line 1105 where it uses missing_reloc_symbols when it + could have been set otherwise and does not print the next line. +- Maybe add fat support for segedit(1) + +Changes for the 5.33 release (the cctools-845 release): +- Changed strip(1) to use libc++ instead of libstdc++ . Radar bug #13470497. + +Changes for the 5.33 release (the cctools-842 release): +- Changed lipo(1) to use a temporary file for its output and do a final + rename(2) to make it atomically create the output file. The changes were + in create_fat() in lipo.c . Radar bug #13045167. +- Fixed a bug in install_name_tool(1) when more than one -add_rpath options are + used. Radar bug #13012481. +- Changed lipo(1) so it uses 16k pages for ARM binaries. Radar bug #13080176. + +Changes for the 5.33 release (the cctools-840 release): +- Added support for new archs: armv6m / armv7m / armv7em and updated lipo.c . + Radar bug #11314463. +- Tried to changed to use libc++ instead of libstdc++ but libprunetrie.a needs + to be changed first. For now this is line in the Makefile: + #CXXLIB = -stdlib=libc++ + is commented out which is the needed change. Radar bug #12624622. + +Changes for the 5.33 release (the cctools-839 release): +- Changed the Makefile so that strip(1)'s use of and + libprunetrie.a so that it comes from DT_TOOLCHAIN_DIR. Radar bug #12296255. + +Changes for the 5.32 release (the cctools-835 release): +- Fixed a bug in strip(1) when the input was a .o file containg + LC_FUNCTION_STARTS load command. The code in get_starting_syminfo_offset() in + strip.c did not look for the load command which can be the start of the + symbolic offset in the file. Radar bug #11913911. + +Changes for the 5.32 release (the cctools-833 release): +- Changed strip(1) to always use ld -r on ARM .o files to rename thumb symbols + so they don't get stripped. Radar bug #11795809. + +Changes for the 5.32 release (the cctools-830 release): +- Fixed a bug in nmedit(1) when the input was a .o file containg a + LC_DATA_IN_CODE load command. The code in get_starting_syminfo_offset() in + strip.c did not look for the load command which can be the start of the + symbolic offset in the file. Radar bug #11554503. +- Fixed a bug in libtool(1) when run as ranlib(1) to not update the table of + contents if the input archive's table of content's member name is not using + the extended long name format and we create an table of contents with a + extended long name format (or vice a versa). Radar bug #10399314. + +Changes for the 5.31 release (the cctools-827 release): +- Added #ifdef guards for LTO_SUPPORT in lipo.c . Radar bug #11296366. + +Changes for the 5.31 release (the cctools-825 release): +- Fixed the full strip case with -no_uuid that was not stripping the LC_UUID + load command. A call to strip_LC_UUID_commands() was added to strip_object() + in strip.c for the full strip case. Radar bug #11136733. + +Changes for the 5.31 release (the cctools-824 release): +- Removed the creation of the link to /usr/local/bin/nmedit from + $(DSTROOT)$(LOCBINDIR)/nmedit in the Makefile. Radar bug #10688477. +- Fixed a bunch of places in libtool(1) that was using 32-bit variables to hold + offsets and sizes. Radar bug #10645295. + +Changes for the 5.30 release (the cctools-822 release): +- The "low risk fix to strip(1)" below in cctools-821 for Radar bug #10718585 + breaks striping .o files with dwarf debug info. Because the input file has + an "ld -r" run on it so it is not the original input file. That change has + been backed out. +- The correct fix for strip(1) in dealing with code signed binaries is to + added up the sizes of the output and input parts in the right order. So the + code in strip_object() has been updated to do this. Radar bug #10709632. + +Changes for the 5.30 release (the cctools-821 release): +- Made a low risk fix to strip(1) to fix bugs when stripping objects with + code signature data. The problem is that the code in strip_object() that is + calculating object->input_sym_info_size is incorrect as it is not adding the + elements up in their order and rounding the size for elements that are aligned + like the code signature info. So as a low risk fix code was added in + dyld_order() in checkout.c in libstuff that records the size of the symbolic + information. Then in strip_object() it simply overwrites the previously + incorrectly calculated value for object->input_sym_info_size with that. + Radar bug #10718585. +- Fixed a bug in codesign_allocate(1) that was incorrectly using the value of + sizeof(struct mach_header) for a 64-bit binary when testing if there was + enough room to add the load command. Radar bug #10652697. +- Updated the code in pagestuff(1) to have parts for the dyld info and correctly + handle dylib stubs who's section contents do not appear in the binary. + +Changes for the 5.30 release (the cctools-820 release): +- Removed the use of vers_string(1) from the Makefile. Radar bug #10596469. + - Updated libtool.c to print "Apple Inc." not "Apple Computer, Inc." and the + comment where apple_version[] comes from. + - Added a reference to apple_version[] in checksyms.c, cmpdylib.c, lipo.c, + size.c, strings.c, nm.c, redo_prebinding.c, seg_addr_table.c, check_dylib.c + codesign_allocate.c, ctf_insert.c, seg_hack.c, install_name_tool.c, indr.c, + strip.c and pagestuff.c. + +Changes for the 5.30 release (the cctools-818 release): +- Fixed strip(1) to account for the size of the function starts data when the + binary does not have a dynamic symbol table command. It should have + conditionalized on having a dynamic symbol table command but just the load + command that has the data. Radar bug #10506809. + +Changes for the 5.30 release (the cctools-816 release): +- Changed ctf_insert(1) to allow a static binary with a dynamic symbol table + load command that has local relocation entries. Radar bug #10405248. + +Changes for the 5.30 release (the cctools-815 release): +- Added the os_tools_install target in the Makefile that only builds lipo(1) + and strings(1). Radar bug #10391158. + +Changes for the 5.30 release (the cctools-814 release): +- Changed strip(1) to use "ld -r" on 32-bit objects now that the blocking + bug in ld(1) is fixed. Radar bug #7076828. +- Added support for new load commands LC_MAIN, LC_DATA_IN_CODE, + LC_SOURCE_VERSION and LC_DYLIB_CODE_SIGN_DRS. + - Updated install_name_tool.c, pagestuff.c, redo_prebinding.c, strip.c, + codesign_allocate.c, ctf_insert.c, indr.c and inout.c . + Radar bug #10290817. +- Fixed ctf_insert(1) to correctly handle the LC_FUNCTION_STARTS load command + and update it and move its data. Radar bug #10171548. + +Changes for the 5.30 release (the cctools-811 release): +- Changed the Makefile setting CXX to use c++ not g++. Radar bug #10057952. + +Changes for the 5.30 release (the cctools-809 release): +- Changed lipo(1) to determine the architecture of bitcode files, including + as archive members. Radar bug #9087924. + +Changes for the 5.30 release (the cctools-808 release): +- Fixed a bug in create_library() in the loop that adjusted the ranlib structs + ran_off was using the incorrect index value for: + archs[0].toc_ranlibs[i].ran_off = archs[0].members[i].input_member_offset; + which should have been: + archs[0].toc_ranlibs[i].ran_off = archs[0].members[j].input_member_offset; + Radar bug #9830754. + +Changes for the 5.29 release (the cctools-805 release): +- Changed create_library() in libtool.c to check the new ofile bad_toc field + and cause it to create a new library when this happens. Radar bug #9475790. + +Changes for the 5.29 release (the cctools-803 release): +- Changed libtool.c when running as ranlib(1) to attempt to update the table + of contents in place for the common case for thin archives. And removed the + the time stamp checking for the "nop" ranlib case, which now ends up with just + "touching" the file and adjusting the timestamps. Radar bug #9354605. + - Factored out existing code into new routines get_target_byte_sex() and + put_toc_member(). + - Changed process() and removed the time stamp checking for the "nop" ranlib + case. + - Added the input_member_offset field to the struct member and added code to + set its value in add_member(). + - Changed create_library() to take an ofile which is non-NULL if run as + ranlib(1) and a thin archive. + - Added code in create_library() to update the table of contents in place. + And code to only "touch", write the SARMAG, if the table of contents is + the same. This code has to use the input_member_offset in cases that the + thin input archive would not be same as produced by libtool(1) but still + has member offsets at acceptable alignments. + +Changes for the 5.29 release (the cctools-802 release): +- Fixed a problem with the change to libtool(1) for Radar bug #9354501. It was + not setting toc_uptodate to TRUE and was not doing this only when + cmd_flags.ranlib == TRUE. Radar bug #9418154. + +Changes for the 5.29 release (the cctools-801 release): +- Changed process() in libtool.c to check that the table of contents was up to + date based on the file's time stamp and the table of contents time stamp for + archive files. Then if it ranlib(1) being run do nothing if it is up to date. + Radar bug #9354501. +- Fixed a bug in the error handling of pagestuff(1) when used with the -arch + argument but missing an argument for which page. Radar bug #8979851. + +Changes for the 5.29 release (the cctools-800.3 release): +- Added support for armv7[fsk] to print_arch() in lipo.c . Radar bug #8987684. + +Changes for the 5.28 release (the cctools-798 release): +- Added this line to the Makefile: + CXX = $(shell xcrun -find -sdk $(SDKROOT) g++) + so that it uses the appropriate tool to link device-side code. Radar bug + #8684965. + +Changes for the 5.28 release (the cctools-797 release): +- Added support for LC_DYLD_ENVIRONMENT in segedit.c . Radar bug #8653976. + +Changes for the 5.28 release (the cctools-796 release): +- Added checks in strings(1) to better protect against crashes if it is handed + a malformed file. Radar bug #8599283. +- Added the -arch option to pagestuff(1). Radar bug #8379048. + +Changes for the 5.28 release (the cctools-795 release): +- Changed ctf_insert(1) to allow the LC_FUNCTION_STARTS load command. The + change was in ctf_insert() in ctf_insert.c to remove the test for + object->func_starts_info_cmd != NULL . Radar bug #8490836. + +Changes for the 5.28 release (the cctools-793 release): +- Fixed a problem in nm(1) not checking that a symbol is not undefined before + checking that is a [symbol resolver] symbol. Radar bug #8429570. + +Changes for the 5.28 release (the cctools-792 release): +- Fixed more problems with incorrect support for LC_FUNCTION_STARTS. There were + missing output_func_start_info_data and output_func_start_info_data_size + fields in the struct object that should have been used. Updated the code in + codesign_allocate.c, indr.c, inout.c, install_name_tool.c, redo_prebinding.c + and strip.c which was incorrectly using output_split_info_data and + output_split_info_data_size two use the new fields. Radar bug #8401082. + +Changes for the 5.28 release (the cctools-790 release): +- Fixed problems with the incorrect support for LC_FUNCTION_STARTS. Radar bug + #8274584. + - Updated setup_code_signature() and setup_code_signature() in + codesign_allocate.c . + - Updated ctf_insert() in ctf_insert.c to treat objects with function starts + info as an error and not allowed for static binaries. + - Updated translate_dylib() in indr.c . + - Updated setup_object_symbolic_info() in inout.c . + - Updated setup_object_symbolic_info() and update_load_commands() in + install_name_tool.c . + - Updated build_new_symbol_table() in and update_load_commands() in + redo_prebinding.c . + - Updated strip_object(), strip_LC_UUID_commands() and + strip_LC_CODE_SIGNATURE_commands() in strip.c + +Changes for the 5.28 release (the cctools-787 release): +- Changed libtool(1) and added testing the environment variable ZERO_AR_DATE to + set the ar date to zero to allow testing and comparing things for exact binary + equality. Radar bug #7919021. +- Changed lipo(1) to attempt to stop a crash if the file can't be paged in after + it has been successfully mapped. Added a second fstat(2) call in + process_input_file(1) just before the first bytes of the mapped file are + referenced, and then checked that it has the same size and mod time of the + first stat. Radar bug #8087586. +- Added support in nm(1) for symbols marked with N_SYMBOL_RESOLVER so that they + are printed with [symbol resolver]. This change is in print_mach_symbols() + in nm.c . Radar bug #7901954. + +Changes for the 5.28 release (the cctools-784 release): +- Fixed the -arch_only flag in libtool(1) for arm so that each subtype is + treated as separate architecture. Radar bug #7864127. + +Changes for the 5.28 release (the cctools-782 release): +- Added the -U option to nm(1) to not print undefined symbols. Radar bug + #7761111. +- Changed nm(1)'s -m printing to support 'weak symbol automatically hidden' in + print_mach_symbols() in nm.c. Radar bug #5021217. + +Changes for the 5.28 release (the cctools-781 release): +- Changed codesign_allocate(1) to allow it to be used on any Mach-O file. + Radar bug #7689781. +- Added the program ctf_insert(1) to add a (__CTF,__ctf) section to a statically + linked Mach-O file. Radar bug #7016839. +- Added support for LC_LOAD_UPWARD_DYLIB in update_load_commands() in + install_name_tool.c, in nm() in nm.c and in replace_sections() in segedit.c . + Radar bug #7659206. + +Changes for the 5.28 release (the cctools-780 release): +- Changed trunc() to trnc() in libtool.c and removed -fno-builtin-trunc from the + Makefile. +- Improved the error checking in the redo_prebinding code so that + contents_pointer_for_vmaddr() checks to make sure the pointer is not in the + object's headers or link edit information. Radar bug #6081358. + +Changes for the 5.28 release (the cctools-779 release): +- Fixed bugs in install_name_tool.c in parsing -change and -rpath. Radar bug + #7477104. + +Changes for the 5.28 release (the cctools-777 release): +- Changed round() to rnd() and stuff/round.h to stuff/rnd.h in all files and + removed -fno-builtin-round from the Makefile. Radar bug #7475139. +- Changed the Makefile to use -Os for OFLAG. Radar bug #7475093. +- Change contents_pointer_for_vmaddr() in redo_prebinding.c to ignore segments + with a zero vmaddr since these are unmapped segments. Radar bug #7467115. + +Changes for the 5.28 release (the cctools-776 release): +- Improved the error checking in the redo_prebinding code so that + contents_pointer_for_vmaddr() checks to make sure the pointer is in the + section's contents of the segment. Checks also added to libstuff's + check_Mach_O() in ofile.c to make sure that sections are contained in + their segments. Radar bug #6081358. + +Changes for the 5.27 release (the cctools-773 release): +- Fixed a typo in two lipo(1) error messages where "it's" should have been + "its". Radar bug 7362293. + +Changes for the 5.27 release (the cctools-772 release): +- Fixed a bug in lipo(1) with the -extract option in main() in the loop that + was removing those thin files not marked for extraction where the inner loop + was looping once to many times. Radar bug #7255585. + +Changes for the 5.27 release (the cctools-768 release): +- Fixed a bug in checksyms() that was not verifying read-only-relocs in 64-bit + binaries. The routine check_dynamic_binary() had a typo where LC_SEGMENT + should have been LC_SEGMENT_64. Also changed checksyms() to not call + check_dynamic_binary() if the filetype is MH_KEXT_BUNDLE. Radar bug #7236271. + +Changes for the 5.27 release (the cctools-762 release): +- Changed the Makefile to set CC when when SDKROOT is set. Radar bug #7078805. + +Changes for the 5.27 release (the cctools-760 release): +- Changed the lipo(1) so the the armv7 stuff is a no longer diff --git a/cctools/otool/Makefile b/cctools/otool/Makefile dissimilarity index 61% index 612b907..90b0528 100644 --- a/cctools/otool/Makefile +++ b/cctools/otool/Makefile @@ -1,170 +1,86 @@ -RC_OS = macos -export USE_APPLE_PB_SUPPORT = all -OFLAG = -Os -LEGACY = -D_MACH_I386_THREAD_STATUS_FPSTATE_LEGACY_FIELD_NAMES_ \ - -D_ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_ -X_CFLAGS = - -ifeq "macos" "$(RC_OS)" - STATIC := $(shell if [ "$(RC_RELEASE)" = "Beaker" ] || \ - [ "$(RC_RELEASE)" = "Bunsen" ] || \ - [ "$(RC_RELEASE)" = "Gonzo" ] || \ - [ "$(RC_RELEASE)" = "Kodiak" ] || \ - [ "$(RC_RELEASE)" = "Cheetah" ] || \ - [ "$(RC_RELEASE)" = "Puma" ] || \ - [ "$(RC_RELEASE)" = "Jaguar" ] || \ - [ "$(RC_RELEASE)" = "Panther" ] || \ - [ "$(RC_RELEASE)" = "MuonPrime" ] || \ - [ "$(RC_RELEASE)" = "MuonSeed" ] || \ - [ "$(RC_RELEASE)" = "SUPanWheat" ]; then \ - echo "-static" ; \ - else if [ "$(RC_RELEASE)" = "Tiger" ]; then \ - echo "-static" ; \ - else \ - echo "" ; \ - fi; fi; ) -else - STATIC = -static -endif - -ifeq "$(EFITOOLS)" "efitools" - EFI_SUPPORT = -DEFI_SUPPORT -endif - -ifneq "" "$(SDKROOT)" - SDK = -isysroot $(SDKROOT) - CC = $(shell xcrun -find -sdk $(SDKROOT) cc) - CXX = $(shell xcrun -find -sdk $(SDKROOT) c++) -endif - -ifeq "clang" "$(notdir $(CC))" - CFLAGS = $(STATIC) $(OFLAG) -g -Wall -I$(SRCROOT)/../include \ - -I$(SRCROOT) $(LEGACY) $(EFI_SUPPORT) $(SDK) -else - CFLAGS = $(STATIC) $(OFLAG) -g -Wall -I$(SRCROOT)/../include \ - -I$(SRCROOT) $(X_CFLAGS) $(LEGACY) $(EFI_SUPPORT) $(SDK) -endif - -USE_DEPENDENCY_FILE := $(shell if [ "$(notdir $(CC))" != "mwccppc" ] && \ - [ "$(RC_XBS)" != "YES" ]; then \ - echo YES ; else echo NO ; \ - fi; ) - -LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff - -ifeq "macos" "$(RC_OS)" - SYSTEMDIR := $(shell if [ "$(RC_RELEASE)" = "Beaker" ] || \ - [ "$(RC_RELEASE)" = "Bunsen" ] || \ - [ "$(RC_RELEASE)" = "Gonzo" ]; then \ - echo /Local/Developer/System; else echo /usr/local/lib/system; fi; ) -else - SYSTEMDIR = /Local/Developer/System -endif -ifeq "macos" "$(RC_OS)" - LIBS := $(shell if [ "$(RC_RELEASE)" = "Beaker" ] || \ - [ "$(RC_RELEASE)" = "Bunsen" ] || \ - [ "$(RC_RELEASE)" = "Gonzo" ] || \ - [ "$(RC_RELEASE)" = "Kodiak" ] || \ - [ "$(RC_RELEASE)" = "Cheetah" ] || \ - [ "$(RC_RELEASE)" = "Puma" ] || \ - [ "$(RC_RELEASE)" = "Jaguar" ] || \ - [ "$(RC_RELEASE)" = "Panther" ] || \ - [ "$(RC_RELEASE)" = "MuonPrime" ] || \ - [ "$(RC_RELEASE)" = "MuonSeed" ] || \ - [ "$(RC_RELEASE)" = "SUPanWheat" ]; then \ - echo "-L$(NEXT_ROOT)$(SYSTEMDIR) -lc_static" ; \ - else if [ "$(RC_RELEASE)" = "Tiger" ]; then \ - echo "-L$(NEXT_ROOT)$(SYSTEMDIR) -lc_static -lm_static" ; \ - else \ - echo "" ; \ - fi; fi; ) -else - LIBS = -lc_static -endif - -ifneq "" "$(wildcard /bin/mkdirs)" - MKDIRS = /bin/mkdirs -else - MKDIRS = /bin/mkdir -p -endif - -SRCROOT = . -SYMROOT = . -OBJROOT = . -OFILE_DIR = $(OBJROOT) -VPATH = $(OFILE_DIR) - -BINDIR = /bin -USRBINDIR = /usr/bin - -CFILES = main.c ofile_print.c m68k_disasm.c i860_disasm.c \ - m88k_disasm.c i386_disasm.c ppc_disasm.c hppa_disasm.c \ - sparc_disasm.c print_objc.c notify.c arm_disasm.c \ - print_objc2_64bit.c print_objc2_32bit.c -ifeq "$(EFITOOLS)" "efitools" - CFILES += coff_print.c -endif -HFILES = otool.h ofile_print.h m68k_disasm.h i860_disasm.h \ - sparc_disasm.h m88k_disasm.h i386_disasm.h ppc_disasm.h hppa_disasm.h \ - notify.h arm_disasm.h -OBJS = $(CFILES:.c=.o) ofile.o -INSTALL_FILES = $(CFILES) $(HFILES) Makefile notes - -PRODUCT = otool -all: $(OFILE_DIR) $(SYMROOT) $(PRODUCT).NEW - -$(PRODUCT).NEW: $(OFILE_DIR) $(SYMROOT) $(OBJS) - $(CC) $(RC_CFLAGS) -nostdlib -r -o $(OBJROOT)/private.o \ - $(OBJS) $(LIBSTUFF) - $(CXX) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/$@ $(OBJROOT)/private.o \ - $(LIBSTUFF) $(LIBS) - -ifeq "NO" "$(USE_DEPENDENCY_FILE)" -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< -else -.c.o: - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $< - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif - -ofile.o: $(SRCROOT)/../libstuff/ofile.c -ifeq "NO" "$(USE_DEPENDENCY_FILE)" - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o \ - $(SRCROOT)/../libstuff/ofile.c -DOTOOL -else - $(CC) $(CFLAGS) $(RC_CFLAGS) -c -MD -dependency-file $(OFILE_DIR)/$*.d \ - -o $(OFILE_DIR)/$*.o $(SRCROOT)/../libstuff/ofile.c -DOTOOL - md -d -u $(OFILE_DIR)/Makedep $(OFILE_DIR)/$*.d -endif - -clean: shlib_clean - -rm -f $(SYMROOT)/$(PRODUCT).NEW - -shlib_clean: - -cd $(OFILE_DIR); rm -f $(OBJS) private.o - -rm -f $(OFILE_DIR)/Makedep make.out - -install: all $(RC_OS)_install - -teflon_install macos_install: - $(MKDIRS) $(DSTROOT)$(USRBINDIR) - install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ - $(DSTROOT)$(USRBINDIR)/$(PRODUCT) - -nextstep_install: - $(MKDIRS) $(DSTROOT)$(BINDIR) - install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ - $(DSTROOT)$(BINDIR)/$(PRODUCT) - -installsrc: - $(MKDIRS) $(SRCROOT) - chmod 755 $(SRCROOT) - gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) - chmod 444 $(SRCROOT)/* - -$(OFILE_DIR) $(SYMROOT): - $(MKDIRS) $@ - --include $(OFILE_DIR)/Makedep +export USE_APPLE_PB_SUPPORT = all + +ifeq "$(EFITOOLS)" "efitools" + EFI_SUPPORT = -DEFI_SUPPORT +endif + +ifneq "" "$(SDKROOT)" + SDK = -isysroot $(SDKROOT) + CC = $(shell xcrun -find -sdk $(SDKROOT) cc) + CXX = $(shell xcrun -find -sdk $(SDKROOT) c++) + DSYMUTIL = $(shell xcrun -find -sdk ${SDKROOT} dsymutil) +else + DSYMUTIL = dsymutil +endif + +OFLAG = -Os +LTO = -DLTO_SUPPORT +LEGACY = -D_MACH_I386_THREAD_STATUS_FPSTATE_LEGACY_FIELD_NAMES_ \ + -D_ARCHITECTURE_I386_FPU_FPSTATE_LEGACY_FIELD_NAMES_ +CFLAGS = $(OFLAG) $(LTO) -g -Wall -I$(SRCROOT)/../include \ + -I$(SRCROOT) $(LEGACY) $(EFI_SUPPORT) $(SDK) + +LIBSTUFF = -L$(SYMROOT)/../libstuff -lstuff +CXXLIB = -stdlib=libc++ + +MKDIRS = /bin/mkdir -p +SRCROOT = . +SYMROOT = . +OBJROOT = . +OFILE_DIR = $(OBJROOT) +VPATH = $(OFILE_DIR) + +BINDIR = /bin +USRBINDIR = /usr/bin + +CFILES = main.c ofile_print.c m68k_disasm.c i860_disasm.c \ + m88k_disasm.c i386_disasm.c ppc_disasm.c hppa_disasm.c \ + sparc_disasm.c print_objc.c notify.c arm_disasm.c \ + print_objc2_64bit.c print_objc2_32bit.c +ifeq "$(EFITOOLS)" "efitools" + CFILES += coff_print.c +endif +HFILES = otool.h ofile_print.h m68k_disasm.h i860_disasm.h \ + sparc_disasm.h m88k_disasm.h i386_disasm.h ppc_disasm.h hppa_disasm.h \ + notify.h arm_disasm.h +OBJS = $(CFILES:.c=.o) ofile.o +INSTALL_FILES = $(CFILES) $(HFILES) Makefile notes + +PRODUCT = otool +all: $(OFILE_DIR) $(SYMROOT) $(PRODUCT).NEW + +$(PRODUCT).NEW: $(OFILE_DIR) $(SYMROOT) $(OBJS) + $(CC) $(RC_CFLAGS) -nostdlib -r -o $(OBJROOT)/private.o \ + $(OBJS) $(LIBSTUFF) + $(CXX) $(RC_CFLAGS) $(SDK) -o $(SYMROOT)/$@ $(OBJROOT)/private.o \ + $(LIBSTUFF) $(CXXLIB) + $(DSYMUTIL) $(SYMROOT)/$@ + +.c.o: + $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o $< + +ofile.o: $(SRCROOT)/../libstuff/ofile.c + $(CC) $(CFLAGS) $(RC_CFLAGS) -c -o $(OFILE_DIR)/$*.o \ + $(SRCROOT)/../libstuff/ofile.c -DOTOOL + +clean: shlib_clean + -rm -f $(SYMROOT)/$(PRODUCT).NEW + -rm -r -f *dSYM + +shlib_clean: + -cd $(OFILE_DIR); rm -f $(OBJS) private.o + -rm -f make.out + +install: all + $(MKDIRS) $(DSTROOT)$(USRBINDIR) + install -c -s -m 555 $(SYMROOT)/$(PRODUCT).NEW \ + $(DSTROOT)$(USRBINDIR)/$(PRODUCT) + +installsrc: + $(MKDIRS) $(SRCROOT) + chmod 755 $(SRCROOT) + gnutar cf - $(INSTALL_FILES) | (cd $(SRCROOT); gnutar xf -) + chmod 444 $(SRCROOT)/* + +$(OFILE_DIR) $(SYMROOT): + $(MKDIRS) $@ diff --git a/cctools/otool/arm_disasm.c b/cctools/otool/arm_disasm.c index b4075b6..dd04262 100644 --- a/cctools/otool/arm_disasm.c +++ b/cctools/otool/arm_disasm.c @@ -154,6 +154,9 @@ struct disassemble_info { /* HACK'ed up for just what we need here */ LLVMDisasmContextRef thumb_dc; char *object_addr; uint32_t object_size; + struct inst *inst; + struct inst *insts; + uint32_t ninsts; } dis_info; /* @@ -796,6 +799,7 @@ const char **ReferenceName) { struct disassemble_info *info; const char *SymbolName; + uint32_t i; info = (struct disassemble_info *)DisInfo; if(info->verbose == FALSE){ @@ -805,6 +809,14 @@ const char **ReferenceName) } SymbolName = guess_symbol(SymbolValue, info->sorted_symbols, info->nsorted_symbols, TRUE); + if(SymbolName == NULL && info->insts != NULL && info->ninsts != 0){ + for(i = 0; i < info->ninsts; i++){ + if(info->insts[i].address == SymbolValue){ + SymbolName = info->insts[i].tmp_label; + break; + } + } + } if(*ReferenceType == LLVMDisassembler_ReferenceType_In_Branch){ *ReferenceName = guess_indirect_symbol(SymbolValue, @@ -816,6 +828,10 @@ const char **ReferenceName) *ReferenceType = LLVMDisassembler_ReferenceType_Out_SymbolStub; else *ReferenceType = LLVMDisassembler_ReferenceType_InOut_None; + if(info->inst != NULL && SymbolName == NULL){ + info->inst->has_raw_target_address = TRUE; + info->inst->raw_target_address = SymbolValue; + } } else if(*ReferenceType == LLVMDisassembler_ReferenceType_In_PCrel_Load){ *ReferenceName = guess_literal_pointer(SymbolValue, ReferencePC, @@ -832,9 +848,47 @@ const char **ReferenceName) LLVMDisasmContextRef create_arm_llvm_disassembler( -void) +cpu_subtype_t cpusubtype) { LLVMDisasmContextRef dc; + char *TripleName; + + switch(cpusubtype){ + case CPU_SUBTYPE_ARM_V4T: + TripleName = "armv4t-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V5TEJ: + TripleName = "armv5-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_XSCALE: + TripleName = "xscale-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V6: + TripleName = "armv6-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V6M: + TripleName = "armv6m-apple-darwin10"; + break; + default: + case CPU_SUBTYPE_ARM_V7: + TripleName = "armv7-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7F: + TripleName = "armv7f-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7S: + TripleName = "armv7s-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7K: + TripleName = "armv7k-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7M: + TripleName = "armv7m-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7EM: + TripleName = "armv7em-apple-darwin10"; + break; + } dc = #ifdef STATIC_LLVM @@ -842,7 +896,7 @@ void) #else llvm_create_disasm #endif - ("armv7-apple-darwin10", &dis_info, 1, GetOpInfo, SymbolLookUp); + (TripleName, mcpu, &dis_info, 1, GetOpInfo, SymbolLookUp); return(dc); } @@ -860,9 +914,47 @@ LLVMDisasmContextRef dc) LLVMDisasmContextRef create_thumb_llvm_disassembler( -void) +cpu_subtype_t cpusubtype) { LLVMDisasmContextRef dc; + char *TripleName; + + switch(cpusubtype){ + case CPU_SUBTYPE_ARM_V4T: + TripleName = "thumbv4t-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V5TEJ: + TripleName = "thumbv5-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_XSCALE: + TripleName = "xscale-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V6: + TripleName = "thumbv6-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V6M: + TripleName = "thumbv6m-apple-darwin10"; + break; + default: + case CPU_SUBTYPE_ARM_V7: + TripleName = "thumbv7-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7F: + TripleName = "thumbv7f-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7S: + TripleName = "thumbv7s-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7K: + TripleName = "thumbv7k-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7M: + TripleName = "thumbv7m-apple-darwin10"; + break; + case CPU_SUBTYPE_ARM_V7EM: + TripleName = "thumbv7em-apple-darwin10"; + break; + } dc = #ifdef STATIC_LLVM @@ -870,7 +962,7 @@ void) #else llvm_create_disasm #endif - ("thumbv7-apple-darwin10", &dis_info, 1, GetOpInfo, + (TripleName, mcpu, &dis_info, 1, GetOpInfo, SymbolLookUp); return(dc); } @@ -1657,6 +1749,10 @@ static const struct opcode32 arm_opcodes[] = {ARM_EXT_V7, 0xf57ff040, 0xfffffff0, "dsb\t%U"}, {ARM_EXT_V7, 0xf57ff060, 0xfffffff0, "isb\t%U"}, + /* V7A optional instructions. */ + {ARM_EXT_V7A, 0x0710f010, 0x0ff0f0f0, "sdiv%c\t%16-19r, %0-3r, %8-11r"}, + {ARM_EXT_V7A, 0x0730f010, 0x0ff0f0f0, "udiv%c\t%16-19r, %0-3r, %8-11r"}, + /* ARM V6T2 instructions. */ {ARM_EXT_V6T2, 0x07c0001f, 0x0fe0007f, "bfc%c\t%12-15r, %E"}, {ARM_EXT_V6T2, 0x07c00010, 0x0fe00070, "bfi%c\t%12-15r, %0-3r, %E"}, @@ -4920,7 +5016,7 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little) given = (b[3]) | (b[2] << 8) | (b[1] << 16) | (b[0] << 24); /* Print the raw data, too. */ - if(!Xflag) + if(!Xflag && !gflag) { if(qflag) info->fprintf_func (info->stream, "\t"); @@ -4962,7 +5058,7 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little) given = (b[1]) | (b[0] << 8) | (given << 16); /* Print the raw data, too. */ - if(!Xflag) + if(!Xflag && !gflag) { if(qflag) info->fprintf_func (info->stream, "\t"); @@ -4978,7 +5074,7 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little) } else { /* Print the raw data, too. */ - if(!Xflag) + if(!Xflag && !gflag) { if(qflag) info->fprintf_func (info->stream, "\t"); @@ -5021,9 +5117,11 @@ print_insn (bfd_vma pc, struct disassemble_info *info, bfd_boolean little) #else llvm_disasm_instruction #endif - (dc, (uint8_t *)info->sect, size, pc, dst, 4095) != 0) - printf("%s", dst); - else { + (dc, (uint8_t *)info->sect, size, pc, dst, 4095) != 0){ + if(info->inst == NULL || info->inst->print) + printf("%s", dst); + } + else if(info->inst == NULL || info->inst->print){ if (size == 4) info->fprintf_func (info->stream, "\t.long\t0x%08x", given); else if (size == 2) @@ -5509,18 +5607,18 @@ uint16_t kind) sect[2] << 16 | sect[1] << 8 | sect[0]; - printf("%08x\t.long %u\t@ ", value, value); + printf("\t%08x\t.long %u\t@ ", value, value); size = 4; } else if(left >= 2){ value = sect[1] << 8 | sect[0]; - printf(" %04x\t.short %u\t@ ", value, value); + printf("\t %04x\t.short %u\t@ ", value, value); size = 2; } else { value = sect[0]; - printf(" %02x\t.byte %u\t@ ", value & 0xff, value & 0xff); + printf("\t %02x\t.byte %u\t@ ",value & 0xff, value & 0xff); size = 1; } if(kind == DICE_KIND_DATA) @@ -5530,12 +5628,13 @@ uint16_t kind) return(size); case DICE_KIND_JUMP_TABLE8: value = sect[0]; - printf(" %02x\t.byte %3u\t@ KIND_JUMP_TABLE8\n", value,value); + printf("\t %02x\t.byte %3u\t@ KIND_JUMP_TABLE8\n",value,value); return(1); case DICE_KIND_JUMP_TABLE16: value = sect[1] << 8 | sect[0]; - printf(" %04x\t.short %5u\t@ KIND_JUMP_TABLE16\n", value & 0xffff ,value & 0xffff ); + printf("\t %04x\t.short %5u\t@ KIND_JUMP_TABLE16\n", + value & 0xffff, value & 0xffff ); return(2); case DICE_KIND_JUMP_TABLE32: case DICE_KIND_ABS_JUMP_TABLE32: @@ -5543,7 +5642,7 @@ uint16_t kind) sect[2] << 16 | sect[1] << 8 | sect[0]; - printf("%08x\t.long %u\t@ ", value, value); + printf("\t%08x\t.long %u\t@ ", value, value); if(kind == DICE_KIND_JUMP_TABLE32) printf("KIND_JUMP_TABLE32\n"); else @@ -5645,7 +5744,10 @@ char *object_addr, uint32_t object_size, struct data_in_code_entry *dices, uint32_t ndices, -uint64_t seg_addr) +uint64_t seg_addr, +struct inst *inst, +struct inst *insts, +uint32_t ninsts) { uint32_t bytes_consumed, pool_value, i, offset; @@ -5690,6 +5792,10 @@ uint64_t seg_addr) dis_info.object_addr = object_addr; dis_info.object_size = object_size; + dis_info.inst = inst; + dis_info.insts = insts; + dis_info.ninsts = ninsts; + /* * If we have at least 4 bytes left, see if these 4 bytes are a pointer * in a literal pool by calling print_immediate_func() with the 4 byte @@ -5734,7 +5840,8 @@ uint64_t seg_addr) } bytes_consumed = print_insn_little_arm(addr, &dis_info); - printf("\n"); + if(!gflag || (inst != NULL && inst->print == TRUE)) + printf("\n"); return(bytes_consumed); } diff --git a/cctools/otool/arm_disasm.h b/cctools/otool/arm_disasm.h index f16dc39..1b4407c 100644 --- a/cctools/otool/arm_disasm.h +++ b/cctools/otool/arm_disasm.h @@ -65,9 +65,14 @@ extern uint32_t arm_disassemble( uint32_t object_size, struct data_in_code_entry *dices, uint32_t ndices, - uint64_t seg_addr); + uint64_t seg_addr, + struct inst *inst, + struct inst *insts, + uint32_t ninsts); -extern LLVMDisasmContextRef create_arm_llvm_disassembler(void); -extern LLVMDisasmContextRef create_thumb_llvm_disassembler(void); +extern LLVMDisasmContextRef create_arm_llvm_disassembler( + cpu_subtype_t cpusubtype); +extern LLVMDisasmContextRef create_thumb_llvm_disassembler( + cpu_subtype_t cpusubtype); extern void delete_arm_llvm_disassembler(LLVMDisasmContextRef dc); extern void delete_thumb_llvm_disassembler(LLVMDisasmContextRef dc); diff --git a/cctools/otool/i386_disasm.c b/cctools/otool/i386_disasm.c index 60b4e03..c8b149c 100644 --- a/cctools/otool/i386_disasm.c +++ b/cctools/otool/i386_disasm.c @@ -176,6 +176,7 @@ static void displacement( uint64_t sect_addr, uint32_t *length, uint32_t *left, + const uint32_t filetype, const cpu_type_t cputype, const uint64_t addr, const struct relocation_info *sorted_relocs, @@ -237,9 +238,10 @@ static void modrm_byte( #define DISPLACEMENT(symadd, symsub, value, value_size) \ displacement((symadd), (symsub), (value), (value_size), sect, \ - sect_addr, &length, &left, cputype, addr, sorted_relocs, \ - nsorted_relocs, symbols, symbols64, nsymbols, strings, \ - strings_size, sorted_symbols, nsorted_symbols, verbose) + sect_addr, &length, &left, filetype, cputype, addr, \ + sorted_relocs, nsorted_relocs, symbols, symbols64, \ + nsymbols, strings, strings_size, sorted_symbols, \ + nsorted_symbols, verbose) #define IMMEDIATE(symadd, symsub, value, value_size) \ immediate((symadd), (symsub), (value), (value_size), sect, sect_addr, \ @@ -1631,6 +1633,10 @@ struct disassemble_info { LLVMDisasmContextRef x86_64_dc; char *object_addr; uint32_t object_size; + struct inst *inst; + struct inst *insts; + uint32_t ninsts; + uint32_t filetype; } dis_info; /* @@ -1663,7 +1669,11 @@ enum bool llvm_mc, LLVMDisasmContextRef i386_dc, LLVMDisasmContextRef x86_64_dc, char *object_addr, -uint32_t object_size) +uint32_t object_size, +struct inst *inst, +struct inst *insts, +uint32_t ninsts, +uint32_t filetype) { char mnemonic[MAX_MNEMONIC+2]; /* one extra for suffix */ const char *seg; @@ -1697,7 +1707,7 @@ uint32_t object_size) } /* Use the llvm disassembler with the -q flag. */ - if(qflag){ + if(qflag || gflag){ LLVMDisasmContextRef dc; char dst[4096]; @@ -1725,16 +1735,23 @@ uint32_t object_size) dis_info.cputype = cputype; dis_info.object_addr = object_addr; dis_info.object_size = object_size; + dis_info.inst = inst; + dis_info.insts = insts; + dis_info.ninsts = ninsts; + dis_info.filetype = filetype; if(cputype == CPU_TYPE_I386) dc = i386_dc; else dc = x86_64_dc; - length = llvm_disasm_instruction(dc, (uint8_t *)sect, left, + length = llvm_disasm_instruction(dc, (uint8_t *)sect, left, addr, dst, 4095); - if(length != 0) - printf("%s\n", dst); + if(length != 0){ + if(inst == NULL || inst->print) + printf("%s\n", dst); + } else{ - printf("\t.byte 0x%02x #bad opcode\n", 0xff & sect[0]); + if(inst == NULL || inst->print) + printf("\t.byte 0x%02x #bad opcode\n", 0xff & sect[0]); length = 1; } return(length); @@ -4059,6 +4076,7 @@ uint64_t sect_addr, uint32_t *length, uint32_t *left, +const uint32_t filetype, const cpu_type_t cputype, const uint64_t addr, const struct relocation_info *sorted_relocs, @@ -4077,7 +4095,9 @@ const enum bool verbose) uint64_t offset; uint64_t guess_addr; - sect_offset = addr + *length - sect_addr; + sect_offset = addr + *length; + if(filetype != MH_KEXT_BUNDLE) + sect_offset -= sect_addr; *value = get_value(value_size, sect, length, left); switch(value_size){ case 1: @@ -4415,7 +4435,9 @@ void *TagBuf) info->verbose == FALSE) return(0); - sect_offset = (Pc + Offset) - info->sect_addr; + sect_offset = (Pc + Offset); + if(info->filetype != MH_KEXT_BUNDLE) + sect_offset -= info->sect_addr; relocs = info->sorted_relocs; nrelocs = info->nsorted_relocs; symbols = info->symbols; @@ -4596,7 +4618,9 @@ void *TagBuf) info->verbose == FALSE) return(0); - sect_offset = (Pc + Offset) - info->sect_addr; + sect_offset = (Pc + Offset); + if(info->filetype != MH_KEXT_BUNDLE) + sect_offset -= info->sect_addr; relocs = info->sorted_relocs; nrelocs = info->nsorted_relocs; symbols = info->symbols64; @@ -4824,6 +4848,7 @@ const char **ReferenceName) { struct disassemble_info *info; const char *SymbolName; + uint32_t i; info = (struct disassemble_info *)DisInfo; if(info->verbose == FALSE){ @@ -4833,6 +4858,14 @@ const char **ReferenceName) } SymbolName = guess_symbol(SymbolValue, info->sorted_symbols, info->nsorted_symbols, TRUE); + if(SymbolName == NULL && info->insts != NULL && info->ninsts != 0){ + for(i = 0; i < info->ninsts; i++){ + if(info->insts[i].address == SymbolValue){ + SymbolName = info->insts[i].tmp_label; + break; + } + } + } if(*ReferenceType == LLVMDisassembler_ReferenceType_In_Branch){ *ReferenceName = guess_indirect_symbol(SymbolValue, @@ -4844,6 +4877,10 @@ const char **ReferenceName) *ReferenceType = LLVMDisassembler_ReferenceType_Out_SymbolStub; else *ReferenceType = LLVMDisassembler_ReferenceType_InOut_None; + if(info->inst != NULL && SymbolName == NULL){ + info->inst->has_raw_target_address = TRUE; + info->inst->raw_target_address = SymbolValue; + } } else if(*ReferenceType == LLVMDisassembler_ReferenceType_In_PCrel_Load){ *ReferenceName = guess_literal_pointer(SymbolValue, ReferencePC, @@ -4864,7 +4901,7 @@ void) { LLVMDisasmContextRef dc; - dc = llvm_create_disasm("i386-apple-darwin10", &dis_info, 1, + dc = llvm_create_disasm("i386-apple-darwin10", mcpu, &dis_info, 1, i386GetOpInfo, SymbolLookUp); return(dc); } @@ -4882,7 +4919,7 @@ void) { LLVMDisasmContextRef dc; - dc = llvm_create_disasm("x86_64-apple-darwin10", &dis_info, 1, + dc = llvm_create_disasm("x86_64-apple-darwin10", mcpu, &dis_info, 1, x86_64GetOpInfo, SymbolLookUp); return(dc); } diff --git a/cctools/otool/i386_disasm.h b/cctools/otool/i386_disasm.h index 601ec14..32fcd4b 100644 --- a/cctools/otool/i386_disasm.h +++ b/cctools/otool/i386_disasm.h @@ -32,6 +32,7 @@ #import #import #import +#include "otool.h" #include "stuff/symbol.h" #include "llvm-c/Disassembler.h" @@ -61,7 +62,11 @@ extern uint32_t i386_disassemble( LLVMDisasmContextRef i386_dc, LLVMDisasmContextRef x86_64_dc, char *object_addr, - uint32_t object_size); + uint32_t object_size, + struct inst *inst, + struct inst *insts, + uint32_t ninsts, + uint32_t filetype); extern LLVMDisasmContextRef create_i386_llvm_disassembler(void); extern void delete_i386_llvm_disassembler(LLVMDisasmContextRef dc); diff --git a/cctools/otool/main.c b/cctools/otool/main.c index 328110d..8e3b862 100644 --- a/cctools/otool/main.c +++ b/cctools/otool/main.c @@ -41,6 +41,7 @@ #include "stuff/allocate.h" #include "stuff/symbol.h" #include "stuff/symbol.h" +#include "stuff/llvm.h" #include "otool.h" #include "ofile_print.h" #include "m68k_disasm.h" @@ -76,6 +77,8 @@ enum bool Rflag = FALSE; /* print the dylib reference table */ enum bool Iflag = FALSE; /* print the indirect symbol table entries */ enum bool Hflag = FALSE; /* print the two-level hints table */ enum bool Gflag = FALSE; /* print the data in code table */ +enum bool gflag = FALSE; /* group the disassembly */ +enum bool eflag = FALSE; /* print enhanced disassembly */ enum bool Sflag = FALSE; /* print the contents of the __.SYMDEF file */ enum bool vflag = FALSE; /* print verbosely (symbolically) when possible */ enum bool Vflag = FALSE; /* print dissassembled operands verbosely */ @@ -88,10 +91,12 @@ enum bool Bflag = FALSE; /* force Thumb disassembly (ARM objects only) */ enum bool Qflag = FALSE; /* use otool's disassembler */ enum bool qflag = FALSE; /* use 'C' Public llvm-mc disassembler */ enum bool jflag = FALSE; /* print opcode bytes */ +enum bool nflag = FALSE; /* use intel disassembly syntax */ char *pflag = NULL; /* procedure name to start disassembling from */ char *segname = NULL; /* name of the section to print the contents of */ char *sectname = NULL; enum bool llvm_mc = FALSE; /* disassemble as llvm-mc will assemble */ +char *mcpu = ""; /* the arg of the -mcpu=arg flag */ /* this is set when any of the flags that process object files is set */ enum bool object_processing = FALSE; @@ -249,7 +254,8 @@ static void print_text( uint32_t object_size, struct data_in_code_entry *dices, uint32_t ndices, - uint64_t seg_addr); + uint64_t seg_addr, + uint32_t filetype); static void print_argstrings( uint32_t magic, @@ -331,6 +337,14 @@ char **envp) llvm_mc = TRUE; continue; } + if(strncmp(argv[i], "-mcpu=", sizeof("-mcpu=")-1) == 0){ + mcpu = argv[i] + sizeof("-mcpu=")-1; + if(*mcpu == '\0'){ + error("missing argument to -mcpu="); + usage(); + } + continue; + } if(argv[i][1] == 'p'){ if(argc <= i + 1){ error("-p requires an argument (a text symbol name)"); @@ -371,6 +385,15 @@ char **envp) case 'a': aflag = TRUE; break; + case 'g': + gflag = TRUE; + break; + case 'e': + eflag = TRUE; + break; + case 'n': + nflag = TRUE; + break; case 'h': hflag = TRUE; object_processing = TRUE; @@ -534,7 +557,7 @@ void) { fprintf(stderr, "Usage: %s [-arch arch_type] [-fahlLDtdorSTMRIHGvVcXmqQ] " - " ...\n", progname); + "[-mcpu=arg] ...\n", progname); fprintf(stderr, "\t-f print the fat headers\n"); fprintf(stderr, "\t-a print the archive header\n"); @@ -568,6 +591,7 @@ void) fprintf(stderr, "\t-B force Thumb disassembly (ARM objects only)\n"); fprintf(stderr, "\t-q use llvm's disassembler (the default)\n"); fprintf(stderr, "\t-Q use otool(1)'s disassembler\n"); + fprintf(stderr, "\t-mcpu=arg use `arg' as the cpu for disassembly\n"); exit(EXIT_FAILURE); } @@ -1004,6 +1028,8 @@ void *cookie) /* cookie is not used */ continue; if(strcmp(p, "gcc_compiled.") == 0) continue; + if(strcmp(p, "ltmp0") == 0) + continue; if(n_type == N_ABS && n_value == 0 && *p == '.') continue; sorted_symbols[nsorted_symbols].n_value = n_value; @@ -1168,17 +1194,37 @@ void *cookie) /* cookie is not used */ relocs = NULL; nrelocs = 0; if(Vflag){ - if((intptr_t)sect_relocs % sizeof(int32_t) != 0 || - ofile->object_byte_sex != get_host_byte_sex()){ - nrelocs = sect_nrelocs; - relocs = allocate(nrelocs * - sizeof(struct relocation_info)); - memcpy(relocs, sect_relocs, nrelocs * - sizeof(struct relocation_info)); + if(mh_filetype != MH_KEXT_BUNDLE){ + if((intptr_t)sect_relocs % sizeof(int32_t) != 0 || + ofile->object_byte_sex != get_host_byte_sex()){ + nrelocs = sect_nrelocs; + relocs = allocate(nrelocs * + sizeof(struct relocation_info)); + memcpy(relocs, sect_relocs, nrelocs * + sizeof(struct relocation_info)); + } + else{ + nrelocs = sect_nrelocs; + relocs = sect_relocs; + } } else{ - nrelocs = sect_nrelocs; - relocs = sect_relocs; + get_linked_reloc_info(ofile->load_commands, mh_ncmds, + mh_sizeofcmds, ofile->object_byte_sex, + ofile->object_addr, ofile->object_size, &ext_relocs, + &next_relocs, &loc_relocs, &nloc_relocs); + if((intptr_t)ext_relocs % sizeof(int32_t) != 0 || + ofile->object_byte_sex != get_host_byte_sex()){ + nrelocs = next_relocs; + relocs = allocate(next_relocs * + sizeof(struct relocation_info)); + memcpy(relocs, ext_relocs, next_relocs * + sizeof(struct relocation_info)); + } + else{ + nrelocs = next_relocs; + relocs = ext_relocs; + } } if(ofile->object_byte_sex != get_host_byte_sex()) swap_relocation_info(relocs, nrelocs, @@ -1198,10 +1244,15 @@ void *cookie) /* cookie is not used */ nindirect_symbols, ofile->load_commands, mh_ncmds, mh_sizeofcmds, vflag, Vflag, mh_cpusubtype, ofile->object_addr, ofile->object_size, dices, ndices, - seg_addr); + seg_addr, mh_filetype); - if(relocs != NULL && relocs != sect_relocs) - free(relocs); + if(mh_filetype != MH_KEXT_BUNDLE){ + if(relocs != NULL && relocs != sect_relocs) + free(relocs); + } else { + if(relocs != NULL && relocs != ext_relocs) + free(relocs); + } } if(iflag){ @@ -2561,7 +2612,8 @@ char *object_addr, uint32_t object_size, struct data_in_code_entry *dices, uint32_t ndices, -uint64_t seg_addr) +uint64_t seg_addr, +uint32_t filetype) { enum byte_sex host_byte_sex; enum bool swapped; @@ -2570,6 +2622,9 @@ uint64_t seg_addr) unsigned short short_word; unsigned char byte_word; LLVMDisasmContextRef arm_dc, thumb_dc, i386_dc, x86_64_dc; + uint32_t n, ninsts; + struct inst *insts; + char *sect_start; host_byte_sex = get_host_byte_sex(); swapped = host_byte_sex != object_byte_sex; @@ -2577,6 +2632,9 @@ uint64_t seg_addr) thumb_dc = NULL; i386_dc = NULL; x86_64_dc = NULL; + n = 0; + ninsts = 0; + insts = NULL; if(disassemble == TRUE){ if(pflag){ @@ -2596,10 +2654,12 @@ uint64_t seg_addr) offset = sorted_symbols[i].n_value - addr; sect += offset; cur_addr = sorted_symbols[i].n_value; + sect_start = sect; } else{ offset = 0; cur_addr = addr; + sect_start = sect; } if(cputype == CPU_TYPE_ARM && (cpusubtype == CPU_SUBTYPE_ARM_V7 || @@ -2613,23 +2673,86 @@ uint64_t seg_addr) } else in_thumb = FALSE; - if(qflag && cputype == CPU_TYPE_ARM){ - arm_dc = create_arm_llvm_disassembler(); - thumb_dc = create_thumb_llvm_disassembler(); + if((qflag || gflag) && cputype == CPU_TYPE_ARM){ + arm_dc = create_arm_llvm_disassembler(cpusubtype); + if(arm_dc == NULL){ + printf("can't create arm llvm disassembler\n"); + return; + } + thumb_dc = create_thumb_llvm_disassembler(cpusubtype); + if(thumb_dc == NULL){ + printf("can't create thumb llvm disassembler\n"); + return; + } + llvm_disasm_set_options(arm_dc, + LLVMDisassembler_Option_PrintImmHex); + llvm_disasm_set_options(thumb_dc, + LLVMDisassembler_Option_PrintImmHex); + if(eflag){ + llvm_disasm_set_options(arm_dc, + LLVMDisassembler_Option_UseMarkup); + llvm_disasm_set_options(thumb_dc, + LLVMDisassembler_Option_UseMarkup); + } } - if(qflag && cputype == CPU_TYPE_I386) + if((qflag || gflag) && cputype == CPU_TYPE_I386){ i386_dc = create_i386_llvm_disassembler(); - if(qflag && cputype == CPU_TYPE_X86_64) + if(i386_dc == NULL){ + printf("can't create i386 llvm disassembler\n"); + return; + } + llvm_disasm_set_options(i386_dc, + LLVMDisassembler_Option_PrintImmHex); + if(nflag) + llvm_disasm_set_options(i386_dc, + LLVMDisassembler_Option_AsmPrinterVariant); + if(eflag) + llvm_disasm_set_options(i386_dc, + LLVMDisassembler_Option_UseMarkup); + } + if((qflag || gflag) && cputype == CPU_TYPE_X86_64){ x86_64_dc = create_x86_64_llvm_disassembler(); + if(x86_64_dc == NULL){ + printf("can't create x86_64 llvm disassembler\n"); + return; + } + llvm_disasm_set_options(x86_64_dc, + LLVMDisassembler_Option_PrintImmHex); + if(nflag) + llvm_disasm_set_options(x86_64_dc, + LLVMDisassembler_Option_AsmPrinterVariant); + if(eflag) + llvm_disasm_set_options(x86_64_dc, + LLVMDisassembler_Option_UseMarkup); + } + if(gflag){ + ninsts = 100; + insts = allocate(sizeof(struct inst) * ninsts); + } for(i = offset ; i < size ; ){ - print_label(cur_addr, TRUE, sorted_symbols, nsorted_symbols); - if(Xflag == FALSE){ - if(cputype & CPU_ARCH_ABI64) - printf("%016llx", cur_addr); - else - printf("%08x", (uint32_t)cur_addr); - if(qflag == FALSE) - printf("\t"); + if(gflag && + (cputype == CPU_TYPE_X86_64 || + cputype == CPU_TYPE_I386 || + cputype == CPU_TYPE_ARM)){ + if(n > ninsts){ + ninsts += ninsts; + insts = reallocate(insts, sizeof(struct inst) * ninsts); + } + memset(&(insts[n]), '\0', sizeof(struct inst)); + insts[n].address = cur_addr; + insts[n].label = get_label(cur_addr, sorted_symbols, + nsorted_symbols);; + } + else{ + print_label(cur_addr, TRUE, sorted_symbols,nsorted_symbols); + if(Xflag == FALSE){ + if(cputype & CPU_ARCH_ABI64) + printf("%016llx", cur_addr); + else + printf("%08x", (uint32_t)cur_addr); + if(qflag == FALSE) + printf("\t"); + } } if(cputype == CPU_TYPE_POWERPC64) j = ppc_disassemble(sect, size - i, cur_addr, addr, @@ -2646,7 +2769,8 @@ uint64_t seg_addr) indirect_symbols, nindirect_symbols, cputype, load_commands, ncmds, sizeofcmds, verbose, llvm_mc, i386_dc, x86_64_dc , object_addr, - object_size); + object_size, &(insts[n]), NULL, 0, + filetype); else if(cputype == CPU_TYPE_MC680x0) j = m68k_disassemble(sect, size - i, cur_addr, addr, object_byte_sex, relocs, nrelocs, symbols, @@ -2666,7 +2790,8 @@ uint64_t seg_addr) strings, strings_size, indirect_symbols, nindirect_symbols, cputype, load_commands, ncmds, sizeofcmds, verbose, llvm_mc, i386_dc, - x86_64_dc, object_addr, object_size); + x86_64_dc, object_addr, object_size, + &(insts[n]), NULL, 0, filetype); else if(cputype == CPU_TYPE_MC88000) j = m88k_disassemble(sect, size - i, cur_addr, addr, object_byte_sex, relocs, nrelocs, symbols, @@ -2700,7 +2825,7 @@ uint64_t seg_addr) nindirect_symbols, load_commands, ncmds, sizeofcmds, cpusubtype, verbose, arm_dc, thumb_dc, object_addr, object_size, dices, - ndices, seg_addr); + ndices, seg_addr, &(insts[n]), NULL, 0); else{ printf("Can't disassemble unknown cputype %d\n", cputype); return; @@ -2708,7 +2833,76 @@ uint64_t seg_addr) sect += j; cur_addr += j; i += j; + if(gflag) + n++; + } + if(gflag && + (cputype == CPU_TYPE_X86_64 || + cputype == CPU_TYPE_I386 || + cputype == CPU_TYPE_ARM)){ + char dst[4096]; + dst[4095] = '\0'; + + /* Look for inits that need tmp labels. */ + for(i = 0 ; i < n ; i++){ + if(insts[i].has_raw_target_address){ + for(j = 0; j < n; j++){ + if(insts[i].raw_target_address == insts[j].address) + insts[j].needs_tmp_label = TRUE; + } + } + } + + /* Create the needed tmp labels. */ + j = 1; + for(i = 0 ; i < n ; i++){ + if(insts[i].needs_tmp_label == TRUE){ + insts[i].tmp_label = allocate(20); + sprintf(insts[i].tmp_label, "L%d", j++); + } + } + + /* Now finally print the inits. */ + for(i = 0 ; i < n ; i++){ + if(insts[i].label != NULL) + printf("%s:\n", insts[i].label); + else if(insts[i].tmp_label != NULL) + printf("%s:", insts[i].tmp_label); + insts[i].print = TRUE; + cur_addr = insts[i].address; + offset = cur_addr - addr; + sect = sect_start + offset; + if(cputype == CPU_TYPE_X86_64 || cputype == CPU_TYPE_I386) + j = i386_disassemble(sect, size - offset, cur_addr, addr, + object_byte_sex, relocs, nrelocs, symbols, NULL, + nsymbols, sorted_symbols, nsorted_symbols, + strings, strings_size, indirect_symbols, + nindirect_symbols, cputype, load_commands, + ncmds, sizeofcmds, verbose, llvm_mc, i386_dc, + x86_64_dc, object_addr, object_size, + &(insts[i]), insts, n, filetype); + else if(cputype == CPU_TYPE_ARM) + j = arm_disassemble(sect, size - offset, cur_addr, addr, + object_byte_sex, relocs, nrelocs, symbols, + nsymbols, sorted_symbols, nsorted_symbols, + strings, strings_size, indirect_symbols, + nindirect_symbols, load_commands, ncmds, + sizeofcmds, cpusubtype, verbose, arm_dc, + thumb_dc, object_addr, object_size, dices, + ndices, seg_addr, &(insts[i]), insts, n); + } + + /* Free up allocated space */ + for(i = 0 ; i < n ; i++){ + if(insts[i].tmp_label != NULL) + free(insts[i].tmp_label); + } + free(insts); } + if(i386_dc != NULL) + delete_arm_llvm_disassembler(i386_dc); + if(x86_64_dc != NULL) + delete_arm_llvm_disassembler(x86_64_dc); if(arm_dc != NULL) delete_arm_llvm_disassembler(arm_dc); if(thumb_dc != NULL) @@ -2746,7 +2940,10 @@ uint64_t seg_addr) } else{ for(i = 0 ; i < size ; i += j , addr += j){ - printf("%08x ", (unsigned int)addr); + if(cputype & CPU_ARCH_ABI64) + printf("%016llx ", addr); + else + printf("%08x ", (uint32_t)addr); for(j = 0; j < 4 * sizeof(int32_t) && i + j < size; j += sizeof(int32_t)){ diff --git a/cctools/otool/notes b/cctools/otool/notes index d628e42..152f70c 100644 --- a/cctools/otool/notes +++ b/cctools/otool/notes @@ -3,6 +3,90 @@ TODO: - HPPA, bring the private version of mach/hppa/thread_status.h in sync with the kernel header and change ofile_print.c to recognize new thread states. +Changes for the 5.33 release (the cctools-845 release): +- Fixed a bug in printing the fat headers that incorrectly complained parts + were "(past end of file)" when it shouldn't. The size argument to + print_fat_headers() should have been passed as a uint64_t . + Radar bug #13545561 . + +Changes for the 5.33 release (the cctools-844 release): +- Changed processor() in main.c when creating the sorted symbol table to + ignore the symbol named ltmp0. Radar bug #13406338. + +Changes for the 5.33 release (the cctools-843 release): +- Added printing a missing leading tab in print_data_in_code() in arm_disasm.c . + Radar bug #13337414. + +Changes for the 5.33 release (the cctools-842 release): +- Updated the intel disassembly to handle MH_KEXT_BUNDLE files. Radar bug + #12237594. + - Changed processor() in main.c for the tflag and Vflag to check the + mh_filetype for MH_KEXT_BUNDLE and get call get_linked_reloc_info() and + use those external relocation entries. + - Changed print_text() in main.c to add the filetype argument and pass it. + - Changed i386_disassemble() in i386_disasm.[ch] to take the filetype + argument and changed in print_text() in main.c to pass it. + - Changed displacement() in i386_disasm.c to take the filetype argument and + changed the macro DISPLACEMENT() to pass it. + - Added the filetype field to the dis_info struct and set it from the + argument in i386_disassemble() 386_disasm.c . + - Changed displacement() to test the filetype argument to see it is not + MH_KEXT_BUNDLE before subtracting sect_addr to get the sect_offset. + Also the same is done in i386GetOpInfo() and x86_64GetOpInfo(). + +Changes for the 5.33 release (the cctools-841 release): +- Fixed a bug that would cause otool to crash if it had a symbol stub section + with a size of zero. The fix was in guess_indirect_symbol() in ofile_print.c. + Radar bug #12924490. +- Fixed a bug where otool(1) -t for 64-bit architectures was not printing the + full 64-bit address. The fix was in print_text(). Radar bug #12914544. +- Added support for the LC_LINKER_OPTION load command. Radar bug #12906665. + - Added print_linker_option_command() in ofile_print.[ch] . + - Added code in print_loadcmds() in ofile_print.c for LC_LINKER_OPTION. +- Added the -n option to test disassembly with Intel syntax and the llvm + disassembler. Radar bug #10989182 +- Added the -mcpu=arg option to pass arg as the CPU argument to the updated + llvm_create_disasm(), changes in main() in main.c and in otool.h . + Radar bug #12839170. +- Added a call to llvm_disasm_set_options() with + LLVMDisassembler_Option_PrintImmHex for the llvm disassemblers in print_text() + in main.c . Radar bug #12810901. + +Changes for the 5.33 release (the cctools-840 release): +- Fixed it so otool(1) when using the llvm disassembler will correctly + disassemble arm sdiv and udiv instructions. Radar bug #12464533. + - Added passing the cpusubtype to create_arm_llvm_disassembler() and + create_thumb_llvm_disassembler() in print_text() in main.c . + - Changed the TripleName passed to llvm_create_disasm() in + create_arm_llvm_disassembler() and create_thumb_llvm_disassembler() in + arm_disasm.c to be based on the cpusubtype. +- Added support for new archs: armv6m / armv7m / armv7em and updated + ofile_print.c . Radar bug #11314463. +- Changed to use libc++ instead of libstdc++ . Radar bug #12624622. +- Added support for marked up llvm disassembler output with the -e flag and the + -g flag to create and print temporary labels. Radar bug #11764962. + - Added the struct inst to otool.h to support creating temporary labels with + the -g flag and disassembly. + - Changed print_label() in ofile_print.[ch] to get_label() so it can be used + to save a lable in the struct inst for later printing and to know it does + not need a temporary label. + - Changed the inteface to the arm and i386 disassemblers to support the -g + option. It now passes in a pointer the inst struct it is disassembling on + first pass looking for temporary labels with inst->print set to FALSE, and + an array of insts and count on the second pass which is used to get the + temporary labels. + - Added code in the arm and i386 disassemblers to pass the array of insts and + count in the disasm info passed to SymbolLookUp() and updated that to look + for temporary labels. And also puts a pointer to the inst being + disassembled into the disasm info so the has_raw_target_address and + raw_target_address fields + can be set if it is a branch and does not have a SymbolName for the target. + - Changed arm_disasm.c to not print the raw data when the -g flag is set. + - Changed print_text() in main.c to implement the -g flag and make a pass to + gather instructions that have raw addresses and need temporary labels, make + the temporary labels and finally disassemble and print using the temporary + labels. + Changes for the 5.33 release (the cctools-838 release): - Change the default disassembler to use the llvm disassembler via setting the -q flag unless the -Q flag is set. Radar bug #9801054. @@ -489,8 +573,8 @@ Changes for the 5.25 release (the cctools-675 release): Changes for the 5.25 release (the cctools-673 release): - Changed the sources so the arm stuff is not in the open source version. Radar bug #5326431. - - Changed the Makefile to #ifndef __OPEN_SOURCE__ out the arm files - - Added #ifndef __OPEN_SOURCE__ to the following files to bracket arm code: + - Changed the Makefile to #ifndef __OPEN_SOURCE__ + - Added #ifndef __OPEN_SOURCE__ main.c, ofile_print.c, otool.h and arm_disasm.c . Changes for the 5.24 release (the cctools-665 release): diff --git a/cctools/otool/ofile_print.c b/cctools/otool/ofile_print.c index 8b1f677..b482707 100644 --- a/cctools/otool/ofile_print.c +++ b/cctools/otool/ofile_print.c @@ -303,7 +303,7 @@ void print_fat_headers( struct fat_header *fat_header, struct fat_arch *fat_archs, -uint32_t size, +uint64_t size, enum bool verbose) { uint32_t i, j; @@ -585,6 +585,9 @@ struct fat_arch *fat_arch) case CPU_SUBTYPE_ARM_V6: printf("armv6\n"); break; + case CPU_SUBTYPE_ARM_V6M: + printf("armv6m\n"); + break; case CPU_SUBTYPE_ARM_V7: printf("armv7\n"); break; @@ -597,6 +600,12 @@ struct fat_arch *fat_arch) case CPU_SUBTYPE_ARM_V7K: printf("armv7k\n"); break; + case CPU_SUBTYPE_ARM_V7M: + printf("armv7m\n"); + break; + case CPU_SUBTYPE_ARM_V7EM: + printf("armv7em\n"); + break; default: goto print_arch_unknown; break; @@ -867,6 +876,10 @@ cpu_subtype_t cpusubtype) printf(" cputype CPU_TYPE_ARM\n" " cpusubtype CPU_SUBTYPE_ARM_V6\n"); break; + case CPU_SUBTYPE_ARM_V6M: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V6M\n"); + break; case CPU_SUBTYPE_ARM_V7: printf(" cputype CPU_TYPE_ARM\n" " cpusubtype CPU_SUBTYPE_ARM_V7\n"); @@ -883,6 +896,14 @@ cpu_subtype_t cpusubtype) printf(" cputype CPU_TYPE_ARM\n" " cpusubtype CPU_SUBTYPE_ARM_V7K\n"); break; + case CPU_SUBTYPE_ARM_V7M: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V7M\n"); + break; + case CPU_SUBTYPE_ARM_V7EM: + printf(" cputype CPU_TYPE_ARM\n" + " cpusubtype CPU_SUBTYPE_ARM_V7EM\n"); + break; default: goto print_arch_unknown; } @@ -1575,6 +1596,9 @@ NS32: case CPU_SUBTYPE_ARM_V6: printf(" V6"); break; + case CPU_SUBTYPE_ARM_V6M: + printf(" V6M"); + break; case CPU_SUBTYPE_ARM_V7: printf(" V7"); break; @@ -1587,6 +1611,12 @@ NS32: case CPU_SUBTYPE_ARM_V7K: printf(" V7K"); break; + case CPU_SUBTYPE_ARM_V7M: + printf(" V7M"); + break; + case CPU_SUBTYPE_ARM_V7EM: + printf(" V7EM"); + break; default: printf(" %10d", cpusubtype & ~CPU_SUBTYPE_MASK); break; @@ -1791,6 +1821,7 @@ enum bool very_verbose) struct rpath_command rpath; struct encryption_info_command encrypt; struct encryption_info_command_64 encrypt64; + struct linker_option_command lo; struct dyld_info_command dyld_info; struct version_min_command vd; struct entry_point_command ep; @@ -2165,6 +2196,17 @@ enum bool very_verbose) print_encryption_info_command_64(&encrypt64, object_size); break; + case LC_LINKER_OPTION: + memset((char *)&lo, '\0', + sizeof(struct linker_option_command)); + size = left < sizeof(struct linker_option_command) ? + left : sizeof(struct linker_option_command); + memcpy((char *)&lo, (char *)lc, size); + if(swapped) + swap_linker_option_command(&lo, host_byte_sex); + print_linker_option_command(&lo, lc); + break; + case LC_DYLD_INFO: case LC_DYLD_INFO_ONLY: memset((char *)&dyld_info, '\0', @@ -3552,6 +3594,49 @@ uint32_t object_size) } /* + * print an LC_LINKER_OPTION command. The linker_option_command structure + * specified must be aligned correctly and in the host byte sex. The lc is + * the actual load command with the strings that follow it and must have been + * previously checked so that the cmdsize does not extend past the size of the + * load commands. + */ +void +print_linker_option_command( +struct linker_option_command *lo, +struct load_command *lc) +{ + int left, len, i; + char *string; + + printf(" cmd LC_LINKER_OPTION\n"); + printf(" cmdsize %u", lo->cmdsize); + if(lo->cmdsize < sizeof(struct linker_option_command)) + printf(" Incorrect size\n"); + else + printf("\n"); + printf(" count %u\n", lo->count); + string = (char *)lc + sizeof(struct linker_option_command); + left = lo->cmdsize - sizeof(struct linker_option_command); + i = 0; + while(left > 0){ + while(*string == '\0' && left > 0){ + string++; + left--; + } + if(left > 0){ + i++; + printf(" string #%d %.*s\n", i, left, string); + len = strnlen(string, left) + 1; + string += len; + left -= len; + } + } + if(lo->count != i) + printf(" count %u does not match number of strings %u\n", + lo->count, i); +} + +/* * print an LC_DYLD_INFO command. The dyld_info_command structure * specified must be aligned correctly and in the host byte sex. */ @@ -8220,6 +8305,8 @@ const uint32_t strings_size) stride = s.reserved2; else stride = 4; + if(stride == 0) + return(NULL); index = s.reserved1 + (value - s.addr) / stride; if(index < nindirect_symbols && symbols != NULL && strings != NULL && @@ -8255,6 +8342,8 @@ const uint32_t strings_size) stride = s64.reserved2; else stride = 8; + if(stride == 0) + return(NULL); index = s64.reserved1 + (value - s64.addr) / stride; if(index < nindirect_symbols && symbols64 != NULL && strings != NULL && @@ -8347,17 +8436,12 @@ uint64_t addr) } /* - * Print_label prints a symbol name for the addr if a symbol exist with the - * same address in label form, namely:. - * - * :\n - * - * The colon and the newline are printed if colon_and_newline is TRUE. + * get_label returns a symbol name for the addr if a symbol exist with the + * same address else it returns NULL. */ -void -print_label( +char * +get_label( uint64_t addr, -enum bool colon_and_newline, struct symbol *sorted_symbols, uint32_t nsorted_symbols) { @@ -8367,12 +8451,8 @@ uint32_t nsorted_symbols) high = nsorted_symbols - 1; mid = (high - low) / 2; while(high >= low){ - if(sorted_symbols[mid].n_value == addr){ - printf("%s", sorted_symbols[mid].name); - if(colon_and_newline == TRUE) - printf(":\n"); - return; - } + if(sorted_symbols[mid].n_value == addr) + return(sorted_symbols[mid].name); if(sorted_symbols[mid].n_value > addr){ high = mid - 1; mid = (high + low) / 2; @@ -8382,4 +8462,30 @@ uint32_t nsorted_symbols) mid = (high + low) / 2; } } + return(NULL); +} + +/* + * print_label prints a symbol name for the addr if a symbol exist with the + * same address in label form, namely:. + * + * :\n + * + * The colon and the newline are printed if colon_and_newline is TRUE. + */ +void +print_label( +uint64_t addr, +enum bool colon_and_newline, +struct symbol *sorted_symbols, +uint32_t nsorted_symbols) +{ + char *name; + + name = get_label(addr, sorted_symbols, nsorted_symbols); + if(name != NULL){ + printf("%s", name); + if(colon_and_newline == TRUE) + printf(":\n"); + } } diff --git a/cctools/otool/ofile_print.h b/cctools/otool/ofile_print.h index f04a1ef..da7f032 100644 --- a/cctools/otool/ofile_print.h +++ b/cctools/otool/ofile_print.h @@ -40,7 +40,7 @@ extern void print_fat_headers( struct fat_header *fat_header, struct fat_arch *fat_archs, - uint32_t size, + uint64_t size, enum bool verbose); extern void print_ar_hdr( @@ -314,6 +314,10 @@ extern void print_encryption_info_command_64( struct encryption_info_command_64 *ec, uint32_t object_size); +extern void print_linker_option_command( + struct linker_option_command *lo, + struct load_command *lc); + extern void print_dyld_info_info_command( struct dyld_info_command *dc, uint32_t object_size); @@ -548,6 +552,11 @@ extern void print_coff_reloc_section( uint32_t object_size, enum bool verbose); +extern char *get_label( + uint64_t addr, + struct symbol *sorted_symbols, + uint32_t nsorted_symbols); + extern void print_label( uint64_t addr, enum bool colon_and_newline, diff --git a/cctools/otool/otool.h b/cctools/otool/otool.h index a7495b8..d5a309b 100644 --- a/cctools/otool/otool.h +++ b/cctools/otool/otool.h @@ -28,7 +28,8 @@ * * @APPLE_LICENSE_HEADER_END@ */ -#import +#include +#include "llvm-c/Disassembler.h" /* Name of this program for error messages (argv[0]) */ extern char *progname; @@ -58,13 +59,30 @@ extern enum bool Zflag; /* don't use simplified ppc mnemonics in disassembly */ extern enum bool Bflag; /* force Thumb disassembly (ARM objects only) */ extern enum bool Qflag; /* use the HACKED llvm-mc disassembler */ extern enum bool qflag; /* use 'C' Public llvm-mc disassembler */ +extern enum bool gflag; /* group the disassembly */ extern enum bool jflag; /* print opcode bytes */ extern char *pflag; /* procedure name to start disassembling from */ extern char *segname, *sectname; /* name of the section to print the contents of */ +extern char *mcpu; /* the arg of the -mcpu=arg flag */ uint32_t m68k_usrstack(void); uint32_t m88k_usrstack(void); uint32_t i386_usrstack(void); uint32_t hppa_usrstack(void); uint32_t sparc_usrstack(void); + +#ifndef STRUCT_INST +#define STRUCT_INST + +struct inst { + uint64_t address; + char *label; + enum bool needs_tmp_label; + char *tmp_label; + enum bool print; + enum bool has_raw_target_address; + uint64_t raw_target_address; +}; + +#endif /* !defined(STRUCT_INST) */ -- 2.11.4.GIT