aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-12-19 16:40:04 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-12-19 16:40:04 -0800
commit13d9afee880f54463be7f5ad850ef45832931c59 (patch)
tree8e6bb855a969d0661a4bab703df154f105b242bf /tools
parent5445cdd01d408e5f1a0d1a23b29b30a973560ced (diff)
keep order of unique link inputs the same, for jcache
Diffstat (limited to 'tools')
-rw-r--r--tools/shared.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/shared.py b/tools/shared.py
index 461f0561..a826ef48 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -511,6 +511,14 @@ def read_pgo_data(filename):
'overflows_lines': overflows_lines
}
+def unique_ordered(values): # return a list of unique values in an input list, without changing order (list(set(.)) would change order randomly)
+ seen = set()
+ def check(value):
+ if value in seen: return False
+ seen.add(value)
+ return True
+ return filter(check, values)
+
# Settings. A global singleton. Not pretty, but nicer than passing |, settings| everywhere
class Settings:
@@ -787,7 +795,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
try_delete(target)
# Finish link
- actual_files = list(set(actual_files)) # tolerate people trying to link a.so a.so etc.
+ actual_files = unique_ordered(actual_files) # tolerate people trying to link a.so a.so etc.
if DEBUG: print >>sys.stderr, 'emcc: llvm-linking:', actual_files
output = Popen([LLVM_LINK] + actual_files + ['-o', target], stdout=PIPE).communicate()[0]
assert os.path.exists(target) and (output is None or 'Could not open input file' not in output), 'Linking error: ' + output