[darwinbuild-changes] [917] branches/PR-8817822

source_changes at macosforge.org source_changes at macosforge.org
Fri Feb 4 14:37:05 PST 2011


Revision: 917
          http://trac.macosforge.org/projects/darwinbuild/changeset/917
Author:   wsiegrist at apple.com
Date:     2011-02-04 14:37:04 -0800 (Fri, 04 Feb 2011)
Log Message:
-----------
Remove support for unprebinding since prebinding does not happen anymore.

Modified Paths:
--------------
    branches/PR-8817822/darwinbuild.xcodeproj/project.pbxproj
    branches/PR-8817822/darwinup/Digest.cpp
    branches/PR-8817822/darwinup/Digest.h
    branches/PR-8817822/darwinup/File.cpp

Removed Paths:
-------------
    branches/PR-8817822/darwinup/redo_prebinding.h

Modified: branches/PR-8817822/darwinbuild.xcodeproj/project.pbxproj
===================================================================
--- branches/PR-8817822/darwinbuild.xcodeproj/project.pbxproj	2011-02-04 22:12:32 UTC (rev 916)
+++ branches/PR-8817822/darwinbuild.xcodeproj/project.pbxproj	2011-02-04 22:37:04 UTC (rev 917)
@@ -37,17 +37,6 @@
 			name = darwinbuild_scripts;
 			productName = darwinbuild_scripts;
 		};
-		7227AC7E1098EF6400BE33D7 /* libredo_prebinding.a */ = {
-			isa = PBXAggregateTarget;
-			buildConfigurationList = 7227AC841098EF8000BE33D7 /* Build configuration list for PBXAggregateTarget "libredo_prebinding.a" */;
-			buildPhases = (
-				7227AC7D1098EF6400BE33D7 /* ShellScript */,
-			);
-			dependencies = (
-			);
-			name = libredo_prebinding.a;
-			productName = libredo_prebinding.a;
-		};
 		725740981097B051008AD4D7 /* darwinxref_plugins */ = {
 			isa = PBXAggregateTarget;
 			buildConfigurationList = 725740A01097B08A008AD4D7 /* Build configuration list for PBXAggregateTarget "darwinxref_plugins" */;
@@ -112,7 +101,6 @@
 		7227AB67109899A600BE33D7 /* cfutils.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C86BE910965E7500C66E90 /* cfutils.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7227AB68109899A600BE33D7 /* DBPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 72C86BED10965E7500C66E90 /* DBPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		7227AB7510989F8D00BE33D7 /* manifest.c in Sources */ = {isa = PBXBuildFile; fileRef = 72C86C2E1096600B00C66E90 /* manifest.c */; };
-		7227ACA01098FCAA00BE33D7 /* libredo_prebinding.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */; };
 		7227AD1C109A05FA00BE33D7 /* buildlist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB871098A7BF00BE33D7 /* buildlist */; };
 		7227AD1D109A05FA00BE33D7 /* buildorder in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB881098A7BF00BE33D7 /* buildorder */; };
 		7227AD1E109A05FA00BE33D7 /* ditto in CopyFiles */ = {isa = PBXBuildFile; fileRef = 7227AB891098A7BF00BE33D7 /* ditto */; };
@@ -607,13 +595,6 @@
 			remoteGlobalIDString = 72D05CAD11D267C400B33EDD;
 			remoteInfo = query;
 		};
-		DFCB82D9109A2F9A00D2DB2F /* PBXContainerItemProxy */ = {
-			isa = PBXContainerItemProxy;
-			containerPortal = 726DD14910965C5700D5AEAB /* Project object */;
-			proxyType = 1;
-			remoteGlobalIDString = 7227AC7E1098EF6400BE33D7;
-			remoteInfo = libredo_prebinding.a;
-		};
 /* End PBXContainerItemProxy section */
 
 /* Begin PBXCopyFilesBuildPhase section */
