aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-18 10:40:29 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-18 10:40:29 -0800
commitdd68fbf78cf34aacb54c284b474399ef94373045 (patch)
tree90577f8ba0c24144e147f2a1cbc9df1657f51c54
parent67040a3b6e211f195fccefa06610dd730c21b42e (diff)
further refactor the library scanning code, and prepare for libcxx
-rwxr-xr-xemcc6
-rw-r--r--system/lib/libcxx/symbols1
-rw-r--r--tools/shared.py10
3 files changed, 10 insertions, 7 deletions
diff --git a/emcc b/emcc
index 1e7279f8..6d0e9cb7 100755
--- a/emcc
+++ b/emcc
@@ -464,7 +464,7 @@ try:
shared.Settings.CORRECT_SIGNS_LINES = [shared.path_from_root('src', 'dlmalloc.c') + ':' + str(i+4) for i in [4816, 4191, 4246, 4199, 4205, 4235, 4227]]
# If we are in mode 1, we are correcting everything anyhow. If we are in mode 3, we will be corrected
# so all is well anyhow too.
- dlmalloc_symbols = ('malloc', 'free', 'calloc', 'memalign', 'realloc', 'valloc', 'pvalloc', 'mallinfo', 'mallopt', 'malloc_trim', 'malloc_stats', 'malloc_usable_size', 'malloc_footprint', 'malloc_max_footprint', 'independent_calloc', 'independent_comalloc', '_Znwj', '_Znaj', '_Znam', '_Znwm')
+ dlmalloc_symbols = set(['malloc', 'free', 'calloc', 'memalign', 'realloc', 'valloc', 'pvalloc', 'mallinfo', 'mallopt', 'malloc_trim', 'malloc_stats', 'malloc_usable_size', 'malloc_footprint', 'malloc_max_footprint', 'independent_calloc', 'independent_comalloc', '_Znwj', '_Znaj', '_Znam', '_Znwm'])
# libcxx
def create_libcxx():
@@ -475,7 +475,9 @@ try:
# libcxx probably needs sign correction. # If we are in mode 0, switch to 2. We will add our lines
shared.Settings.CORRECT_SIGNS = 1
print >> sys.stderr, 'emcc: warning: using libcxx turns on CORRECT_SIGNS'
- libcxx_symbols = ('blarg')
+ libcxx_symbols = map(lambda line: line.strip().split(' ')[1], open(shared.path_from_root('system', 'lib', 'libcxx', 'symbols')).readlines())
+ libcxx_symbols = filter(lambda symbol: symbol not in dlmalloc_symbols, libcxx_symbols)
+ libcxx_symbols = set(libcxx_symbols)
for name, create, fix, library_symbols in [('dlmalloc', create_dlmalloc, fix_dlmalloc, dlmalloc_symbols)]:
#('libcxx', create_libcxx, fix_libcxx, libcxx_symbols)]:
diff --git a/system/lib/libcxx/symbols b/system/lib/libcxx/symbols
index 88770e82..4b1e4398 100644
--- a/system/lib/libcxx/symbols
+++ b/system/lib/libcxx/symbols
@@ -3127,4 +3127,3 @@
W _ZnajRKSt9nothrow_t
W _Znwj
W _ZnwjRKSt9nothrow_t
-
diff --git a/tools/shared.py b/tools/shared.py
index 4fb02987..c869d4f5 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -487,15 +487,17 @@ class Building:
# LLVM binary ==> list of symbols
output = Popen([LLVM_NM, filename], stdout=stdout, stderr=stderr).communicate()[0]
class ret:
- defs = {}
- undefs = {}
+ defs = []
+ undefs = []
for line in output.split('\n'):
if len(line) == 0: continue
status, symbol = filter(lambda seg: len(seg) > 0, line.split(' '))
if status == 'U':
- ret.undefs[symbol] = True
+ ret.undefs.append(symbol)
else:
- ret.defs[symbol] = True
+ ret.defs.append(symbol)
+ ret.defs = set(ret.defs)
+ ret.undefs = set(ret.undefs)
return ret
@staticmethod