aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-02-02 15:31:49 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-02-02 15:31:49 -0800
commit364948c9a25be1896bdbdf02b9d708bd7972436c (patch)
treeed2a6c31c33b7913caff6301c8d9bfa95c3b6f63 /tools/shared.py
parentaebbf2a99402eecf7a53786ec355c59b52090beb (diff)
accept empty bitcode files as valid bitcode files
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 2304d817..aedf054b 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -701,9 +701,14 @@ class Building:
# if the file doesn't exist or doesn't have valid symbols, it isn't bitcode
try:
defs = Building.llvm_nm(filename, stderr=PIPE)
- assert len(defs.defs) + len(defs.undefs) + len(defs.commons) > 0
+ # If no symbols found, it might just be an empty bitcode file, try to dis it
+ if len(defs.defs) + len(defs.undefs) + len(defs.commons) == 0:
+ test_ll = os.path.join(EMSCRIPTEN_TEMP_DIR, 'test.ll')
+ Building.llvm_dis(filename, test_ll)
+ assert os.path.exists(test_ll)
except:
return False
+
# look for magic signature
b = open(filename, 'r').read(4)
if b[0] == 'B' and b[1] == 'C':