bug 551941 - fix 'unify' to recognize 64-bit Mach-O files. r=bsmedberg

--HG--
extra : rebase_source : 5b9ae5f47929f69d8c0627ed694b6c4354ca995e
This commit is contained in:
Ted Mielczarek 2010-03-17 11:55:56 -04:00
parent 59f4579506
commit 2e00065470
2 changed files with 30 additions and 2 deletions

View File

@ -134,6 +134,26 @@ check::
else \
echo "TEST-PASS | build/ | unify produced a universal binary!"; \
fi
# try building an x86-64 binary. if that succeeds, try unifying it
# with an i386 binary
-$(HOST_CC) -arch x86_64 $(srcdir)/unify-test.c -o unify-test-x86_64
@if test -f ./unify-test-x86_64; then \
if ! $(srcdir)/macosx/universal/unify ./unify-test-x86_64 ./unify-test-i386 \
./unify-test-universal-64; then \
echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary with a 64-bit input!"; \
false; \
fi; \
if test ! -f ./unify-test-universal-64; then \
echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary with a 64-bit input!"; \
false; \
fi; \
if ! file -b ./unify-test-universal-64 | head -n1 | grep -q "^Mach-O universal binary"; then \
echo "TEST-UNEXPECTED-FAIL | build/ | unify failed to produce a universal binary with a 64-bit input!"; \
false; \
else \
echo "TEST-PASS | build/ | unify produced a universal binary with a 64-bit input!"; \
fi \
fi
# try unifying two identical Java class files
rm -f unifytesta.class unifytestb.class unifytestc.class
cp $(srcdir)/unifytest.class ./unifytesta.class

View File

@ -1165,6 +1165,12 @@ sub readZipCRCs($) {
package FileAttrCache;
# from /usr/include/mach-o/loader.h
use constant MH_MAGIC => 0xfeedface;
use constant MH_CIGAM => 0xcefaedfe;
use constant MH_MAGIC_64 => 0xfeedfacf;
use constant MH_CIGAM_64 => 0xcffaedfe;
use Fcntl(':DEFAULT', ':mode');
# FileAttrCache->new($path)
@ -1243,8 +1249,10 @@ sub readZipCRCs($) {
}
# Accept Mach-O fat files or Mach-O thin files of either endianness.
if ($magic == 0xfeedface ||
$magic == 0xcefaedfe ||
if ($magic == MH_MAGIC ||
$magic == MH_CIGAM ||
$magic == MH_MAGIC_64 ||
$magic == MH_CIGAM_64 ||
$this->isFat()) {
return 1;
}