From 9e225d036f7ada46c87f40647ed12d4c406f502f Mon Sep 17 00:00:00 2001 From: Apple Date: Tue, 25 Oct 2005 20:27:45 +0000 Subject: [PATCH] dyld-44.2.tar.gz --- dyld.xcode/project.pbxproj | 1044 ----------------- dyld.xcodeproj/project.pbxproj | 880 ++++++++++++++ src/ImageLoader.cpp | 1 + src/ImageLoaderMachO.cpp | 16 +- src/dyld.cpp | 85 +- src/dyld64.exp | 37 + src/glue.c | 5 + src/stub_binding_helper.s | 20 +- unit-tests/bin/fail-if-non-zero.pl | 14 + unit-tests/include/common.makefile | 2 + unit-tests/run-all-unit-tests | 12 + .../bundle-memory-load-fat/Makefile | 41 + .../bundle-memory-load-fat/bundle.c | 31 + .../test-cases/bundle-memory-load-fat/main.c | 96 ++ .../test-cases/dlclose-dylib-unload/Makefile | 44 + .../test-cases/dlclose-dylib-unload/bar.c | 28 + .../test-cases/dlclose-dylib-unload/foo.c | 28 + .../test-cases/dlclose-dylib-unload/main.c | 162 +++ unit-tests/test-cases/dlerror-clear/Makefile | 38 + unit-tests/test-cases/dlerror-clear/main.c | 61 + .../fallback-non-unique-leaf-names/Makefile | 44 + .../fallback-non-unique-leaf-names/bar.c | 30 + .../fallback-non-unique-leaf-names/foo.c | 28 + .../fallback-non-unique-leaf-names/main.c | 45 + .../image-remove-notification/Makefile | 41 + .../image-remove-notification/foo.c | 3 + .../image-remove-notification/main.c | 81 ++ .../lazy-binding-reg-params/Makefile | 41 + .../test-cases/lazy-binding-reg-params/foo.c | 43 + .../test-cases/lazy-binding-reg-params/main.c | 54 + .../test-cases/non-weak-library/Makefile | 2 +- .../unloadable-library-residue/Makefile | 54 + .../unloadable-library-residue/bar.c | 30 + .../unloadable-library-residue/foo.c | 33 + .../unloadable-library-residue/main.c | 51 + 35 files changed, 2164 insertions(+), 1061 deletions(-) delete mode 100644 dyld.xcode/project.pbxproj create mode 100644 dyld.xcodeproj/project.pbxproj create mode 100644 src/dyld64.exp create mode 100755 unit-tests/bin/fail-if-non-zero.pl create mode 100644 unit-tests/test-cases/bundle-memory-load-fat/Makefile create mode 100644 unit-tests/test-cases/bundle-memory-load-fat/bundle.c create mode 100644 unit-tests/test-cases/bundle-memory-load-fat/main.c create mode 100644 unit-tests/test-cases/dlclose-dylib-unload/Makefile create mode 100644 unit-tests/test-cases/dlclose-dylib-unload/bar.c create mode 100644 unit-tests/test-cases/dlclose-dylib-unload/foo.c create mode 100644 unit-tests/test-cases/dlclose-dylib-unload/main.c create mode 100644 unit-tests/test-cases/dlerror-clear/Makefile create mode 100644 unit-tests/test-cases/dlerror-clear/main.c create mode 100644 unit-tests/test-cases/fallback-non-unique-leaf-names/Makefile create mode 100644 unit-tests/test-cases/fallback-non-unique-leaf-names/bar.c create mode 100644 unit-tests/test-cases/fallback-non-unique-leaf-names/foo.c create mode 100644 unit-tests/test-cases/fallback-non-unique-leaf-names/main.c create mode 100644 unit-tests/test-cases/image-remove-notification/Makefile create mode 100644 unit-tests/test-cases/image-remove-notification/foo.c create mode 100644 unit-tests/test-cases/image-remove-notification/main.c create mode 100644 unit-tests/test-cases/lazy-binding-reg-params/Makefile create mode 100644 unit-tests/test-cases/lazy-binding-reg-params/foo.c create mode 100644 unit-tests/test-cases/lazy-binding-reg-params/main.c create mode 100644 unit-tests/test-cases/unloadable-library-residue/Makefile create mode 100644 unit-tests/test-cases/unloadable-library-residue/bar.c create mode 100644 unit-tests/test-cases/unloadable-library-residue/foo.c create mode 100644 unit-tests/test-cases/unloadable-library-residue/main.c diff --git a/dyld.xcode/project.pbxproj b/dyld.xcode/project.pbxproj deleted file mode 100644 index bdddd37..0000000 --- a/dyld.xcode/project.pbxproj +++ /dev/null @@ -1,1044 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 39; - objects = { - EF799FE7070D27BB00F78484 = { - children = ( - EF799FE8070D27BB00F78484, - EF799FEA070D27BB00F78484, - ); - isa = PBXGroup; - name = man; - path = doc/man; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FE8070D27BB00F78484 = { - children = ( - EF799FE9070D27BB00F78484, - ); - isa = PBXGroup; - name = man1; - path = doc/man/man1; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FE9070D27BB00F78484 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = text.man; - name = dyld.1; - path = doc/man/man1/dyld.1; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FEA070D27BB00F78484 = { - children = ( - EF799FEB070D27BB00F78484, - EF799FEC070D27BB00F78484, - EF799FED070D27BB00F78484, - EF799FEE070D27BB00F78484, - EF799FEF070D27BB00F78484, - EF799FF0070D27BB00F78484, - EF799FF1070D27BB00F78484, - EF799FF2070D27BB00F78484, - EF799FF3070D27BB00F78484, - ); - isa = PBXGroup; - name = man3; - path = doc/man/man3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FEB070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = dladdr.3; - path = doc/man/man3/dladdr.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FEC070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = dlclose.3; - path = doc/man/man3/dlclose.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FED070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = dlerror.3; - path = doc/man/man3/dlerror.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FEE070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = dlopen.3; - path = doc/man/man3/dlopen.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FEF070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = dlsym.3; - path = doc/man/man3/dlsym.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FF0070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = dyld.3; - path = doc/man/man3/dyld.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FF1070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = NSModule.3; - path = doc/man/man3/NSModule.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FF2070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = NSObjectFileImage.3; - path = doc/man/man3/NSObjectFileImage.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF799FF3070D27BB00F78484 = { - explicitFileType = text.man; - fileEncoding = 30; - isa = PBXFileReference; - name = NSObjectFileImage_priv.3; - path = doc/man/man3/NSObjectFileImage_priv.3; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - EF79A010070D293E00F78484 = { - fileRef = EF799FE9070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A011070D295200F78484 = { - fileRef = EF799FEB070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A012070D295200F78484 = { - fileRef = EF799FEC070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A013070D295200F78484 = { - fileRef = EF799FED070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A014070D295200F78484 = { - fileRef = EF799FEE070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A015070D295200F78484 = { - fileRef = EF799FEF070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A016070D295200F78484 = { - fileRef = EF799FF0070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A017070D295200F78484 = { - fileRef = EF799FF1070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A018070D295200F78484 = { - fileRef = EF799FF2070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; - EF79A019070D295200F78484 = { - fileRef = EF799FF3070D27BB00F78484; - isa = PBXBuildFile; - settings = { - }; - }; -//EF0 -//EF1 -//EF2 -//EF3 -//EF4 -//F90 -//F91 -//F92 -//F93 -//F94 - F906E2230639E96400B13DB2 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.c; - name = dyld_debug.c; - path = src/dyld_debug.c; - refType = 4; - sourceTree = ""; - }; - F906E2240639E96400B13DB2 = { - fileRef = F906E2230639E96400B13DB2; - isa = PBXBuildFile; - settings = { - }; - }; - F913FAD90630A8AE00B7AE9D = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = dyldAPIsInLibSystem.cpp; - path = src/dyldAPIsInLibSystem.cpp; - refType = 4; - sourceTree = ""; - }; - F913FADA0630A8AE00B7AE9D = { - fileRef = F913FAD90630A8AE00B7AE9D; - isa = PBXBuildFile; - settings = { - }; - }; - F921D3160703769A000D1056 = { - compilerSpec = com.apple.compilers.gcc.3_5; - fileType = sourcecode.c; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - ); - }; - F921D317070376A6000D1056 = { - compilerSpec = com.apple.compilers.gcc.3_5; - fileType = sourcecode.c; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - ); - }; - F921D318070376B0000D1056 = { - compilerSpec = com.apple.compilers.gcc.3_5; - fileType = sourcecode.asm; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - ); - }; - F921D31E070376F1000D1056 = { - compilerSpec = com.apple.compilers.gcc.3_5; - fileType = sourcecode.cpp; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - ); - }; - F939F219078F1A2100AC144F = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = dyld_debug.h; - path = "include/mach-o/dyld_debug.h"; - refType = 4; - sourceTree = ""; - }; - F939F21A078F1A2100AC144F = { - fileRef = F939F219078F1A2100AC144F; - isa = PBXBuildFile; - settings = { - }; - }; - F939F21B078F1A2C00AC144F = { - fileRef = F939F219078F1A2100AC144F; - isa = PBXBuildFile; - settings = { - }; - }; - F93AA9A30630AE1E00301D9F = { - fileRef = F9ED4CE80630A80600DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F93AA9A40630AE1E00301D9F = { - fileRef = F9ED4CE90630A80600DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F93AA9A50630AE1E00301D9F = { - fileRef = F9ED4CEA0630A80600DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F93AA9B30630AE8200301D9F = { - buildActionMask = 8; - dstPath = "/usr/include/mach-o"; - dstSubfolderSpec = 0; - files = ( - F939F21B078F1A2C00AC144F, - F93AA9A50630AE1E00301D9F, - ); - isa = PBXCopyFilesBuildPhase; - runOnlyForDeploymentPostprocessing = 1; - }; - F93AA9B60630AEB100301D9F = { - buildActionMask = 8; - dstPath = "/usr/local/include/mach-o"; - dstSubfolderSpec = 0; - files = ( - F93AA9A30630AE1E00301D9F, - F93AA9A40630AE1E00301D9F, - ); - isa = PBXCopyFilesBuildPhase; - runOnlyForDeploymentPostprocessing = 1; - }; - F93AA9C20630AF0700301D9F = { - buildActionMask = 8; - dstPath = /usr/share/man/man1; - dstSubfolderSpec = 0; - files = ( - EF79A010070D293E00F78484, - ); - isa = PBXCopyFilesBuildPhase; - runOnlyForDeploymentPostprocessing = 1; - }; - F93AA9C60630AF1F00301D9F = { - buildActionMask = 8; - dstPath = /usr/share/man/man3; - dstSubfolderSpec = 0; - files = ( - EF79A011070D295200F78484, - EF79A012070D295200F78484, - EF79A013070D295200F78484, - EF79A014070D295200F78484, - EF79A015070D295200F78484, - EF79A016070D295200F78484, - EF79A017070D295200F78484, - EF79A018070D295200F78484, - EF79A019070D295200F78484, - ); - isa = PBXCopyFilesBuildPhase; - runOnlyForDeploymentPostprocessing = 1; - }; - F9574C4906C94DA700142BFA = { - compilerSpec = com.apple.compilers.gcc.3_5; - fileType = sourcecode.c; - isEditable = 1; - isa = PBXBuildRule; - outputFiles = ( - ); - }; - F9574CB206C95C0D00142BFA = { - buildActionMask = 8; - dstPath = /usr/include; - dstSubfolderSpec = 0; - files = ( - F9574CB306C95C1B00142BFA, - ); - isa = PBXCopyFilesBuildPhase; - runOnlyForDeploymentPostprocessing = 1; - }; - F9574CB306C95C1B00142BFA = { - fileRef = F99EE6AE06B48D4200BF1992; - isa = PBXBuildFile; - settings = { - }; - }; - F99EE6AE06B48D4200BF1992 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = dlfcn.h; - path = include/dlfcn.h; - refType = 4; - sourceTree = ""; - }; - F99EE6AF06B48D4200BF1992 = { - fileRef = F99EE6AE06B48D4200BF1992; - isa = PBXBuildFile; - settings = { - }; - }; - F9B01E3D0739ABDE00CF981B = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.exports; - name = dyld.exp; - path = src/dyld.exp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9B01E3E0739ABDE00CF981B = { - fileRef = F9B01E3D0739ABDE00CF981B; - isa = PBXBuildFile; - settings = { - }; - }; - F9CA205D06CBF578000BA084 = { - buildActionMask = 8; - files = ( - ); - inputPaths = ( - "${DSTROOT}/usr/local/lib/system/ldyldapis.a", - ); - isa = PBXShellScriptBuildPhase; - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 1; - shellPath = /bin/sh; - shellScript = "cd ${DSTROOT}/usr/local/lib/system\nln -s libdyldapis.a libdyldapis_profile.a\nln -s libdyldapis.a libdyldapis_debug.a\n"; - }; - F9ED4C870630A72200DF4E74 = { - children = ( - F9ED4CBB0630A7AA00DF4E74, - F9ED4CC30630A7BE00DF4E74, - F9ED4CBE0630A7B100DF4E74, - F9ED4C990630A76000DF4E74, - ); - isa = PBXGroup; - refType = 4; - sourceTree = ""; - }; - F9ED4C890630A72300DF4E74 = { - buildSettings = { - COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = NO; - GCC_OPTIMIZATION_LEVEL = 0; - }; - isa = PBXBuildStyle; - name = Development; - }; - F9ED4C8A0630A72300DF4E74 = { - buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_CPP_RTTI = NO; - }; - isa = PBXBuildStyle; - name = Deployment; - }; - F9ED4C8B0630A72300DF4E74 = { - buildSettings = { - }; - buildStyles = ( - F9ED4C890630A72300DF4E74, - F9ED4C8A0630A72300DF4E74, - ); - hasScannedForEncodings = 1; - isa = PBXProject; - mainGroup = F9ED4C870630A72200DF4E74; - productRefGroup = F9ED4C990630A76000DF4E74; - projectDirPath = ""; - targets = ( - F9ED4C920630A73900DF4E74, - F9ED4C970630A76000DF4E74, - F9ED4C9E0630A76B00DF4E74, - ); - }; - F9ED4C920630A73900DF4E74 = { - buildPhases = ( - ); - buildSettings = { - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = all; - SECTORDER_FLAGS = ""; - WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; - }; - dependencies = ( - F9ED4CA70630A78A00DF4E74, - F9ED4CA90630A78A00DF4E74, - ); - isa = PBXAggregateTarget; - name = all; - productName = all; - }; - F9ED4C950630A76000DF4E74 = { - buildActionMask = 2147483647; - files = ( - F9ED4CDF0630A7F100DF4E74, - F9ED4CD60630A7F100DF4E74, - F9ED4CD70630A7F100DF4E74, - F9ED4CD80630A7F100DF4E74, - F9ED4CD90630A7F100DF4E74, - F9ED4CDA0630A7F100DF4E74, - F9ED4CDB0630A7F100DF4E74, - F9ED4CDE0630A7F100DF4E74, - F9ED4CE00630A7F100DF4E74, - F9ED4CE10630A7F100DF4E74, - F9ED4CE20630A7F100DF4E74, - F9ED4CE30630A7F100DF4E74, - F9ED4CE40630A7F100DF4E74, - F9ED4CE50630A7F100DF4E74, - F9ED4CEB0630A80600DF4E74, - F9ED4CEC0630A80600DF4E74, - F9ED4CED0630A80600DF4E74, - F99EE6AF06B48D4200BF1992, - F9B01E3E0739ABDE00CF981B, - ); - isa = PBXSourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - F9ED4C960630A76000DF4E74 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXFrameworksBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - F9ED4C970630A76000DF4E74 = { - buildPhases = ( - F9ED4C950630A76000DF4E74, - F9ED4C960630A76000DF4E74, - ); - buildRules = ( - F921D318070376B0000D1056, - F921D317070376A6000D1056, - F921D3160703769A000D1056, - ); - buildSettings = { - ARCHS = ppc; - CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)"; - DEAD_CODE_STRIPPING = YES; - EXPORTED_SYMBOLS_FILE = ""; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_CPP_RTTI = NO; - GCC_MODEL_TUNING = G4; - GCC_OPTIMIZATION_LEVEL = 3; - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - HEADER_SEARCH_PATHS = ./include; - INSTALL_PATH = /usr/lib; - LIBRARY_SEARCH_PATHS = ""; - MACOSX_DEPLOYMENT_TARGET = 10.4; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = "-v -seg1addr 8fe00000 -exported_symbols_list src/dyld.exp -nostdlib -lstdc++ /usr/local/lib/system/libc.a -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; - OTHER_REZFLAGS = ""; - PER_ARCH_CFLAGS_ppc = ""; - PER_ARCH_CFLAGS_ppc64 = "-msoft-float"; - PREBINDING = NO; - PRODUCT_NAME = dyld; - STRIPFLAGS = "-S"; - UNSTRIPPED_PRODUCT = NO; - VALID_ARCHS = "ppc ppc64 i386"; - VERSIONING_SYSTEM = "apple-generic"; - WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; - }; - dependencies = ( - ); - isa = PBXNativeTarget; - name = dyld; - productName = dyld; - productReference = F9ED4C980630A76000DF4E74; - productType = "com.apple.product-type.tool"; - }; - F9ED4C980630A76000DF4E74 = { - explicitFileType = "compiled.mach-o.executable"; - includeInIndex = 0; - isa = PBXFileReference; - path = dyld; - refType = 3; - sourceTree = BUILT_PRODUCTS_DIR; - }; - F9ED4C990630A76000DF4E74 = { - children = ( - F9ED4C980630A76000DF4E74, - F9ED4C9F0630A76B00DF4E74, - ); - isa = PBXGroup; - name = Products; - refType = 4; - sourceTree = ""; - }; - F9ED4C9B0630A76B00DF4E74 = { - buildActionMask = 2147483647; - files = ( - F9FE429C06C82066001D8CE5, - F939F21A078F1A2100AC144F, - ); - isa = PBXHeadersBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - F9ED4C9C0630A76B00DF4E74 = { - buildActionMask = 2147483647; - files = ( - F9F256360639DBCC00A7427D, - F9F256370639DBCC00A7427D, - F913FADA0630A8AE00B7AE9D, - F906E2240639E96400B13DB2, - ); - isa = PBXSourcesBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - F9ED4C9D0630A76B00DF4E74 = { - buildActionMask = 2147483647; - files = ( - ); - isa = PBXFrameworksBuildPhase; - runOnlyForDeploymentPostprocessing = 0; - }; - F9ED4C9E0630A76B00DF4E74 = { - buildPhases = ( - F9ED4C9C0630A76B00DF4E74, - F9ED4C9B0630A76B00DF4E74, - F93AA9B30630AE8200301D9F, - F9574CB206C95C0D00142BFA, - F93AA9B60630AEB100301D9F, - F93AA9C20630AF0700301D9F, - F93AA9C60630AF1F00301D9F, - F9CA205D06CBF578000BA084, - F9ED4C9D0630A76B00DF4E74, - ); - buildRules = ( - F921D31E070376F1000D1056, - F9574C4906C94DA700142BFA, - ); - buildSettings = { - ARCHS = ppc; - GCC_ENABLE_CPP_EXCEPTIONS = NO; - HEADER_SEARCH_PATHS = ./include; - INSTALL_PATH = /usr/local/lib/system; - LIBRARY_STYLE = STATIC; - OTHER_CFLAGS = ""; - OTHER_LDFLAGS = ""; - OTHER_REZFLAGS = ""; - PRODUCT_NAME = dyldapis; - SECTORDER_FLAGS = ""; - VALID_ARCHS = "ppc ppc64 i386"; - WARNING_CFLAGS = "-Wmost -Wno-four-char-constants -Wno-unknown-pragmas"; - }; - dependencies = ( - ); - isa = PBXNativeTarget; - name = libdyld; - productName = libdyld; - productReference = F9ED4C9F0630A76B00DF4E74; - productType = "com.apple.product-type.library.static"; - }; - F9ED4C9F0630A76B00DF4E74 = { - explicitFileType = archive.ar; - includeInIndex = 0; - isa = PBXFileReference; - path = libdyldapis.a; - refType = 3; - sourceTree = BUILT_PRODUCTS_DIR; - }; - F9ED4CA60630A78A00DF4E74 = { - containerPortal = F9ED4C8B0630A72300DF4E74; - isa = PBXContainerItemProxy; - proxyType = 1; - remoteGlobalIDString = F9ED4C970630A76000DF4E74; - remoteInfo = dyld; - }; - F9ED4CA70630A78A00DF4E74 = { - isa = PBXTargetDependency; - target = F9ED4C970630A76000DF4E74; - targetProxy = F9ED4CA60630A78A00DF4E74; - }; - F9ED4CA80630A78A00DF4E74 = { - containerPortal = F9ED4C8B0630A72300DF4E74; - isa = PBXContainerItemProxy; - proxyType = 1; - remoteGlobalIDString = F9ED4C9E0630A76B00DF4E74; - remoteInfo = libdyld; - }; - F9ED4CA90630A78A00DF4E74 = { - isa = PBXTargetDependency; - target = F9ED4C9E0630A76B00DF4E74; - targetProxy = F9ED4CA80630A78A00DF4E74; - }; - F9ED4CBB0630A7AA00DF4E74 = { - children = ( - F9ED4CC60630A7F100DF4E74, - F9ED4CC70630A7F100DF4E74, - F9ED4CC80630A7F100DF4E74, - F9FE429B06C82066001D8CE5, - F9ED4CC90630A7F100DF4E74, - F9ED4CCA0630A7F100DF4E74, - F913FAD90630A8AE00B7AE9D, - F9ED4CCB0630A7F100DF4E74, - F9ED4CCC0630A7F100DF4E74, - F9ED4CCD0630A7F100DF4E74, - F9ED4CCE0630A7F100DF4E74, - F9ED4CCF0630A7F100DF4E74, - F9ED4CD00630A7F100DF4E74, - F9ED4CD10630A7F100DF4E74, - F9ED4CD20630A7F100DF4E74, - F9ED4CD30630A7F100DF4E74, - F9ED4CD40630A7F100DF4E74, - F9ED4CD50630A7F100DF4E74, - F9B01E3D0739ABDE00CF981B, - F906E2230639E96400B13DB2, - ); - isa = PBXGroup; - name = src; - refType = 4; - sourceTree = ""; - }; - F9ED4CBE0630A7B100DF4E74 = { - children = ( - F9ED4CE80630A80600DF4E74, - F9ED4CE90630A80600DF4E74, - F939F219078F1A2100AC144F, - F9ED4CEA0630A80600DF4E74, - F99EE6AE06B48D4200BF1992, - ); - isa = PBXGroup; - name = include; - path = ""; - refType = 4; - sourceTree = ""; - }; - F9ED4CC30630A7BE00DF4E74 = { - children = ( - EF799FE7070D27BB00F78484, - ); - isa = PBXGroup; - name = doc; - path = ""; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CC60630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = dyld_gdb.cpp; - path = src/dyld_gdb.cpp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CC70630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = dyld.cpp; - path = src/dyld.cpp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CC80630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = dyld.h; - path = src/dyld.h; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CC90630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = dyldAPIs.cpp; - path = src/dyldAPIs.cpp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CCA0630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.c; - name = dyldExceptions.c; - path = src/dyldExceptions.c; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CCB0630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = dyldInitialization.cpp; - path = src/dyldInitialization.cpp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CCC0630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = dyldLock.cpp; - path = src/dyldLock.cpp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CCD0630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = dyldLock.h; - path = src/dyldLock.h; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CCE0630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = dyldNew.cpp; - path = src/dyldNew.cpp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CCF0630A7F100DF4E74 = { - fileEncoding = 30; - indentWidth = 4; - isa = PBXFileReference; - lastKnownFileType = sourcecode.asm; - name = dyldStartup.s; - path = src/dyldStartup.s; - refType = 2; - sourceTree = SOURCE_ROOT; - tabWidth = 8; - usesTabs = 1; - }; - F9ED4CD00630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.c; - name = glue.c; - path = src/glue.c; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CD10630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = ImageLoader.cpp; - path = src/ImageLoader.cpp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CD20630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = ImageLoader.h; - path = src/ImageLoader.h; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CD30630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.cpp.cpp; - name = ImageLoaderMachO.cpp; - path = src/ImageLoaderMachO.cpp; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CD40630A7F100DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = ImageLoaderMachO.h; - path = src/ImageLoaderMachO.h; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CD50630A7F100DF4E74 = { - fileEncoding = 30; - indentWidth = 4; - isa = PBXFileReference; - lastKnownFileType = sourcecode.asm; - name = stub_binding_helper.s; - path = src/stub_binding_helper.s; - refType = 2; - sourceTree = SOURCE_ROOT; - tabWidth = 8; - usesTabs = 1; - }; - F9ED4CD60630A7F100DF4E74 = { - fileRef = F9ED4CC60630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CD70630A7F100DF4E74 = { - fileRef = F9ED4CC70630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CD80630A7F100DF4E74 = { - fileRef = F9ED4CC80630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CD90630A7F100DF4E74 = { - fileRef = F9ED4CC90630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CDA0630A7F100DF4E74 = { - fileRef = F9ED4CCA0630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CDB0630A7F100DF4E74 = { - fileRef = F9ED4CCB0630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CDE0630A7F100DF4E74 = { - fileRef = F9ED4CCE0630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CDF0630A7F100DF4E74 = { - fileRef = F9ED4CCF0630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CE00630A7F100DF4E74 = { - fileRef = F9ED4CD00630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CE10630A7F100DF4E74 = { - fileRef = F9ED4CD10630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CE20630A7F100DF4E74 = { - fileRef = F9ED4CD20630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CE30630A7F100DF4E74 = { - fileRef = F9ED4CD30630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CE40630A7F100DF4E74 = { - fileRef = F9ED4CD40630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CE50630A7F100DF4E74 = { - fileRef = F9ED4CD50630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CE80630A80600DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = dyld_gdb.h; - path = "include/mach-o/dyld_gdb.h"; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CE90630A80600DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = dyld_priv.h; - path = "include/mach-o/dyld_priv.h"; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CEA0630A80600DF4E74 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = dyld.h; - path = "include/mach-o/dyld.h"; - refType = 2; - sourceTree = SOURCE_ROOT; - }; - F9ED4CEB0630A80600DF4E74 = { - fileRef = F9ED4CE80630A80600DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CEC0630A80600DF4E74 = { - fileRef = F9ED4CE90630A80600DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9ED4CED0630A80600DF4E74 = { - fileRef = F9ED4CEA0630A80600DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9F256360639DBCC00A7427D = { - fileRef = F9ED4CCC0630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9F256370639DBCC00A7427D = { - fileRef = F9ED4CCD0630A7F100DF4E74; - isa = PBXBuildFile; - settings = { - }; - }; - F9FE429B06C82066001D8CE5 = { - fileEncoding = 30; - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.h; - name = dyldLibSystemThreadHelpers.h; - path = src/dyldLibSystemThreadHelpers.h; - refType = 4; - sourceTree = ""; - }; - F9FE429C06C82066001D8CE5 = { - fileRef = F9FE429B06C82066001D8CE5; - isa = PBXBuildFile; - settings = { - }; - }; - }; - rootObject = F9ED4C8B0630A72300DF4E74; -} diff --git a/dyld.xcodeproj/project.pbxproj b/dyld.xcodeproj/project.pbxproj new file mode 100644 index 0000000..23de088 --- /dev/null +++ b/dyld.xcodeproj/project.pbxproj @@ -0,0 +1,880 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + +/* Begin PBXAggregateTarget section */ + F9ED4C920630A73900DF4E74 /* all */ = { + isa = PBXAggregateTarget; + buildConfigurationList = F9D8C7E5087B087300E93EFB /* Build configuration list for PBXAggregateTarget "all" */; + buildPhases = ( + ); + buildSettings = { + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = all; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + dependencies = ( + F9ED4CA70630A78A00DF4E74 /* PBXTargetDependency */, + F9ED4CA90630A78A00DF4E74 /* PBXTargetDependency */, + ); + name = all; + productName = all; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + EF79A010070D293E00F78484 /* dyld.1 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FE9070D27BB00F78484 /* dyld.1 */; }; + EF79A011070D295200F78484 /* dladdr.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FEB070D27BB00F78484 /* dladdr.3 */; }; + EF79A012070D295200F78484 /* dlclose.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FEC070D27BB00F78484 /* dlclose.3 */; }; + EF79A013070D295200F78484 /* dlerror.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FED070D27BB00F78484 /* dlerror.3 */; }; + EF79A014070D295200F78484 /* dlopen.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FEE070D27BB00F78484 /* dlopen.3 */; }; + EF79A015070D295200F78484 /* dlsym.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FEF070D27BB00F78484 /* dlsym.3 */; }; + EF79A016070D295200F78484 /* dyld.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FF0070D27BB00F78484 /* dyld.3 */; }; + EF79A017070D295200F78484 /* NSModule.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FF1070D27BB00F78484 /* NSModule.3 */; }; + EF79A018070D295200F78484 /* NSObjectFileImage.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FF2070D27BB00F78484 /* NSObjectFileImage.3 */; }; + EF79A019070D295200F78484 /* NSObjectFileImage_priv.3 in CopyFiles */ = {isa = PBXBuildFile; fileRef = EF799FF3070D27BB00F78484 /* NSObjectFileImage_priv.3 */; }; + F906E2240639E96400B13DB2 /* dyld_debug.c in Sources */ = {isa = PBXBuildFile; fileRef = F906E2230639E96400B13DB2 /* dyld_debug.c */; }; + F913FADA0630A8AE00B7AE9D /* dyldAPIsInLibSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F913FAD90630A8AE00B7AE9D /* dyldAPIsInLibSystem.cpp */; }; + F939F21A078F1A2100AC144F /* dyld_debug.h in Headers */ = {isa = PBXBuildFile; fileRef = F939F219078F1A2100AC144F /* dyld_debug.h */; }; + F939F21B078F1A2C00AC144F /* dyld_debug.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F939F219078F1A2100AC144F /* dyld_debug.h */; }; + F93AA9A30630AE1E00301D9F /* dyld_gdb.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F9ED4CE80630A80600DF4E74 /* dyld_gdb.h */; }; + F93AA9A40630AE1E00301D9F /* dyld_priv.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F9ED4CE90630A80600DF4E74 /* dyld_priv.h */; }; + F93AA9A50630AE1E00301D9F /* dyld.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F9ED4CEA0630A80600DF4E74 /* dyld.h */; }; + F9574CB306C95C1B00142BFA /* dlfcn.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F99EE6AE06B48D4200BF1992 /* dlfcn.h */; }; + F9ED4CD60630A7F100DF4E74 /* dyld_gdb.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CC60630A7F100DF4E74 /* dyld_gdb.cpp */; }; + F9ED4CD70630A7F100DF4E74 /* dyld.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CC70630A7F100DF4E74 /* dyld.cpp */; }; + F9ED4CD90630A7F100DF4E74 /* dyldAPIs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CC90630A7F100DF4E74 /* dyldAPIs.cpp */; }; + F9ED4CDA0630A7F100DF4E74 /* dyldExceptions.c in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CCA0630A7F100DF4E74 /* dyldExceptions.c */; }; + F9ED4CDB0630A7F100DF4E74 /* dyldInitialization.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CCB0630A7F100DF4E74 /* dyldInitialization.cpp */; }; + F9ED4CDE0630A7F100DF4E74 /* dyldNew.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CCE0630A7F100DF4E74 /* dyldNew.cpp */; }; + F9ED4CDF0630A7F100DF4E74 /* dyldStartup.s in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CCF0630A7F100DF4E74 /* dyldStartup.s */; }; + F9ED4CE00630A7F100DF4E74 /* glue.c in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CD00630A7F100DF4E74 /* glue.c */; }; + F9ED4CE10630A7F100DF4E74 /* ImageLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CD10630A7F100DF4E74 /* ImageLoader.cpp */; }; + F9ED4CE30630A7F100DF4E74 /* ImageLoaderMachO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CD30630A7F100DF4E74 /* ImageLoaderMachO.cpp */; }; + F9ED4CE50630A7F100DF4E74 /* stub_binding_helper.s in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CD50630A7F100DF4E74 /* stub_binding_helper.s */; }; + F9F256360639DBCC00A7427D /* dyldLock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F9ED4CCC0630A7F100DF4E74 /* dyldLock.cpp */; }; + F9FE429C06C82066001D8CE5 /* dyldLibSystemThreadHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = F9FE429B06C82066001D8CE5 /* dyldLibSystemThreadHelpers.h */; }; +/* End PBXBuildFile section */ + +/* Begin PBXBuildRule section */ + F921D3160703769A000D1056 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc.4_0; + fileType = sourcecode.cpp; + isEditable = 1; + outputFiles = ( + ); + }; + F921D317070376A6000D1056 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc.4_0; + fileType = sourcecode.c; + isEditable = 1; + outputFiles = ( + ); + }; + F921D318070376B0000D1056 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc.4_0; + fileType = sourcecode.asm; + isEditable = 1; + outputFiles = ( + ); + }; + F921D31E070376F1000D1056 /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc.4_0; + fileType = sourcecode.cpp; + isEditable = 1; + outputFiles = ( + ); + }; + F9574C4906C94DA700142BFA /* PBXBuildRule */ = { + isa = PBXBuildRule; + compilerSpec = com.apple.compilers.gcc.4_0; + fileType = sourcecode.c; + isEditable = 1; + outputFiles = ( + ); + }; +/* End PBXBuildRule section */ + +/* Begin PBXBuildStyle section */ + F9ED4C890630A72300DF4E74 /* Development */ = { + isa = PBXBuildStyle; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = NO; + GCC_OPTIMIZATION_LEVEL = 0; + }; + name = Development; + }; + F9ED4C8A0630A72300DF4E74 /* Deployment */ = { + isa = PBXBuildStyle; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_CPP_RTTI = NO; + }; + name = Deployment; + }; +/* End PBXBuildStyle section */ + +/* Begin PBXContainerItemProxy section */ + F9ED4CA60630A78A00DF4E74 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = F9ED4C8B0630A72300DF4E74 /* Project object */; + proxyType = 1; + remoteGlobalIDString = F9ED4C970630A76000DF4E74; + remoteInfo = dyld; + }; + F9ED4CA80630A78A00DF4E74 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = F9ED4C8B0630A72300DF4E74 /* Project object */; + proxyType = 1; + remoteGlobalIDString = F9ED4C9E0630A76B00DF4E74; + remoteInfo = libdyld; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + F93AA9B30630AE8200301D9F /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = "/usr/include/mach-o"; + dstSubfolderSpec = 0; + files = ( + F939F21B078F1A2C00AC144F /* dyld_debug.h in CopyFiles */, + F93AA9A50630AE1E00301D9F /* dyld.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + F93AA9B60630AEB100301D9F /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = "/usr/local/include/mach-o"; + dstSubfolderSpec = 0; + files = ( + F93AA9A30630AE1E00301D9F /* dyld_gdb.h in CopyFiles */, + F93AA9A40630AE1E00301D9F /* dyld_priv.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + F93AA9C20630AF0700301D9F /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man1; + dstSubfolderSpec = 0; + files = ( + EF79A010070D293E00F78484 /* dyld.1 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + F93AA9C60630AF1F00301D9F /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/share/man/man3; + dstSubfolderSpec = 0; + files = ( + EF79A011070D295200F78484 /* dladdr.3 in CopyFiles */, + EF79A012070D295200F78484 /* dlclose.3 in CopyFiles */, + EF79A013070D295200F78484 /* dlerror.3 in CopyFiles */, + EF79A014070D295200F78484 /* dlopen.3 in CopyFiles */, + EF79A015070D295200F78484 /* dlsym.3 in CopyFiles */, + EF79A016070D295200F78484 /* dyld.3 in CopyFiles */, + EF79A017070D295200F78484 /* NSModule.3 in CopyFiles */, + EF79A018070D295200F78484 /* NSObjectFileImage.3 in CopyFiles */, + EF79A019070D295200F78484 /* NSObjectFileImage_priv.3 in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + F9574CB206C95C0D00142BFA /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /usr/include; + dstSubfolderSpec = 0; + files = ( + F9574CB306C95C1B00142BFA /* dlfcn.h in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + EF799FE9070D27BB00F78484 /* dyld.1 */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = text.man; name = dyld.1; path = doc/man/man1/dyld.1; sourceTree = SOURCE_ROOT; }; + EF799FEB070D27BB00F78484 /* dladdr.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = dladdr.3; path = doc/man/man3/dladdr.3; sourceTree = SOURCE_ROOT; }; + EF799FEC070D27BB00F78484 /* dlclose.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = dlclose.3; path = doc/man/man3/dlclose.3; sourceTree = SOURCE_ROOT; }; + EF799FED070D27BB00F78484 /* dlerror.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = dlerror.3; path = doc/man/man3/dlerror.3; sourceTree = SOURCE_ROOT; }; + EF799FEE070D27BB00F78484 /* dlopen.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = dlopen.3; path = doc/man/man3/dlopen.3; sourceTree = SOURCE_ROOT; }; + EF799FEF070D27BB00F78484 /* dlsym.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = dlsym.3; path = doc/man/man3/dlsym.3; sourceTree = SOURCE_ROOT; }; + EF799FF0070D27BB00F78484 /* dyld.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = dyld.3; path = doc/man/man3/dyld.3; sourceTree = SOURCE_ROOT; }; + EF799FF1070D27BB00F78484 /* NSModule.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = NSModule.3; path = doc/man/man3/NSModule.3; sourceTree = SOURCE_ROOT; }; + EF799FF2070D27BB00F78484 /* NSObjectFileImage.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = NSObjectFileImage.3; path = doc/man/man3/NSObjectFileImage.3; sourceTree = SOURCE_ROOT; }; + EF799FF3070D27BB00F78484 /* NSObjectFileImage_priv.3 */ = {isa = PBXFileReference; explicitFileType = text.man; fileEncoding = 30; name = NSObjectFileImage_priv.3; path = doc/man/man3/NSObjectFileImage_priv.3; sourceTree = SOURCE_ROOT; }; + F906E2230639E96400B13DB2 /* dyld_debug.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dyld_debug.c; path = src/dyld_debug.c; sourceTree = ""; }; + F913FAD90630A8AE00B7AE9D /* dyldAPIsInLibSystem.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = dyldAPIsInLibSystem.cpp; path = src/dyldAPIsInLibSystem.cpp; sourceTree = ""; }; + F939F219078F1A2100AC144F /* dyld_debug.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dyld_debug.h; path = "include/mach-o/dyld_debug.h"; sourceTree = ""; }; + F99EE6AE06B48D4200BF1992 /* dlfcn.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dlfcn.h; path = include/dlfcn.h; sourceTree = ""; }; + F9B01E3D0739ABDE00CF981B /* dyld.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; name = dyld.exp; path = src/dyld.exp; sourceTree = SOURCE_ROOT; }; + F9ED4C980630A76000DF4E74 /* dyld */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = dyld; sourceTree = BUILT_PRODUCTS_DIR; }; + F9ED4C9F0630A76B00DF4E74 /* libdyldapis.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libdyldapis.a; sourceTree = BUILT_PRODUCTS_DIR; }; + F9ED4CC60630A7F100DF4E74 /* dyld_gdb.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = dyld_gdb.cpp; path = src/dyld_gdb.cpp; sourceTree = SOURCE_ROOT; }; + F9ED4CC70630A7F100DF4E74 /* dyld.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = dyld.cpp; path = src/dyld.cpp; sourceTree = SOURCE_ROOT; }; + F9ED4CC80630A7F100DF4E74 /* dyld.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dyld.h; path = src/dyld.h; sourceTree = SOURCE_ROOT; }; + F9ED4CC90630A7F100DF4E74 /* dyldAPIs.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = dyldAPIs.cpp; path = src/dyldAPIs.cpp; sourceTree = SOURCE_ROOT; }; + F9ED4CCA0630A7F100DF4E74 /* dyldExceptions.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = dyldExceptions.c; path = src/dyldExceptions.c; sourceTree = SOURCE_ROOT; }; + F9ED4CCB0630A7F100DF4E74 /* dyldInitialization.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = dyldInitialization.cpp; path = src/dyldInitialization.cpp; sourceTree = SOURCE_ROOT; }; + F9ED4CCC0630A7F100DF4E74 /* dyldLock.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = dyldLock.cpp; path = src/dyldLock.cpp; sourceTree = SOURCE_ROOT; }; + F9ED4CCD0630A7F100DF4E74 /* dyldLock.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dyldLock.h; path = src/dyldLock.h; sourceTree = SOURCE_ROOT; }; + F9ED4CCE0630A7F100DF4E74 /* dyldNew.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = dyldNew.cpp; path = src/dyldNew.cpp; sourceTree = SOURCE_ROOT; }; + F9ED4CCF0630A7F100DF4E74 /* dyldStartup.s */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.asm; name = dyldStartup.s; path = src/dyldStartup.s; sourceTree = SOURCE_ROOT; tabWidth = 8; usesTabs = 1; }; + F9ED4CD00630A7F100DF4E74 /* glue.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = glue.c; path = src/glue.c; sourceTree = SOURCE_ROOT; }; + F9ED4CD10630A7F100DF4E74 /* ImageLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ImageLoader.cpp; path = src/ImageLoader.cpp; sourceTree = SOURCE_ROOT; }; + F9ED4CD20630A7F100DF4E74 /* ImageLoader.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ImageLoader.h; path = src/ImageLoader.h; sourceTree = SOURCE_ROOT; }; + F9ED4CD30630A7F100DF4E74 /* ImageLoaderMachO.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ImageLoaderMachO.cpp; path = src/ImageLoaderMachO.cpp; sourceTree = SOURCE_ROOT; }; + F9ED4CD40630A7F100DF4E74 /* ImageLoaderMachO.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ImageLoaderMachO.h; path = src/ImageLoaderMachO.h; sourceTree = SOURCE_ROOT; }; + F9ED4CD50630A7F100DF4E74 /* stub_binding_helper.s */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.asm; name = stub_binding_helper.s; path = src/stub_binding_helper.s; sourceTree = SOURCE_ROOT; tabWidth = 8; usesTabs = 1; }; + F9ED4CE80630A80600DF4E74 /* dyld_gdb.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dyld_gdb.h; path = "include/mach-o/dyld_gdb.h"; sourceTree = SOURCE_ROOT; }; + F9ED4CE90630A80600DF4E74 /* dyld_priv.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dyld_priv.h; path = "include/mach-o/dyld_priv.h"; sourceTree = SOURCE_ROOT; }; + F9ED4CEA0630A80600DF4E74 /* dyld.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dyld.h; path = "include/mach-o/dyld.h"; sourceTree = SOURCE_ROOT; }; + F9FE429B06C82066001D8CE5 /* dyldLibSystemThreadHelpers.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = dyldLibSystemThreadHelpers.h; path = src/dyldLibSystemThreadHelpers.h; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + F9ED4C960630A76000DF4E74 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F9ED4C9D0630A76B00DF4E74 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + EF799FE7070D27BB00F78484 /* man */ = { + isa = PBXGroup; + children = ( + EF799FE8070D27BB00F78484 /* man1 */, + EF799FEA070D27BB00F78484 /* man3 */, + ); + name = man; + path = doc/man; + sourceTree = SOURCE_ROOT; + }; + EF799FE8070D27BB00F78484 /* man1 */ = { + isa = PBXGroup; + children = ( + EF799FE9070D27BB00F78484 /* dyld.1 */, + ); + name = man1; + path = doc/man/man1; + sourceTree = SOURCE_ROOT; + }; + EF799FEA070D27BB00F78484 /* man3 */ = { + isa = PBXGroup; + children = ( + EF799FEB070D27BB00F78484 /* dladdr.3 */, + EF799FEC070D27BB00F78484 /* dlclose.3 */, + EF799FED070D27BB00F78484 /* dlerror.3 */, + EF799FEE070D27BB00F78484 /* dlopen.3 */, + EF799FEF070D27BB00F78484 /* dlsym.3 */, + EF799FF0070D27BB00F78484 /* dyld.3 */, + EF799FF1070D27BB00F78484 /* NSModule.3 */, + EF799FF2070D27BB00F78484 /* NSObjectFileImage.3 */, + EF799FF3070D27BB00F78484 /* NSObjectFileImage_priv.3 */, + ); + name = man3; + path = doc/man/man3; + sourceTree = SOURCE_ROOT; + }; + F9ED4C870630A72200DF4E74 = { + isa = PBXGroup; + children = ( + F9ED4CBB0630A7AA00DF4E74 /* src */, + F9ED4CC30630A7BE00DF4E74 /* doc */, + F9ED4CBE0630A7B100DF4E74 /* include */, + F9ED4C990630A76000DF4E74 /* Products */, + ); + sourceTree = ""; + }; + F9ED4C990630A76000DF4E74 /* Products */ = { + isa = PBXGroup; + children = ( + F9ED4C980630A76000DF4E74 /* dyld */, + F9ED4C9F0630A76B00DF4E74 /* libdyldapis.a */, + ); + name = Products; + sourceTree = ""; + }; + F9ED4CBB0630A7AA00DF4E74 /* src */ = { + isa = PBXGroup; + children = ( + F9ED4CC60630A7F100DF4E74 /* dyld_gdb.cpp */, + F9ED4CC70630A7F100DF4E74 /* dyld.cpp */, + F9ED4CC80630A7F100DF4E74 /* dyld.h */, + F9FE429B06C82066001D8CE5 /* dyldLibSystemThreadHelpers.h */, + F9ED4CC90630A7F100DF4E74 /* dyldAPIs.cpp */, + F9ED4CCA0630A7F100DF4E74 /* dyldExceptions.c */, + F913FAD90630A8AE00B7AE9D /* dyldAPIsInLibSystem.cpp */, + F9ED4CCB0630A7F100DF4E74 /* dyldInitialization.cpp */, + F9ED4CCC0630A7F100DF4E74 /* dyldLock.cpp */, + F9ED4CCD0630A7F100DF4E74 /* dyldLock.h */, + F9ED4CCE0630A7F100DF4E74 /* dyldNew.cpp */, + F9ED4CCF0630A7F100DF4E74 /* dyldStartup.s */, + F9ED4CD00630A7F100DF4E74 /* glue.c */, + F9ED4CD10630A7F100DF4E74 /* ImageLoader.cpp */, + F9ED4CD20630A7F100DF4E74 /* ImageLoader.h */, + F9ED4CD30630A7F100DF4E74 /* ImageLoaderMachO.cpp */, + F9ED4CD40630A7F100DF4E74 /* ImageLoaderMachO.h */, + F9ED4CD50630A7F100DF4E74 /* stub_binding_helper.s */, + F9B01E3D0739ABDE00CF981B /* dyld.exp */, + F906E2230639E96400B13DB2 /* dyld_debug.c */, + ); + name = src; + sourceTree = ""; + }; + F9ED4CBE0630A7B100DF4E74 /* include */ = { + isa = PBXGroup; + children = ( + F9ED4CE80630A80600DF4E74 /* dyld_gdb.h */, + F9ED4CE90630A80600DF4E74 /* dyld_priv.h */, + F939F219078F1A2100AC144F /* dyld_debug.h */, + F9ED4CEA0630A80600DF4E74 /* dyld.h */, + F99EE6AE06B48D4200BF1992 /* dlfcn.h */, + ); + name = include; + sourceTree = ""; + }; + F9ED4CC30630A7BE00DF4E74 /* doc */ = { + isa = PBXGroup; + children = ( + EF799FE7070D27BB00F78484 /* man */, + ); + name = doc; + sourceTree = SOURCE_ROOT; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + F9ED4C9B0630A76B00DF4E74 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + F9FE429C06C82066001D8CE5 /* dyldLibSystemThreadHelpers.h in Headers */, + F939F21A078F1A2100AC144F /* dyld_debug.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + F9ED4C970630A76000DF4E74 /* dyld */ = { + isa = PBXNativeTarget; + buildConfigurationList = F9D8C7DD087B087300E93EFB /* Build configuration list for PBXNativeTarget "dyld" */; + buildPhases = ( + F9ED4C950630A76000DF4E74 /* Sources */, + F9ED4C960630A76000DF4E74 /* Frameworks */, + ); + buildRules = ( + F921D318070376B0000D1056 /* PBXBuildRule */, + F921D317070376A6000D1056 /* PBXBuildRule */, + F921D3160703769A000D1056 /* PBXBuildRule */, + ); + buildSettings = { + ARCHS = ppc; + CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)"; + DEAD_CODE_STRIPPING = YES; + EXPORTED_SYMBOLS_FILE = ""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_MODEL_TUNING = G4; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ./include; + INSTALL_PATH = /usr/lib; + LIBRARY_SEARCH_PATHS = ""; + MACOSX_DEPLOYMENT_TARGET = 10.4; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ( + "-v", + "-seg1addr", + 8fe00000, + "-exported_symbols_list", + src/dyld.exp, + "-nostdlib", + "-lstdc++", + /usr/local/lib/system/libc.a, + "-lgcc", + "-Wl,-e,__dyld_start", + "-Wl,-dylinker", + "-Wl,-dylinker_install_name,/usr/lib/dyld", + ); + OTHER_REZFLAGS = ""; + PER_ARCH_CFLAGS_ppc = ""; + PER_ARCH_CFLAGS_ppc64 = "-msoft-float"; + PREBINDING = NO; + PRODUCT_NAME = dyld; + STRIPFLAGS = "-S"; + UNSTRIPPED_PRODUCT = NO; + VALID_ARCHS = "ppc ppc64 i386"; + VERSIONING_SYSTEM = "apple-generic"; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + dependencies = ( + ); + name = dyld; + productName = dyld; + productReference = F9ED4C980630A76000DF4E74 /* dyld */; + productType = "com.apple.product-type.tool"; + }; + F9ED4C9E0630A76B00DF4E74 /* libdyld */ = { + isa = PBXNativeTarget; + buildConfigurationList = F9D8C7E1087B087300E93EFB /* Build configuration list for PBXNativeTarget "libdyld" */; + buildPhases = ( + F9ED4C9C0630A76B00DF4E74 /* Sources */, + F9ED4C9B0630A76B00DF4E74 /* Headers */, + F93AA9B30630AE8200301D9F /* CopyFiles */, + F9574CB206C95C0D00142BFA /* CopyFiles */, + F93AA9B60630AEB100301D9F /* CopyFiles */, + F93AA9C20630AF0700301D9F /* CopyFiles */, + F93AA9C60630AF1F00301D9F /* CopyFiles */, + F9CA205D06CBF578000BA084 /* ShellScript */, + F9ED4C9D0630A76B00DF4E74 /* Frameworks */, + ); + buildRules = ( + F921D31E070376F1000D1056 /* PBXBuildRule */, + F9574C4906C94DA700142BFA /* PBXBuildRule */, + ); + buildSettings = { + ARCHS = ppc; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + HEADER_SEARCH_PATHS = ./include; + INSTALL_PATH = /usr/local/lib/system; + LIBRARY_STYLE = STATIC; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = dyldapis; + SECTORDER_FLAGS = ""; + VALID_ARCHS = "ppc ppc64 i386"; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + dependencies = ( + ); + name = libdyld; + productName = libdyld; + productReference = F9ED4C9F0630A76B00DF4E74 /* libdyldapis.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + F9ED4C8B0630A72300DF4E74 /* Project object */ = { + isa = PBXProject; + buildConfigurationList = F9D8C7E9087B087300E93EFB /* Build configuration list for PBXProject "dyld" */; + buildSettings = { + }; + buildStyles = ( + F9ED4C890630A72300DF4E74 /* Development */, + F9ED4C8A0630A72300DF4E74 /* Deployment */, + ); + hasScannedForEncodings = 1; + mainGroup = F9ED4C870630A72200DF4E74; + productRefGroup = F9ED4C990630A76000DF4E74 /* Products */; + projectDirPath = ""; + targets = ( + F9ED4C920630A73900DF4E74 /* all */, + F9ED4C970630A76000DF4E74 /* dyld */, + F9ED4C9E0630A76B00DF4E74 /* libdyld */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + F9CA205D06CBF578000BA084 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + "${DSTROOT}/usr/local/lib/system/ldyldapis.a", + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/sh; + shellScript = "cd ${DSTROOT}/usr/local/lib/system\nln -s libdyldapis.a libdyldapis_profile.a\nln -s libdyldapis.a libdyldapis_debug.a\n"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + F9ED4C950630A76000DF4E74 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F9ED4CDF0630A7F100DF4E74 /* dyldStartup.s in Sources */, + F9ED4CD60630A7F100DF4E74 /* dyld_gdb.cpp in Sources */, + F9ED4CD70630A7F100DF4E74 /* dyld.cpp in Sources */, + F9ED4CD90630A7F100DF4E74 /* dyldAPIs.cpp in Sources */, + F9ED4CDA0630A7F100DF4E74 /* dyldExceptions.c in Sources */, + F9ED4CDB0630A7F100DF4E74 /* dyldInitialization.cpp in Sources */, + F9ED4CDE0630A7F100DF4E74 /* dyldNew.cpp in Sources */, + F9ED4CE00630A7F100DF4E74 /* glue.c in Sources */, + F9ED4CE10630A7F100DF4E74 /* ImageLoader.cpp in Sources */, + F9ED4CE30630A7F100DF4E74 /* ImageLoaderMachO.cpp in Sources */, + F9ED4CE50630A7F100DF4E74 /* stub_binding_helper.s in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + F9ED4C9C0630A76B00DF4E74 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + F9F256360639DBCC00A7427D /* dyldLock.cpp in Sources */, + F913FADA0630A8AE00B7AE9D /* dyldAPIsInLibSystem.cpp in Sources */, + F906E2240639E96400B13DB2 /* dyld_debug.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + F9ED4CA70630A78A00DF4E74 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F9ED4C970630A76000DF4E74 /* dyld */; + targetProxy = F9ED4CA60630A78A00DF4E74 /* PBXContainerItemProxy */; + }; + F9ED4CA90630A78A00DF4E74 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = F9ED4C9E0630A76B00DF4E74 /* libdyld */; + targetProxy = F9ED4CA80630A78A00DF4E74 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + F9D8C7DE087B087300E93EFB /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)"; + DEAD_CODE_STRIPPING = NO; + EXPORTED_SYMBOLS_FILE = ""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_MODEL_TUNING = G4; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ./include; + INSTALL_PATH = /usr/lib; + LIBRARY_SEARCH_PATHS = ""; + MACOSX_DEPLOYMENT_TARGET = 10.4; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS_i386 = "/usr/lib/gcc/i686-apple-darwin8/4.0.0/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_LDFLAGS_ppc = "/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_LDFLAGS_ppc64 = "/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/ppc64/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld64.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_REZFLAGS = ""; + PER_ARCH_CFLAGS_ppc = ""; + PER_ARCH_CFLAGS_ppc64 = "-msoft-float"; + PREBINDING = NO; + PRODUCT_NAME = dyld; + STRIPFLAGS = "-S"; + UNSTRIPPED_PRODUCT = NO; + VALID_ARCHS = "ppc ppc64 i386"; + VERSIONING_SYSTEM = "apple-generic"; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + F9D8C7DF087B087300E93EFB /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + COPY_PHASE_STRIP = YES; + CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)"; + DEAD_CODE_STRIPPING = YES; + EXPORTED_SYMBOLS_FILE = ""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_MODEL_TUNING = G4; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ./include; + INSTALL_PATH = /usr/lib; + LIBRARY_SEARCH_PATHS = ""; + MACOSX_DEPLOYMENT_TARGET = 10.4; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS_i386 = "/usr/lib/gcc/i686-apple-darwin8/4.0.0/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_LDFLAGS_ppc = "/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_LDFLAGS_ppc64 = "/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/ppc64/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld64.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_REZFLAGS = ""; + PER_ARCH_CFLAGS_ppc = ""; + PER_ARCH_CFLAGS_ppc64 = "-msoft-float"; + PREBINDING = NO; + PRODUCT_NAME = dyld; + STRIPFLAGS = "-S"; + UNSTRIPPED_PRODUCT = NO; + VALID_ARCHS = "ppc ppc64 i386"; + VERSIONING_SYSTEM = "apple-generic"; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Deployment; + }; + F9D8C7E0087B087300E93EFB /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + CURRENT_PROJECT_VERSION = "$(RC_ProjectSourceVersion)"; + DEAD_CODE_STRIPPING = YES; + EXPORTED_SYMBOLS_FILE = ""; + GCC_DYNAMIC_NO_PIC = NO; + GCC_ENABLE_CPP_RTTI = NO; + GCC_MODEL_TUNING = G4; + GCC_OPTIMIZATION_LEVEL = 3; + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + HEADER_SEARCH_PATHS = ./include; + INSTALL_PATH = /usr/lib; + LIBRARY_SEARCH_PATHS = ""; + MACOSX_DEPLOYMENT_TARGET = 10.4; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS_i386 = "/usr/lib/gcc/i686-apple-darwin8/4.0.0/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_LDFLAGS_ppc = "/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_LDFLAGS_ppc64 = "/usr/lib/gcc/powerpc-apple-darwin8/4.0.0/ppc64/libstdc++.a -seg1addr 8fe00000 -exported_symbols_list src/dyld64.exp -nostdlib /usr/local/lib/system/libc.a -lgcc_eh -lgcc -Wl,-e,__dyld_start -Wl,-dylinker -Wl,-dylinker_install_name,/usr/lib/dyld"; + OTHER_REZFLAGS = ""; + PER_ARCH_CFLAGS_ppc = ""; + PER_ARCH_CFLAGS_ppc64 = "-msoft-float"; + PREBINDING = NO; + PRODUCT_NAME = dyld; + STRIPFLAGS = "-S"; + UNSTRIPPED_PRODUCT = NO; + VALID_ARCHS = "ppc ppc64 i386"; + VERSIONING_SYSTEM = "apple-generic"; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Default; + }; + F9D8C7E2087B087300E93EFB /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = NO; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_OPTIMIZATION_LEVEL = 0; + HEADER_SEARCH_PATHS = ./include; + INSTALL_PATH = /usr/local/lib/system; + LIBRARY_STYLE = STATIC; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = dyldapis; + SECTORDER_FLAGS = ""; + VALID_ARCHS = "ppc ppc64 i386"; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + F9D8C7E3087B087300E93EFB /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + COPY_PHASE_STRIP = YES; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + GCC_ENABLE_CPP_RTTI = NO; + HEADER_SEARCH_PATHS = ./include; + INSTALL_PATH = /usr/local/lib/system; + LIBRARY_STYLE = STATIC; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = dyldapis; + SECTORDER_FLAGS = ""; + VALID_ARCHS = "ppc ppc64 i386"; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Deployment; + }; + F9D8C7E4087B087300E93EFB /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = ppc; + GCC_ENABLE_CPP_EXCEPTIONS = NO; + HEADER_SEARCH_PATHS = ./include; + INSTALL_PATH = /usr/local/lib/system; + LIBRARY_STYLE = STATIC; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = dyldapis; + SECTORDER_FLAGS = ""; + VALID_ARCHS = "ppc ppc64 i386"; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Default; + }; + F9D8C7E6087B087300E93EFB /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = NO; + DEAD_CODE_STRIPPING = NO; + GCC_OPTIMIZATION_LEVEL = 0; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = all; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Development; + }; + F9D8C7E7087B087300E93EFB /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + COPY_PHASE_STRIP = YES; + GCC_ENABLE_CPP_RTTI = NO; + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = all; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Deployment; + }; + F9D8C7E8087B087300E93EFB /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + OTHER_CFLAGS = ""; + OTHER_LDFLAGS = ""; + OTHER_REZFLAGS = ""; + PRODUCT_NAME = all; + SECTORDER_FLAGS = ""; + WARNING_CFLAGS = ( + "-Wmost", + "-Wno-four-char-constants", + "-Wno-unknown-pragmas", + ); + }; + name = Default; + }; + F9D8C7EA087B087300E93EFB /* Development */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Development; + }; + F9D8C7EB087B087300E93EFB /* Deployment */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Deployment; + }; + F9D8C7EC087B087300E93EFB /* Default */ = { + isa = XCBuildConfiguration; + buildSettings = { + }; + name = Default; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + F9D8C7DD087B087300E93EFB /* Build configuration list for PBXNativeTarget "dyld" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9D8C7DE087B087300E93EFB /* Development */, + F9D8C7DF087B087300E93EFB /* Deployment */, + F9D8C7E0087B087300E93EFB /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; + F9D8C7E1087B087300E93EFB /* Build configuration list for PBXNativeTarget "libdyld" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9D8C7E2087B087300E93EFB /* Development */, + F9D8C7E3087B087300E93EFB /* Deployment */, + F9D8C7E4087B087300E93EFB /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; + F9D8C7E5087B087300E93EFB /* Build configuration list for PBXAggregateTarget "all" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9D8C7E6087B087300E93EFB /* Development */, + F9D8C7E7087B087300E93EFB /* Deployment */, + F9D8C7E8087B087300E93EFB /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; + F9D8C7E9087B087300E93EFB /* Build configuration list for PBXProject "dyld" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F9D8C7EA087B087300E93EFB /* Development */, + F9D8C7EB087B087300E93EFB /* Deployment */, + F9D8C7EC087B087300E93EFB /* Default */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Default; + }; +/* End XCConfigurationList section */ + }; + rootObject = F9ED4C8B0630A72300DF4E74 /* Project object */; +} diff --git a/src/ImageLoader.cpp b/src/ImageLoader.cpp index f3d770e..a249245 100644 --- a/src/ImageLoader.cpp +++ b/src/ImageLoader.cpp @@ -506,6 +506,7 @@ void ImageLoader::recursiveLoadLibraries(const LinkContext& context) const char* referencedFrom = this->getPath(); char buf[strlen(requiredLib.name)+strlen(referencedFrom)+strlen(formatString)+strlen(msg)+2]; sprintf(buf, formatString, requiredLib.name, referencedFrom, msg); + fLibrariesLoaded = false; throw strdup(buf); // this is a leak if exception doesn't halt program } // ok if weak library not found diff --git a/src/ImageLoaderMachO.cpp b/src/ImageLoaderMachO.cpp index d89b1da..90ffe01 100644 --- a/src/ImageLoaderMachO.cpp +++ b/src/ImageLoaderMachO.cpp @@ -1798,6 +1798,11 @@ void ImageLoaderMachO::doBindExternalRelocations(const LinkContext& context, boo continue; uintptr_t* location = ((uintptr_t*)(reloc->r_address + relocBase)); uintptr_t value = *location; + #if __i386__ + if ( reloc->r_pcrel ) { + value += (uintptr_t)location + 4 - fSlide; + } + #endif if ( prebound ) { // we are doing relocations, so prebinding was not usable // in a prebound executable, the n_value field is set to the address where the symbol was found when prebound @@ -1827,7 +1832,16 @@ void ImageLoaderMachO::doBindExternalRelocations(const LinkContext& context, boo } } value += symbolAddr; - *location = value; + #if __i386__ + if ( reloc->r_pcrel ) { + *location = value - ((uintptr_t)location + 4); + } + else { + *location = value; + } + #else + *location = value; + #endif } break; default: diff --git a/src/dyld.cpp b/src/dyld.cpp index c747bbd..28b2cf9 100644 --- a/src/dyld.cpp +++ b/src/dyld.cpp @@ -116,6 +116,7 @@ static const struct mach_header* sMainExecutableMachHeader = NULL; static cpu_type_t sHostCPU; static cpu_subtype_t sHostCPUsubtype; static ImageLoader* sMainExecutable = NULL; +static bool sAllImagesMightContainUnlinkedImages; // necessary until will support dylib unloading static std::vector sAllImages; static std::vector sImageRoots; static std::vector sImageFilesNeedingTermination; @@ -652,7 +653,7 @@ void processDyldEnvironmentVarible(const char* key, const char* value) } } -static void checkEnvironmentVariables(const char* envp[]) +static void checkEnvironmentVariables(const char* envp[], bool ignoreEnviron) { const char* home = NULL; const char** p; @@ -660,7 +661,7 @@ static void checkEnvironmentVariables(const char* envp[]) const char* keyEqualsValue = *p; if ( strncmp(keyEqualsValue, "DYLD_", 5) == 0 ) { const char* equals = strchr(keyEqualsValue, '='); - if ( equals != NULL ) { + if ( (equals != NULL) && !ignoreEnviron ) { const char* value = &equals[1]; const int keyLen = equals-keyEqualsValue; char key[keyLen+1]; @@ -741,15 +742,36 @@ bool validImage(ImageLoader* possibleImage) uint32_t getImageCount() { - return sAllImages.size(); + if ( sAllImagesMightContainUnlinkedImages ) { + uint32_t count = 0; + for (std::vector::iterator it=sAllImages.begin(); it != sAllImages.end(); it++) { + if ( (*it)->isLinked() ) + ++count; + } + return count; + } + else { + return sAllImages.size(); + } } ImageLoader* getIndexedImage(unsigned int index) { - if ( index < sAllImages.size() ) - return sAllImages[index]; - else - return NULL; + if ( sAllImagesMightContainUnlinkedImages ) { + uint32_t count = 0; + for (std::vector::iterator it=sAllImages.begin(); it != sAllImages.end(); it++) { + if ( (*it)->isLinked() ) { + if ( index == count ) + return *it; + ++count; + } + } + } + else { + if ( index < sAllImages.size() ) + return sAllImages[index]; + } + return NULL; } ImageLoader* findImageByMachHeader(const struct mach_header* target) @@ -1152,7 +1174,7 @@ static ImageLoader* loadPhase6(int fd, struct stat& stat_buf, const char* path, pread(fd, firstPage, 4096, fileOffset); } else { - throw "no matching architecture in fat wrapper"; + throw "no matching architecture in universal wrapper"; } } @@ -1435,8 +1457,8 @@ static ImageLoader* loadPhase1(const char* path, const LoadContext& context, std if ( image != NULL ) return image; - // try fallback paths - if ( (sEnv.DYLD_FALLBACK_FRAMEWORK_PATH != NULL) || (sEnv.DYLD_FALLBACK_LIBRARY_PATH != NULL) ) { + // try fallback paths during second time (will open file) + if ( (exceptions != NULL) && ((sEnv.DYLD_FALLBACK_FRAMEWORK_PATH != NULL) || (sEnv.DYLD_FALLBACK_LIBRARY_PATH != NULL)) ) { image = loadPhase2(path, context, sEnv.DYLD_FALLBACK_FRAMEWORK_PATH, sEnv.DYLD_FALLBACK_LIBRARY_PATH, exceptions); if ( image != NULL ) return image; @@ -1561,6 +1583,20 @@ ImageLoader* cloneImage(ImageLoader* image) ImageLoader* loadFromMemory(const uint8_t* mem, uint64_t len, const char* moduleName) { + // if fat wrapper, find usable sub-file + const fat_header* memStartAsFat = (fat_header*)mem; + uint64_t fileOffset = 0; + uint64_t fileLength = len; + if ( memStartAsFat->magic == OSSwapBigToHostInt32(FAT_MAGIC) ) { + if ( fatFindBest(memStartAsFat, &fileOffset, &fileLength) ) { + mem = &mem[fileOffset]; + len = fileLength; + } + else { + throw "no matching architecture in universal wrapper"; + } + } + // try mach-o each loader if ( isCompatibleMachO(mem) ) { ImageLoader* image = new ImageLoaderMachO(moduleName, (mach_header*)mem, len, gLinkContext); @@ -1829,7 +1865,23 @@ static void setContext(int argc, const char* argv[], const char* envp[], const c gLinkContext.apple = apple; } - +static bool checkEmulation() +{ +#if __i386__ + int mib[] = { CTL_KERN, KERN_CLASSIC, getpid() }; + int is_classic = 0; + size_t len = sizeof(int); + int ret = sysctl(mib, 3, &is_classic, &len, NULL, 0); + if ((ret != -1) && is_classic) { + // When a 32-bit ppc program is run under emulation on an Intel processor, + // we want any i386 dylibs (e.g. the emulator) to not load in the shared region + // because the shared region is being used by ppc dylibs + gLinkContext.sharedRegionMode = ImageLoader::kDontUseSharedRegion; + return true; + } +#endif + return false; +} void link(ImageLoader* image, ImageLoader::BindingLaziness bindness, ImageLoader::InitializerRunning runInitializers) { @@ -1851,7 +1903,13 @@ void link(ImageLoader* image, ImageLoader::BindingLaziness bindness, ImageLoader } // process images - image->link(gLinkContext, bindness, runInitializers, sAddImageCallbacks.size()); + try { + image->link(gLinkContext, bindness, runInitializers, sAddImageCallbacks.size()); + } + catch (const char* msg) { + sAllImagesMightContainUnlinkedImages = true; + throw msg; + } #if OLD_GDB_DYLD_INTERFACE // notify gdb that loaded libraries have changed @@ -1885,7 +1943,8 @@ _main(const struct mach_header* mainExecutableMH, int argc, const char* argv[], } uintptr_t result = 0; sMainExecutableMachHeader = mainExecutableMH; - checkEnvironmentVariables(envp); + bool isEmulated = checkEmulation(); + checkEnvironmentVariables(envp, isEmulated); if ( sEnv.DYLD_PRINT_OPTS ) printOptions(argv); if ( sEnv.DYLD_PRINT_ENV ) diff --git a/src/dyld64.exp b/src/dyld64.exp new file mode 100644 index 0000000..8184223 --- /dev/null +++ b/src/dyld64.exp @@ -0,0 +1,37 @@ +# +# Copyright (c) 2005 Apple Computer, Inc. All rights reserved. +# +# @APPLE_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. 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_LICENSE_HEADER_END@ +# + +# +# Only the following symbols should be "global". +# gdb and vmutils lookup these symbols in dyld in order to determine what images the process is using +# + +# Mac OS X 10.4 way to discover a process's images +_dyld_all_image_infos + +# CrashReporter uses this to get message as to why dyld terminated the process +_error_string + +# Used by various tools to see build number of dyld +_dyldVersionString +_dyldVersionNumber diff --git a/src/glue.c b/src/glue.c index eac9512..813bca9 100644 --- a/src/glue.c +++ b/src/glue.c @@ -127,3 +127,8 @@ struct tm* localtime(const time_t* t) return (struct tm*)NULL; } + +char* __ldtoa(long double *ld, int mode, int ndigits, int *decpt, int *sign, char **rve) +{ + return "__ldtoa"; +} diff --git a/src/stub_binding_helper.s b/src/stub_binding_helper.s index e2a6d87..4b315eb 100644 --- a/src/stub_binding_helper.s +++ b/src/stub_binding_helper.s @@ -33,6 +33,9 @@ * sp+4 address of lazy pointer * sp+0 address of mach header * + * Some inter-image function calls pass parameters in registers EAX, ECX, or EDX. + * Therefore those registers need to be preserved during the lazy binding. + * * After the symbol has been resolved and the pointer filled in this is to pop * these arguments off the stack and jump to the address of the defined symbol. */ @@ -40,9 +43,22 @@ .align 4,0x90 .globl _stub_binding_helper_interface _stub_binding_helper_interface: + pushl %eax # save registers that might be trashed by dyld::bindLazySymbol() + pushl %ecx + pushl %edx + subl $8,%esp # reserve space for parameters to dyld::bindLazySymbol() + movl 20(%esp), %eax + movl %eax, 0(%esp) # copy mach header parameter + movl 24(%esp), %eax + movl %eax, 4(%esp) # copy lazy pointer parameter call __ZN4dyld14bindLazySymbolEPK11mach_headerPm - addl $8,%esp - jmpl %eax + addl $8,%esp # clean up stack after function call + movl %eax,16(%esp) # store target into stack so ret at end will jump there + popl %edx # restore registers + popl %ecx + popl %eax + addl $4,%esp # remove meta-parameter, other meta-parmaeter now holds target for ret + ret #endif /* __i386__ */ diff --git a/unit-tests/bin/fail-if-non-zero.pl b/unit-tests/bin/fail-if-non-zero.pl new file mode 100755 index 0000000..f34f3a1 --- /dev/null +++ b/unit-tests/bin/fail-if-non-zero.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl -w + +use strict; + +# first arg is fail string, rest of args are command line to invoke +my $fail_string = shift @ARGV; + +if(system(@ARGV) != 0) +{ + printf("FAIL \"$fail_string\"\n"); +} + +exit 0; + diff --git a/unit-tests/include/common.makefile b/unit-tests/include/common.makefile index 9cd0899..67c89c3 100644 --- a/unit-tests/include/common.makefile +++ b/unit-tests/include/common.makefile @@ -10,3 +10,5 @@ CXXFLAGS = -Wall -g RM = rm RMFLAGS = -rf + +SAFE_RUN = ${TESTROOT}/bin/fail-if-non-zero.pl diff --git a/unit-tests/run-all-unit-tests b/unit-tests/run-all-unit-tests index 4a1d1c6..38f8960 100755 --- a/unit-tests/run-all-unit-tests +++ b/unit-tests/run-all-unit-tests @@ -25,4 +25,16 @@ then ../bin/make-recursive.pl ARCH="-arch ppc64" | ../bin/result-filter.pl fi +# if Intel, then also run all test cases under emulation +if [ `machine` = "pentium4" ] +then + echo "" + echo " * * * Running all unit tests for emulated 32-bits * * *" + + # make clean + ../bin/make-recursive.pl clean > /dev/null + + # build 64-bit architecture + ../bin/make-recursive.pl ARCH="-arch ppc" | ../bin/result-filter.pl +fi diff --git a/unit-tests/test-cases/bundle-memory-load-fat/Makefile b/unit-tests/test-cases/bundle-memory-load-fat/Makefile new file mode 100644 index 0000000..01eab8b --- /dev/null +++ b/unit-tests/test-cases/bundle-memory-load-fat/Makefile @@ -0,0 +1,41 @@ +## +# Copyright (c) 2005 Apple Computer, Inc. All rights reserved. +# +# @APPLE_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. 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_LICENSE_HEADER_END@ +## +TESTROOT = ../.. +include ${TESTROOT}/include/common.makefile + +FATFLAGS = `lipo -detailed_info /usr/lib/libSystem.B.dylib | grep architecture | sed -e 's/architecture/-arch/'` + +run: all + ./main + +all: main test.bundle + +main : main.c + ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c + +test.bundle : bundle.c + ${CC} ${FATFLAGS} -bundle -o test.bundle bundle.c + +clean: + ${RM} ${RMFLAGS} *~ main test.bundle + diff --git a/unit-tests/test-cases/bundle-memory-load-fat/bundle.c b/unit-tests/test-cases/bundle-memory-load-fat/bundle.c new file mode 100644 index 0000000..3f96d53 --- /dev/null +++ b/unit-tests/test-cases/bundle-memory-load-fat/bundle.c @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include + +// test to see if bss section is properly expanded + + +void check() +{ + +} diff --git a/unit-tests/test-cases/bundle-memory-load-fat/main.c b/unit-tests/test-cases/bundle-memory-load-fat/main.c new file mode 100644 index 0000000..4d77c98 --- /dev/null +++ b/unit-tests/test-cases/bundle-memory-load-fat/main.c @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include +#include +#include +#include +#include +#include +#include +#include + +#include "test.h" // PASS(), FAIL() + +typedef bool (*CheckFunc)(); + +int main() +{ + int fd = open("test.bundle", O_RDONLY, 0); + if ( fd == -1 ) { + FAIL("open() failed"); + return 1; + } + + struct stat stat_buf; + if ( fstat(fd, &stat_buf) == -1) { + FAIL("fstat() failed"); + return 1; + } + + void* loadAddress = mmap(NULL, stat_buf.st_size, PROT_READ, MAP_FILE | MAP_PRIVATE, fd, 0); + if ( loadAddress == ((void*)(-1)) ) { + FAIL("mmap() failed"); + return 1; + } + + close(fd); + + NSObjectFileImage ofi; + if ( NSCreateObjectFileImageFromMemory(loadAddress, stat_buf.st_size, &ofi) != NSObjectFileImageSuccess ) { + FAIL("NSCreateObjectFileImageFromMemory failed"); + return 1; + } + + NSModule mod = NSLinkModule(ofi, "he_he", NSLINKMODULE_OPTION_NONE); + if ( mod == NULL ) { + FAIL("NSLinkModule failed"); + return 1; + } + + NSSymbol sym = NSLookupSymbolInModule(mod, "_check"); + if ( sym == NULL ) { + FAIL("NSLookupSymbolInModule failed"); + return 1; + } + + CheckFunc func = NSAddressOfSymbol(sym); + if ( !func() ) { + FAIL("NSAddressOfSymbol failed"); + return 1; + } + + if ( !NSUnLinkModule(mod, NSUNLINKMODULE_OPTION_NONE) ) { + FAIL("NSUnLinkModule failed"); + return 1; + } + + if ( !NSDestroyObjectFileImage(ofi) ) { + FAIL("NSDestroyObjectFileImage failed"); + return 1; + } + + // Should check that loadAddress is unmmaped now (by call to NSDestroyObjectFileImage) + + PASS("bundle-memory-load-fat"); + return 0; +} \ No newline at end of file diff --git a/unit-tests/test-cases/dlclose-dylib-unload/Makefile b/unit-tests/test-cases/dlclose-dylib-unload/Makefile new file mode 100644 index 0000000..2597b53 --- /dev/null +++ b/unit-tests/test-cases/dlclose-dylib-unload/Makefile @@ -0,0 +1,44 @@ +## +# Copyright (c) 2005 Apple Computer, Inc. All rights reserved. +# +# @APPLE_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. 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_LICENSE_HEADER_END@ +## +TESTROOT = ../.. +include ${TESTROOT}/include/common.makefile + +run: all + ./main + +all: main libfoo.dylib + +main : main.c libbar.dylib + ${CC} ${CCFLAGS} -I${TESTROOT}/include main.c libbar.dylib -o main + + +libfoo.dylib : foo.c + ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib + +libbar.dylib : bar.c + ${CC} ${CCFLAGS} -dynamiclib bar.c -o libbar.dylib + + +clean: + ${RM} ${RMFLAGS} *~ main libfoo.dylib libbar.dylib + diff --git a/unit-tests/test-cases/dlclose-dylib-unload/bar.c b/unit-tests/test-cases/dlclose-dylib-unload/bar.c new file mode 100644 index 0000000..817b8cd --- /dev/null +++ b/unit-tests/test-cases/dlclose-dylib-unload/bar.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ + + +int bar() +{ + return 10; +} diff --git a/unit-tests/test-cases/dlclose-dylib-unload/foo.c b/unit-tests/test-cases/dlclose-dylib-unload/foo.c new file mode 100644 index 0000000..81f7dcf --- /dev/null +++ b/unit-tests/test-cases/dlclose-dylib-unload/foo.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ + + +int foo() +{ + return 10; +} diff --git a/unit-tests/test-cases/dlclose-dylib-unload/main.c b/unit-tests/test-cases/dlclose-dylib-unload/main.c new file mode 100644 index 0000000..5e48c00 --- /dev/null +++ b/unit-tests/test-cases/dlclose-dylib-unload/main.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include // fprintf(), NULL +#include // exit(), EXIT_SUCCESS +#include + +#include "test.h" // PASS(), FAIL(), XPASS(), XFAIL() + + + + + +void verifyfoo() +{ + // open same dylib three times + void* handle1 = dlopen("libfoo.dylib", RTLD_LAZY); + if ( handle1 == NULL ) { + FAIL("dlclose-dylib-unload: dlopen(\"libfoo.dylib\", RTLD_LAZY) failed with dlerror()=%s", dlerror()); + exit(0); + } + + void* handle2 = dlopen("libfoo.dylib", RTLD_LAZY); + if ( handle2 == NULL ) { + FAIL("dlclose-dylib-unload: dlopen(\"libfoo.dylib\", RTLD_LAZY) failed with dlerror()=%s", dlerror()); + exit(0); + } + + void* handle3 = dlopen("libfoo.dylib", RTLD_LAZY); + if ( handle3 == NULL ) { + FAIL("dlclose-dylib-unload: dlopen(\"libfoo.dylib\", RTLD_LAZY) failed with dlerror()=%s", dlerror()); + exit(0); + } + + // get symbol + void* sym = dlsym(handle1, "foo"); + if ( sym == NULL ) { + FAIL("dlclose-dylib-unload: dlsym(handle1, \"foo\") failed"); + exit(0); + } + + // close same bundle three times + if ( dlclose(handle3) != 0 ) { + FAIL("dlclose-dylib-unload: dlclose(handle3) != 0, dlerrr()=%s", dlerror()); + exit(0); + } + + if ( dlclose(handle2) != 0 ) { + FAIL("dlclose-dylib-unload: dlclose(handle2) != 0, dlerrr()=%s", dlerror()); + exit(0); + } + + if ( dlclose(handle1) != 0 ) { + FAIL("dlclose-dylib-unload: dlclose(handle1) != 0, dlerrr()=%s", dlerror()); + exit(0); + } + + // symbol foo should no longer be accessible via dladdr() + Dl_info info; + if ( dladdr(sym, &info) != 0 ) { + FAIL("dlclose-dylib-unload: dladdr(foo_sym) != 0, but should have failed"); + //exit(0); + } + + // extra close should fail + if ( dlclose(handle1) == 0 ) { + FAIL("dlclose-dylib-unload: dlclose(foo_handle4) == 0, but should have failed"); + //exit(0); + } + +} + + + +void verifybar() +{ + // open same dylib three times + void* handle1 = dlopen("libbar.dylib", RTLD_LAZY); + if ( handle1 == NULL ) { + FAIL("dlclose-dylib-unload: dlopen(\"libbar.dylib\", RTLD_LAZY) failed with dlerror()=%s", dlerror()); + exit(0); + } + + void* handle2 = dlopen("libbar.dylib", RTLD_LAZY); + if ( handle2 == NULL ) { + FAIL("dlclose-dylib-unload: dlopen(\"libbar.dylib\", RTLD_LAZY) failed with dlerror()=%s", dlerror()); + exit(0); + } + + void* handle3 = dlopen("libbar.dylib", RTLD_LAZY); + if ( handle3 == NULL ) { + FAIL("dlclose-dylib-unload: dlopen(\"libbar.dylib\", RTLD_LAZY) failed with dlerror()=%s", dlerror()); + exit(0); + } + + // get symbol + void* sym = dlsym(handle1, "bar"); + if ( sym == NULL ) { + FAIL("dlclose-dylib-unload: dlsym(handle1, \"bar\") failed"); + exit(0); + } + + // close same bundle three times + if ( dlclose(handle3) != 0 ) { + FAIL("dlclose-dylib-unload: dlclose(handle3) != 0, dlerrr()=%s", dlerror()); + exit(0); + } + + if ( dlclose(handle2) != 0 ) { + FAIL("dlclose-dylib-unload: dlclose(handle2) != 0, dlerrr()=%s", dlerror()); + exit(0); + } + + if ( dlclose(handle1) != 0 ) { + FAIL("dlclose-dylib-unload: dlclose(handle1) != 0, dlerrr()=%s", dlerror()); + exit(0); + } + + // symbol bar should still longer be accessible via dladdr() because of external reference to libbar.dylib + Dl_info info; + if ( dladdr(sym, &info) == 0 ) { + FAIL("dlclose-dylib-unload: dladdr(bar_sym) == 0, but should have succeeded"); + exit(0); + } + + // extra close should fail + if ( dlclose(handle1) == 0 ) { + FAIL("dlclose-dylib-unload: dlclose(bar_handle4) == 0, but should have failed"); + exit(0); + } +} + + +// verify libbar.dylib can be loaded and unloaded +// verify libbar.dylib can be loaded, but cannot be unloaded (because main executable links against it) +int main() +{ + verifyfoo(); + verifybar(); + + PASS("dlclose-dylib-unload"); + return EXIT_SUCCESS; +} diff --git a/unit-tests/test-cases/dlerror-clear/Makefile b/unit-tests/test-cases/dlerror-clear/Makefile new file mode 100644 index 0000000..7337131 --- /dev/null +++ b/unit-tests/test-cases/dlerror-clear/Makefile @@ -0,0 +1,38 @@ +## +# Copyright (c) 2005 Apple Computer, Inc. All rights reserved. +# +# @APPLE_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. 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_LICENSE_HEADER_END@ +## +TESTROOT = ../.. +include ${TESTROOT}/include/common.makefile + +run: all + ./main + +all: main + +main : main.c + ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c + + + +clean: + ${RM} ${RMFLAGS} *~ main + diff --git a/unit-tests/test-cases/dlerror-clear/main.c b/unit-tests/test-cases/dlerror-clear/main.c new file mode 100644 index 0000000..f70cc86 --- /dev/null +++ b/unit-tests/test-cases/dlerror-clear/main.c @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include // fprintf(), NULL +#include // exit(), EXIT_SUCCESS +#include +#include +#include + +#include "test.h" // PASS(), FAIL(), XPASS(), XFAIL() + + +/// +/// This tests that the dlerror message is cleared when dlerror is called +/// + +int main() +{ + // try to non-existent library + void* handle1 = dlopen("frobulite", RTLD_LAZY); + if ( handle1 != NULL ) { + FAIL("dlerror-clear: dlopen(\"frobulite\", RTLD_LAZY) succeeded but should have failed"); + exit(0); + } + + // verify there is an error message + const char* msg = dlerror(); + if ( msg == NULL ) { + FAIL("dlerror-clear: dlerror() returned NULL but should have returned an error message"); + exit(0); + } + + // verify error message was cleared + const char* msg2 = dlerror(); + if ( msg2 != NULL ) { + FAIL("dlerror-clear: dlerror() returned message but should have returned NULL"); + exit(0); + } + + PASS("dlerror-clear"); + return 0; +} diff --git a/unit-tests/test-cases/fallback-non-unique-leaf-names/Makefile b/unit-tests/test-cases/fallback-non-unique-leaf-names/Makefile new file mode 100644 index 0000000..8b4d218 --- /dev/null +++ b/unit-tests/test-cases/fallback-non-unique-leaf-names/Makefile @@ -0,0 +1,44 @@ +## +# Copyright (c) 2005 Apple Computer, Inc. All rights reserved. +# +# @APPLE_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. 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_LICENSE_HEADER_END@ +## +TESTROOT = ../.. +include ${TESTROOT}/include/common.makefile + +all : main + export DYLD_FALLBACK_LIBRARY_PATH=$$PWD && ./main + +main : main.c libfoo.dylib libbar.dylib + ${CC} -I${TESTROOT}/include main.c libfoo.dylib libbar.dylib -o main + +libfoo.dylib : foo.c + ${CC} -I${TESTROOT}/include foo.c -DFOO=1 -dynamiclib -o $$PWD/libfoo.dylib + +libbar.dylib : bar.c other/libfoo.dylib + ${CC} -I${TESTROOT}/include bar.c -dynamiclib other/libfoo.dylib -o $$PWD/libbar.dylib + +other/libfoo.dylib : foo.c + mkdir -p $$PWD/other + ${CC} -I${TESTROOT}/include foo.c -DFOO=2 -dynamiclib -o $$PWD/other/libfoo.dylib + + +clean: + rm -rf main libfoo.dylib libbar.dylib other \ No newline at end of file diff --git a/unit-tests/test-cases/fallback-non-unique-leaf-names/bar.c b/unit-tests/test-cases/fallback-non-unique-leaf-names/bar.c new file mode 100644 index 0000000..b4415f8 --- /dev/null +++ b/unit-tests/test-cases/fallback-non-unique-leaf-names/bar.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include + +extern int foo(); + +int bar() +{ + return foo(); +} diff --git a/unit-tests/test-cases/fallback-non-unique-leaf-names/foo.c b/unit-tests/test-cases/fallback-non-unique-leaf-names/foo.c new file mode 100644 index 0000000..9644c23 --- /dev/null +++ b/unit-tests/test-cases/fallback-non-unique-leaf-names/foo.c @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include + +int foo() +{ + return FOO; +} diff --git a/unit-tests/test-cases/fallback-non-unique-leaf-names/main.c b/unit-tests/test-cases/fallback-non-unique-leaf-names/main.c new file mode 100644 index 0000000..f0ea779 --- /dev/null +++ b/unit-tests/test-cases/fallback-non-unique-leaf-names/main.c @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include +#include + +#include "test.h" + +/// +/// This process has two libfoo.dylibs each of which has a foo() that returns a different value. +/// If dyld only loads one libfoo.dylib, then this test fails +/// main links directly against one libfoo.dylib and indirectly through libbar.dylib with the other. +/// + + +int main(int argc, const char* argv[]) +{ + if ( foo() == bar() ) { + FAIL("fallback-non-unique-leaf-names"); + return EXIT_SUCCESS; + } + + PASS("fallback-non-unique-leaf-names"); + return EXIT_SUCCESS; +} + diff --git a/unit-tests/test-cases/image-remove-notification/Makefile b/unit-tests/test-cases/image-remove-notification/Makefile new file mode 100644 index 0000000..a1ad36d --- /dev/null +++ b/unit-tests/test-cases/image-remove-notification/Makefile @@ -0,0 +1,41 @@ +## +# Copyright (c) 2005 Apple Computer, Inc. All rights reserved. +# +# @APPLE_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. 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_LICENSE_HEADER_END@ +## +TESTROOT = ../.. +include ${TESTROOT}/include/common.makefile + +run: all + ./main + +all: main foo.bundle + +main: main.c + ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c + +foo.bundle: foo.c + ${CC} ${CCFLAGS} -I${TESTROOT}/include -o foo.bundle foo.c -bundle + + + +clean: + ${RM} ${RMFLAGS} *~ main foo.bundle + diff --git a/unit-tests/test-cases/image-remove-notification/foo.c b/unit-tests/test-cases/image-remove-notification/foo.c new file mode 100644 index 0000000..6924ac6 --- /dev/null +++ b/unit-tests/test-cases/image-remove-notification/foo.c @@ -0,0 +1,3 @@ + +void foo() {} + diff --git a/unit-tests/test-cases/image-remove-notification/main.c b/unit-tests/test-cases/image-remove-notification/main.c new file mode 100644 index 0000000..d7e0b4a --- /dev/null +++ b/unit-tests/test-cases/image-remove-notification/main.c @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include // fprintf(), NULL +#include // exit(), EXIT_SUCCESS +#include +#include +#include + +#include "test.h" // PASS(), FAIL(), XPASS(), XFAIL() + + +static void* sExpectedBundleBaseAddress = 0; +static bool sNotified = false; + +static void removeNotification(const struct mach_header *mh, intptr_t vmaddr_slide) +{ + if ( mh == sExpectedBundleBaseAddress ) + sNotified = true; +} + + + +int main(int argc, const char* argv[]) +{ + // tell dyld we want to know when images go away + _dyld_register_func_for_remove_image(removeNotification); + + void* handle = dlopen("foo.bundle", RTLD_LAZY); + if ( handle == NULL ) { + FAIL("image-remove-notification: dlopen(foo.bundle) failed: %s", dlerror()); + exit(0); + } + + void* sym = dlsym(handle, "foo"); + if ( sym == NULL ) { + FAIL("image-remove-notification: dlsym(handle, \"foo\") failed: %s", dlerror()); + exit(0); + } + + Dl_info info; + if ( dladdr(sym, &info) == 0 ) { + FAIL("image-remove-notification: dladdr() failed"); + exit(0); + } + + // record the base address we expect to get notification about + sExpectedBundleBaseAddress = info.dli_fbase; + + int result = dlclose(handle); + if ( result != 0 ) { + FAIL("image-remove-notification: dlclose(handle) returned %d, %s", result, dlerror()); + exit(0); + } + + if ( sNotified ) + PASS("image-remove-notification"); + else + FAIL("image-remove-notification"); + + return EXIT_SUCCESS; +} diff --git a/unit-tests/test-cases/lazy-binding-reg-params/Makefile b/unit-tests/test-cases/lazy-binding-reg-params/Makefile new file mode 100644 index 0000000..9a7f756 --- /dev/null +++ b/unit-tests/test-cases/lazy-binding-reg-params/Makefile @@ -0,0 +1,41 @@ +## +# Copyright (c) 2005 Apple Computer, Inc. All rights reserved. +# +# @APPLE_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. 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_LICENSE_HEADER_END@ +## +TESTROOT = ../.. +include ${TESTROOT}/include/common.makefile + +run: all + ./main + +all: main + +main : main.c libfoo.dylib + ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c libfoo.dylib + + +libfoo.dylib : foo.c + ${CC} ${CCFLAGS} -dynamiclib foo.c -o libfoo.dylib + + +clean: + ${RM} ${RMFLAGS} *~ main libfoo.dylib + diff --git a/unit-tests/test-cases/lazy-binding-reg-params/foo.c b/unit-tests/test-cases/lazy-binding-reg-params/foo.c new file mode 100644 index 0000000..c136321 --- /dev/null +++ b/unit-tests/test-cases/lazy-binding-reg-params/foo.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include // fprintf(), NULL + +#if __i386__ +__attribute__((regparm(3))) +#endif +bool inttest(int p1, int p2, int p3, int p4, int p5) +{ + if ( p1 != 123) + return false; + if ( p2 != 456) + return false; + if ( p3 != 789) + return false; + if ( p4 != 4444) + return false; + if ( p5 != 55555) + return false; + return true; +} + + diff --git a/unit-tests/test-cases/lazy-binding-reg-params/main.c b/unit-tests/test-cases/lazy-binding-reg-params/main.c new file mode 100644 index 0000000..8d28735 --- /dev/null +++ b/unit-tests/test-cases/lazy-binding-reg-params/main.c @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include +#include // fprintf(), NULL +#include // exit(), EXIT_SUCCESS +#include + +#include "test.h" // PASS(), FAIL(), XPASS(), XFAIL() + + +/// +/// rdar://problem/4132378 support __attribute__((regparm())) +/// +/// The stub binding helper for dyld needs to preserve registers +/// + + +extern +#if __i386__ +__attribute__((regparm(3))) +#endif +bool inttest(int p1, int p2, int p3, int p4, int p5); + +int main() +{ + + if ( ! inttest(123, 456, 789, 4444, 55555) ) { + FAIL("lazy-binding-reg-params int parameters"); + return EXIT_SUCCESS; + } + + PASS("lazy-binding-reg-params"); + return EXIT_SUCCESS; +} diff --git a/unit-tests/test-cases/non-weak-library/Makefile b/unit-tests/test-cases/non-weak-library/Makefile index 41f097c..d2b10dd 100644 --- a/unit-tests/test-cases/non-weak-library/Makefile +++ b/unit-tests/test-cases/non-weak-library/Makefile @@ -36,4 +36,4 @@ all: foo.c main.c mv libfoo.dylib present/ clean: - ${RM} ${RMFLAGS} *~ libfoo.dylib absent/main present/{main,libfoo.dylib} + ${RM} ${RMFLAGS} *~ libfoo.dylib absent present diff --git a/unit-tests/test-cases/unloadable-library-residue/Makefile b/unit-tests/test-cases/unloadable-library-residue/Makefile new file mode 100644 index 0000000..77e16cc --- /dev/null +++ b/unit-tests/test-cases/unloadable-library-residue/Makefile @@ -0,0 +1,54 @@ +## +# Copyright (c) 2005 Apple Computer, Inc. All rights reserved. +# +# @APPLE_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. 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_LICENSE_HEADER_END@ +## +TESTROOT = ../.. +include ${TESTROOT}/include/common.makefile + +### +### rdar://problem/3884004 Libraries can be half-baked if an error occurs during their first use +### +### We indirectly load libfoo which depends on libbar. The libbar that is loaded does not contain +### what libfoo needs, so libfoo fails to bind. The bug was that libfoo was left marked as bound, +### so the next use of libfoo seemed to succeed, when it should have failed. +### + + +run: all + export DYLD_IMAGE_SUFFIX="_missing" && ./main + +all: main libfoo.dylib + +main : main.c + ${CC} ${CCFLAGS} -I${TESTROOT}/include -o main main.c + +libfoo.dylib : foo.c libbar_missing.dylib libbar.dylib + ${CC} ${CCFLAGS} foo.c -dynamiclib -o libfoo.dylib libbar.dylib + +libbar_missing.dylib : bar.c + ${CC} ${CCFLAGS} bar.c -dynamiclib -o libbar_missing.dylib -install_name libbar.dylib + +libbar.dylib : bar.c + ${CC} ${CCFLAGS} bar.c -dynamiclib -o libbar.dylib -DHAS_BAR2=1 + +clean: + ${RM} ${RMFLAGS} *~ main libfoo.dylib libbar.dylib libbar_missing.dylib + diff --git a/unit-tests/test-cases/unloadable-library-residue/bar.c b/unit-tests/test-cases/unloadable-library-residue/bar.c new file mode 100644 index 0000000..400e1bf --- /dev/null +++ b/unit-tests/test-cases/unloadable-library-residue/bar.c @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ + + +int bar1 = 1; +#if HAS_BAR2 +int bar2 = 2; +#endif +int bar3 = 3; + diff --git a/unit-tests/test-cases/unloadable-library-residue/foo.c b/unit-tests/test-cases/unloadable-library-residue/foo.c new file mode 100644 index 0000000..8abc708 --- /dev/null +++ b/unit-tests/test-cases/unloadable-library-residue/foo.c @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ + +extern int bar1; +extern int bar2; +extern int bar3; + + + +int foo() +{ + return bar1 + bar2 + bar3; +} diff --git a/unit-tests/test-cases/unloadable-library-residue/main.c b/unit-tests/test-cases/unloadable-library-residue/main.c new file mode 100644 index 0000000..2a87dad --- /dev/null +++ b/unit-tests/test-cases/unloadable-library-residue/main.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2005 Apple Computer, Inc. All rights reserved. + * + * @APPLE_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. 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_LICENSE_HEADER_END@ + */ +#include +#include +#include + +#include "test.h" // PASS(), FAIL() + + +int main() +{ + // load libfoo which depends on libbar + const struct mach_header* mh = NSAddImage("libfoo.dylib", NSADDIMAGE_OPTION_RETURN_ON_ERROR); + if ( mh != NULL ) { + FAIL("library-cant-be-bound: NSAddImage should have failed"); + return 1; + } + + uint32_t count = _dyld_image_count(); + for(uint32_t i=0; i < count; ++i) { + const char* name = _dyld_get_image_name(i); + if (strcmp(name, "libfoo.dylib") == 0 ) { + FAIL("library-cant-be-bound: libfoo.dylib shows up in list of images"); + return 0; + } + } + + + PASS("library-cant-be-bound"); + return 0; +} \ No newline at end of file -- 2.45.2