aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-03 15:23:37 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-03 15:23:37 -0800
commitde466a25b02cf684dd0abfc6514d3270d6d1dfb6 (patch)
treef4b1945a55a24aeffa8773bcbf600246a073cf83 /tools/shared.py
parent4cab9f5a5ac72e9eaf904ace0ebe29d5e30ba9b6 (diff)
parent642a4368d88f334163cdbf0e7881445bf19c366f (diff)
Merge pull request #155 from FishingCactus/osx_darwin_fix
Fix bit code detection when llvm is compiled with darwin as a target
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 970edc67..294f15ee 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -666,5 +666,12 @@ class Building:
return False
# look for magic signature
b = open(filename, 'r').read(4)
- return b[0] == 'B' and b[1] == 'C'
+ if b[0] == 'B' and b[1] == 'C':
+ return True
+ # on OS X, there is a 20-byte prefix
+ elif ord(b[0]) == 222 and ord(b[1]) == 192 and ord(b[2]) == 23 and ord(b[3]) == 11:
+ b = open(filename, 'r').read(24)
+ return b[20] == 'B' and b[21] == 'C'
+
+ return False