@@ -721,7 +702,6 @@
 		72C86BE010965E4F00C66E90 /* File.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = File.cpp; path = darwinup/File.cpp; sourceTree = "<group>"; };
 		72C86BE110965E4F00C66E90 /* File.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = File.h; path = darwinup/File.h; sourceTree = "<group>"; };
 		72C86BE210965E4F00C66E90 /* main.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = main.cpp; path = darwinup/main.cpp; sourceTree = "<group>"; };
-		72C86BE310965E4F00C66E90 /* redo_prebinding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = redo_prebinding.h; path = darwinup/redo_prebinding.h; sourceTree = "<group>"; };
 		72C86BE410965E4F00C66E90 /* SerialSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SerialSet.cpp; path = darwinup/SerialSet.cpp; sourceTree = "<group>"; };
 		72C86BE510965E4F00C66E90 /* SerialSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SerialSet.h; path = darwinup/SerialSet.h; sourceTree = "<group>"; };
 		72C86BE610965E4F00C66E90 /* Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Utils.cpp; path = darwinup/Utils.cpp; sourceTree = "<group>"; };
@@ -779,7 +759,6 @@
 		72C86C381096607900C66E90 /* darwinbuild */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = darwinbuild; sourceTree = BUILT_PRODUCTS_DIR; };
 		72C86C481096609500C66E90 /* darwinup */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = darwinup; sourceTree = BUILT_PRODUCTS_DIR; };
 		72C86C52109660CA00C66E90 /* darwintrace.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = darwintrace.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
-		72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libredo_prebinding.a; path = /usr/local/lib/libredo_prebinding.a; sourceTree = "<absolute>"; };
 		72C86CE310974CC800C66E90 /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = /usr/lib/libsqlite3.dylib; sourceTree = "<absolute>"; };
 		72D05CA911D2678F00B33EDD /* query.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = query.c; sourceTree = "<group>"; };
 		72D05CB711D267C400B33EDD /* query.so */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.objfile"; includeInIndex = 0; path = query.so; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -985,7 +964,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				72C86CE410974CC800C66E90 /* libsqlite3.dylib in Frameworks */,
-				7227ACA01098FCAA00BE33D7 /* libredo_prebinding.a in Frameworks */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1014,7 +992,6 @@
 				72C86BD610965DD000C66E90 /* darwinxref */,
 				72C86BD510965DC900C66E90 /* darwinbuild */,
 				72C86C391096607900C66E90 /* Products */,
-				72C86CDD10974C3A00C66E90 /* libredo_prebinding.a */,
 				72C86CE310974CC800C66E90 /* libsqlite3.dylib */,
 				72574A0F10977F7A00B13BC3 /* CoreFoundation.framework */,
 				72574A1410977FAD00B13BC3 /* libtcl.dylib */,
@@ -1085,7 +1062,6 @@
 				72C86BE010965E4F00C66E90 /* File.cpp */,
 				72C86BE110965E4F00C66E90 /* File.h */,
 				72C86BE210965E4F00C66E90 /* main.cpp */,
-				72C86BE310965E4F00C66E90 /* redo_prebinding.h */,
 				72C86BE410965E4F00C66E90 /* SerialSet.cpp */,
 				72C86BE510965E4F00C66E90 /* SerialSet.h */,
 				72C86BE610965E4F00C66E90 /* Utils.cpp */,
@@ -1755,7 +1731,6 @@
 			buildRules = (
 			);
 			dependencies = (
-				DFCB82DA109A2F9A00D2DB2F /* PBXTargetDependency */,
 			);
 			name = darwinup;
 			productName = darwinup;
@@ -1858,7 +1833,6 @@
 				7227AC151098D8DB00BE33D7 /* thinPackages */,
 				7227AC1E1098DB9200BE33D7 /* installXcode */,
 				7227AC271098DBDF00BE33D7 /* installXcode32 */,
-				7227AC7E1098EF6400BE33D7 /* libredo_prebinding.a */,
 				720BE2EA120C90A700B3C4A5 /* digest */,
 			);
 		};
@@ -2045,19 +2019,6 @@
 			shellPath = /bin/sh;
 			shellScript = "/bin/cp $DERIVED_FILE_DIR/installXcode32 $BUILT_PRODUCTS_DIR/installXcode32";
 		};
