aboutsummaryrefslogtreecommitdiff
path: root/tools/shared.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/shared.py')
-rw-r--r--tools/shared.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/shared.py b/tools/shared.py
index e11dc95a..73e2a9a7 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -473,7 +473,10 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
@staticmethod
def link(files, target):
try_delete(target)
+ stub = 'a.out' if not WINDOWS else 'a.exe'
+ need_cleanup = not os.path.exists(stub)
output = Popen([LLVM_LD, '-disable-opt'] + files + ['-b', target], stdout=PIPE).communicate()[0]
+ if need_cleanup: try_delete(stub) # clean up stub left by the linker
assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output
# Emscripten optimizations that we run on the .ll file