-		7227AC7D1098EF6400BE33D7 /* ShellScript */ = {
-			isa = PBXShellScriptBuildPhase;
-			buildActionMask = 2147483647;
-			files = (
-			);
-			inputPaths = (
-			);
-			outputPaths = (
-			);
-			runOnlyForDeploymentPostprocessing = 0;
-			shellPath = /bin/sh;
-			shellScript = "set -x\nBUILD=10A432\nHOST=src.macosforge.org\n\n# make sure we only run when needed\nif [ -f /usr/local/lib/libredo_prebinding.a ]; then\n\texit 0;\nfi\n\n/usr/bin/curl -kL http://$HOST/Roots/$BUILD/cctools_ofiles.root.tar.gz > $CONFIGURATION_TEMP_DIR/cctools_ofiles.root.tar.gz\n\n/bin/mkdir -p $BUILT_PRODUCTS_DIR\n\n/usr/bin/tar zxOf $CONFIGURATION_TEMP_DIR/cctools_ofiles.root.tar.gz ./usr/local/lib/libredo_prebinding.a > $BUILT_PRODUCTS_DIR/libredo_prebinding.a\n\n/bin/mkdir -p $DSTROOT/$PREFIX/lib/\n\n/bin/cp $BUILT_PRODUCTS_DIR/libredo_prebinding.a $DSTROOT/$PREFIX/lib/\n";
-		};
 /* End PBXShellScriptBuildPhase section */
 
 /* Begin PBXSourcesBuildPhase section */
@@ -2620,11 +2581,6 @@
 			target = 72D05CAD11D267C400B33EDD /* query */;
 			targetProxy = 72D05CB911D2688D00B33EDD /* PBXContainerItemProxy */;
 		};
-		DFCB82DA109A2F9A00D2DB2F /* PBXTargetDependency */ = {
-			isa = PBXTargetDependency;
-			target = 7227AC7E1098EF6400BE33D7 /* libredo_prebinding.a */;
-			targetProxy = DFCB82D9109A2F9A00D2DB2F /* PBXContainerItemProxy */;
-		};
 /* End PBXTargetDependency section */
 
 /* Begin XCBuildConfiguration section */
@@ -2865,27 +2821,6 @@
 			};
 			name = Release;
 		};
-		7227AC7F1098EF6400BE33D7 /* Debug */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				PRODUCT_NAME = libredo_prebinding.a;
-			};
-			name = Debug;
-		};
-		7227AC801098EF6400BE33D7 /* Public */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				PRODUCT_NAME = libredo_prebinding.a;
-			};
-			name = Public;
-		};
-		7227AC811098EF6400BE33D7 /* Release */ = {
-			isa = XCBuildConfiguration;
-			buildSettings = {
-				PRODUCT_NAME = libredo_prebinding.a;
-			};
-			name = Release;
-		};
 		72573F7C1097A488008AD4D7 /* Debug */ = {
 			isa = XCBuildConfiguration;
 			baseConfigurationReference = 72574B3E10979D6000B13BC3 /* c_plugins.xcconfig */;
@@ -3777,16 +3712,6 @@
 			defaultConfigurationIsVisible = 0;
 			defaultConfigurationName = Public;
 		};
-		7227AC841098EF8000BE33D7 /* Build configuration list for PBXAggregateTarget "libredo_prebinding.a" */ = {
-			isa = XCConfigurationList;
-			buildConfigurations = (
-				7227AC7F1098EF6400BE33D7 /* Debug */,
-				7227AC801098EF6400BE33D7 /* Public */,
-				7227AC811098EF6400BE33D7 /* Release */,
-			);
-			defaultConfigurationIsVisible = 0;
-			defaultConfigurationName = Public;
-		};
 		72573F7B1097A488008AD4D7 /* Build configuration list for PBXNativeTarget "dependencies" */ = {
 			isa = XCConfigurationList;
 			buildConfigurations = (

Modified: branches/PR-8817822/darwinup/Digest.cpp
===================================================================
--- branches/PR-8817822/darwinup/Digest.cpp	2011-02-04 22:12:32 UTC (rev 916)
+++ branches/PR-8817822/darwinup/Digest.cpp	2011-02-04 22:37:04 UTC (rev 917)
@@ -40,15 +40,6 @@
 #include <string.h>
 #include <unistd.h>
 
-// For SHA1DigestMachO
-#include <mach/mach_init.h>
-#include <mach/vm_map.h>
-extern "C" {
-// <rdar://problem/4319807> redo_prebinding.h should use extern "C"
-//#include <mach-o/redo_prebinding.h> // from cctools_ofiles
-#include "redo_prebinding.h"
-}
-
 uint8_t*	Digest::data() { return m_data; }
 uint32_t	Digest::size() { return m_size; }
 
@@ -123,45 +114,6 @@
 	CC_SHA1((const void*)data, (CC_LONG)size, md);
 }
 
-SHA1DigestMachO::SHA1DigestMachO(const char* filename) {
-	char* error = NULL;
-	
-	// Check for Mach-O
-	int type = object_file_type(filename, NULL, &error);
-	if (type == OFT_EXECUTABLE ||
-		type == OFT_DYLIB ||
-		type == OFT_BUNDLE) {
-		// XXX - type == OFT_ARCHIVE?
-		void* block = NULL;
-		unsigned long blocklen = 0;
-		int ret = unprebind(filename,
-			NULL,
-			NULL,
-			&error,
-			1,
-			NULL,
-			0,
-			&block,
-			&blocklen);
-		if (ret == REDO_PREBINDING_SUCCESS && block != NULL) {
-			digest(m_data, (uint8_t*)block, blocklen);
-		} else {
-			//fprintf(stderr, "%s:%d: unexpected unprebind result: %s: %s (%d)\n", __FILE__, __LINE__, filename, error, ret);
-			int fd = open(filename, O_RDONLY);
-			digest(m_data, fd);
-			close(fd);
-		}
-		if (block != NULL) {
-			kern_return_t ret = vm_deallocate(mach_task_self(), (vm_address_t)block, (vm_size_t)blocklen);
-			assert(ret == 0);
-		}
-	} else {
-		int fd = open(filename, O_RDONLY);
-		digest(m_data, fd);
-		close(fd);
-	}
-}
-
 SHA1DigestSymlink::SHA1DigestSymlink(const char* filename) {
 	char link[PATH_MAX];
 	int res = readlink(filename, link, PATH_MAX);

Modified: branches/PR-8817822/darwinup/Digest.h
===================================================================
--- branches/PR-8817822/darwinup/Digest.h	2011-02-04 22:12:32 UTC (rev 916)
+++ branches/PR-8817822/darwinup/Digest.h	2011-02-04 22:37:04 UTC (rev 917)
@@ -111,18 +111,6 @@
 };
 
 ////
-//  SHA1DigestMachO
-//  Digests of canonicalized Mach-O file formats.
-////
-struct SHA1DigestMachO : SHA1Digest {
-	// Computes the SHA-1 digest of the data in the file.
-	// If the file is a Mach-O executable or dynamic library,
-	// the SHA-1 digest is computed from its canonical
-	// representation.
-	SHA1DigestMachO(const char* filename);
-};
-
-////
 //  SHA1DigestSymlink
 //  Digests of the target of a symlink.
 ////

Modified: branches/PR-8817822/darwinup/File.cpp
===================================================================
--- branches/PR-8817822/darwinup/File.cpp	2011-02-04 22:12:32 UTC (rev 916)
+++ branches/PR-8817822/darwinup/File.cpp	2011-02-04 22:37:04 UTC (rev 917)
@@ -266,14 +266,14 @@
 : File(serial, archive, info, path, mode, uid, gid, size, digest) {}
 
 Regular::Regular(Archive* archive, FTSENT* ent) : File(archive, ent) {
-	m_digest = new SHA1DigestMachO(ent->fts_accpath);
+	m_digest = new SHA1Digest(ent->fts_accpath);
 }
 
 Regular::Regular(uint64_t serial, Archive* archive, uint32_t info, const char* path, 
 				 mode_t mode, uid_t uid, gid_t gid, off_t size, Digest* digest) 
 : File(serial, archive, info, path, mode, uid, gid, size, digest) {
 	if (digest == NULL || serial == 0) {
-		m_digest = new SHA1DigestMachO(path);
+		m_digest = new SHA1Digest(path);
 	}
 }
 

Deleted: branches/PR-8817822/darwinup/redo_prebinding.h
===================================================================
--- branches/PR-8817822/darwinup/redo_prebinding.h	2011-02-04 22:12:32 UTC (rev 916)
+++ branches/PR-8817822/darwinup/redo_prebinding.h	2011-02-04 22:37:04 UTC (rev 917)
@@ -1,273 +0,0 @@
-/*
- * Copyright (c) 2005-2010 Apple Computer, Inc. All rights reserved.
- *
- * @APPLE_BSD_LICENSE_HEADER_START@
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * @APPLE_BSD_LICENSE_HEADER_END@
- */
-#define REDO_PREBINDING_VERSION 2
-#include <mach/machine.h>
-/*
- * For all APIs in this file the parameters program_name and error_message
- * are used the same.  For unrecoverable resource errors like being unable to
- * allocate memory each API prints a message to stderr precede with program_name
- * then calls exit(2) with the value EXIT_FAILURE.  If an API is unsuccessful
- * and if error_message pass to it is not NULL it is set to a malloc(3)'ed
- * buffer with a NULL terminated string with the error message.  For all APIs 
- * when they return they release all resources (memory, open file descriptors,
- * etc). 
- * 
- * The file_name parameter for these APIs may be of the form "foo(bar)" which is
- * NOT interpreted as an archive name and a member name in that archive.  As
- * these API deal with prebinding and prebound binaries ready for execution
- * can't be in archives.
- * 
- * If the executable_path parameter for these APIs is not NULL it is used for
- * any dependent library has a path that starts with "@executable_path". Then
- * "@executable_path" is replaced with executable_path. 
- * 
- * If the root_dir parameter is not NULL it is prepended to all the rooted
- * dependent library paths. 
- */
-
-/*
- * dependent_libs() takes a file_name of a binary and returns a malloc(3)'ed
- * array of pointers (NULL terminated) to names (also malloc(3)'ed and '\0'
- * terminated names) of all the dependent libraries for that binary (not
- * recursive) for all of the architectures of that binary.  If successful
- * dependent_libs() returns a non NULL value (at minimum a pointer to one NULL
- * pointer). If unsuccessful dependent_libs() returns NULL.
- */ 
-extern
-char **
-dependent_libs(
-const char *file_name,
-const char *program_name,
-char **error_message);
-
-/*
- * install_name() takes a file_name of a binary and returns a malloc(3)'ed
- * pointer to a NULL terminated string containing the install_name value for
- * the binary. If unsuccessful install_name() returns NULL.  In particular,
- * NULL is returned if the binary is not a dylib and there is no error_message
- * set.  If the all of the arch's are dylibs but all the install names don't
- * match NULL is returned and a error_message is set.  If some but not all of
- * the archs are dylibs NULL is returned and a error_message is set.
- */ 
-extern
-char *
-install_name(
-const char *file_name,
-const char *program_name,
-char **error_message);
-
-/* return values for redo_prebinding() */
-enum redo_prebinding_retval {
-    REDO_PREBINDING_SUCCESS,
-    REDO_PREBINDING_FAILURE,
-    /* the following can only be returned if the parameter only_if_needed set */
-    REDO_PREBINDING_NOT_NEEDED,
-    REDO_PREBINDING_NOT_PREBOUND,
-    REDO_PREBINDING_NEEDS_REBUILDING
-};
-
-/*
- * redo_prebinding() takes a file_name of a binary and redoes the prebinding on
- * it.  If output_file is not NULL the update file is written to output_file,
- * if not it is written to file_name.  If redo_prebinding() is successful it
- * returns REDO_PREBINDING_SUCCESS otherwise it returns REDO_PREBINDING_FAILURE.
- * If the parameter allow_missing_architectures is zero and not all
- * architectures can be updated it is not successful and nothing is done and
- * this returns REDO_PREBINDING_FAILURE.  If the parameter
- * allow_missing_architectures is non-zero then only problems with missing
- * architectures for the architecure of the cputype specified by 
- * allow_missing_architectures will cause this call to fail.  Other
- * architectures that could not be prebound due to missing architectures in
- * depending libraries will not have their prebinding updated but will not
- * cause this call to fail.
- * If the slide_to_address parameter is non-zero and the binary is a
- * dynamic library it is relocated to have that has its prefered address.  If
- * only_if_needed is non-zero the prebinding is checked first and only done if
- * needed.  The checking includes checking the prefered address against the
- * slide_to_address value if it is non-zero.  If only_if_needed is non-zero
- * and the prebinding does not have to be redone REDO_PREBINDING_NOT_NEEDED is
- * returned, if the binary is not prebound REDO_PREBINDING_NOT_PREBOUND is
- * returned and if the new load commands do not fit in the binary and it needs
- * to be rebuilt REDO_PREBINDING_NEEDS_REBUILDING is returned.
- * If zero_out_prebind_checksum is non-zero then the cksum field of the
- * LC_PREBIND_CKSUM load command (if any) is set to zero on output (this should
- * always be set by B&I tools and never set by the update_prebinding(1)
- * command).
- * If throttle is non-NULL it points to a value of the maximum bytes per second
- * to use for writting the output.  If the value is ULONG_MAX then the actual
- * bytes per second is returned indirectly through *throttle.
- */
-extern 
-enum redo_prebinding_retval
-redo_prebinding(
-const char *file_name,
-const char *executable_path,
-const char *root_dir,
-const char *output_file,
-const char *program_name,
-char **error_message,
-unsigned long slide_to_address,
-int only_if_needed,
-int zero_out_prebind_checksum,
-cpu_type_t allow_missing_architectures,
-unsigned long *throttle);
-
-
-/* return values for needs_redo_prebinding() */
-enum needs_redo_prebinding_retval {
-    PREBINDING_UPTODATE,  /* a binary who's prebinding is up todate */
-    PREBINDING_OUTOFDATE, /* a binary who's prebinding is out of date */
-    NOT_PREBOUND,	  /* a binary, but not built prebound */
-    NOT_PREBINDABLE,	  /* not a binary or statically linked,
-			     prebinding does not apply */
-    PREBINDING_UNKNOWN	  /* a binary who's prebinding can't be determined
-			     because it is malformed, a library it depends
-			     on is missing, etc. */
-};
-
-/*
- * needs_redo_prebinding() takes a file_name and determines if it is a binary
- * and if its prebinding is uptodate.  It returns one of the return values
- * above depending on the state of the binary and libraries. If the parameter
- * allow_missing_architectures is zero then the value returned is based on the
- * first architecture for fat files.  If the parameter
- * allow_missing_architectures is non-zero then the value returned is based on
- * the cputype specified by allow_missing_architectures.  If that architecture
- * is not present then PREBINDING_UPTODATE is returned.  If the parameter
- * expected_address is not zero and the binary is a dynamic library then the
- * library is checked to see if it is at the expected_address if not the
- * prebinding is assumed to be out of date and PREBINDING_OUTOFDATE is returned.
- */
-extern
-enum needs_redo_prebinding_retval
-needs_redo_prebinding(
-const char *file_name,
-const char *executable_path,
-const char *root_dir,
-const char *program_name,
-char **error_message,
-unsigned long expected_address,
-cpu_type_t allow_missing_architectures);
-
-
-/*
- * unprebind() takes a file_name of a binary and resets or removes prebinding
- * information from it.  If inbuf is non-NULL, the memory pointed to by inbuf is
- * used as the input file contents.  Otherwise, the contents are loaded from 
- * the file at path file_name.  Even if inbuf is non-NULL, a file_name 
- * parameter should be specified for error reporting.  Similarly, if outbuf is 
- * non-NULL, upon return, outbuf will point to a buffer containing the 
- * unprebound binary and outlen will point to the length of the output buffer.  
- * This buffer is vm_allocate'd and therefore should be vm_deallocate'd when it 
- * is no longer needed.  If outbuf is NULL, and output_file is not NULL the 
- * update file is written to output_file, if outbuf is NULL and output_file is 
- * NULL, it is written to file_name.  
- * If unprebind() is successful it returns REDO_PREBINDING_SUCCESS otherwise it
- * returns REDO_PREBINDING_FAILURE If the binary is already unprebound (i.e. it
- * has the MH_PREBINDABLE flag set) then REDO_PREBINDING_NOT_NEEDED is returned.
- * If the binary is not prebound and not prebindable, 
- * REDO_PREBINDING_NOT_PREBOUND is returned.  If zero_checksum is non-zero then
- * the cksum field the LC_PREBIND_CKSUM load command (if any) is set to zero on
- * output, otherwise it is left alone.
- * Unprebinding slides dynamic libraries to address zero, resets prebound 
- * symbols to address zero and type undefined, resets symbol pointers, removes 
- * LC_PREBOUND_DYLIB commands, resets library timestamps, resets two-level hints
- * and updates relocation entries if necessary.  Unprebound binaries have
- * the MH_PREBINDABLE flag set, but not MH_PREBOUND.  It will also set the the
- * MH_ALLMODSBOUND flag if all two-level libraries were used and all modules
- * were found to be bound in the LC_PREBOUND_DYLIB commands.
- * As unprebinding is intended to produce a canonical Mach-O
- * binary, bundles and non-prebound executables and dylibs are acceptable
- * as input.  For these files, the  unprebind operation will zero library 
- * time stamps and version numbers and zero entries in the two-level hints
- * table.  These files will not gain the MH_PREBINDABLE flag.
- * All resulting binaries successfully processed by unprebind() will have
- * the MH_CANONICAL flag.
- */
-extern
-enum redo_prebinding_retval
-unprebind(
-const char *file_name,
-const char *output_file,
-const char *program_name,
-char **error_message,
-int zero_checksum,
-void *inbuf,
-unsigned long inlen,
-void **outbuf,
-unsigned long *outlen);
-
-enum object_file_type_retval {
-    OFT_OTHER,
-    OFT_EXECUTABLE,
-    OFT_DYLIB,
-    OFT_BUNDLE,
-    OFT_ARCHIVE,
-    OFT_INCONSISTENT,
-    OFT_FILE_ERROR
-};
-
-/*
- * object_file_type() takes a file_name and determines what type of object
- * file it is.  If it is a fat file and the architectures are not of the same
- * type then OFT_INCONSISTENT is returned.  If the file_name can't be opened,
- * read or malformed then OFT_FILE_ERROR is returned.
- */
-extern
-enum object_file_type_retval
-object_file_type(
-const char *file_name,
-const char *program_name,
-char **error_message);
-
-struct prebind_cksum_arch {
-    cpu_type_t cputype;		/* cpu specifier */
-    cpu_subtype_t cpusubtype;	/* machine specifier */
-    unsigned long has_cksum;	/* 1 if the arch as an LC_PREBIND_CKSUM */
-    unsigned long cksum;	/* value of the cksum in LC_PREBIND_CKSUM */
-};
-
-/*
- * get_prebind_cksums() takes a file_name that is a Mach-O file or fat file
- * containing Mach-O files and returns a malloc(3)'ed array of
- * prebind_cksum_arch structs indirectly through the cksums parameter.  The
- * number of prebind_cksum_arch structs is returned indirectly through the
- * ncksums parameter.  If successful it returns zero else it returns non-zero.
- */
-extern
-int
-get_prebind_cksums(
-const char *file_name,
-struct prebind_cksum_arch **cksums,
-unsigned long *ncksums,
-const char *program_name,
-char **error_message);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/darwinbuild-changes/attachments/20110204/36de34a3/attachment-0001.html>


More information about the darwinbuild-changes mailing list