aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2012-01-18 21:02:12 -0800
committerAlon Zakai <alonzakai@gmail.com>2012-01-18 21:02:12 -0800
commitf0c1bdde63e589b707f43e762d5cdc973c59becb (patch)
treef8786d2980f772a0ab7e865197c120e3ad4e46f1
parent28686e4941103f51270df388d808d9bc7c00d566 (diff)
move libc++ new into dlmalloc in terms of emcc library autolinking
-rwxr-xr-xemcc11
-rw-r--r--system/lib/dlmalloc.symbols50
-rw-r--r--system/lib/libcxx/Makefile1
-rw-r--r--system/lib/libcxx/symbols30
-rw-r--r--tests/runner.py2
5 files changed, 59 insertions, 35 deletions
diff --git a/emcc b/emcc
index 37e916c9..5ecc3696 100755
--- a/emcc
+++ b/emcc
@@ -451,9 +451,12 @@ try:
# dlmalloc
def create_dlmalloc():
- print >> sys.stderr, 'emcc: building dlmalloc for cache'
+ if DEBUG: print >> sys.stderr, 'emcc: building dlmalloc for cache'
Popen([shared.EMCC, shared.path_from_root('system', 'lib', 'dlmalloc.c'), '-g', '-o', in_temp('dlmalloc.o')], stdout=PIPE, stderr=PIPE).communicate()
- return in_temp('dlmalloc.o')
+ # we include the libc++ new stuff here, so that the common case of using just new/delete is quick to link
+ Popen([shared.EMXX, shared.path_from_root('system', 'lib', 'libcxx', 'new.cpp'), '-g', '-o', in_temp('new.o')], stdout=PIPE, stderr=PIPE).communicate()
+ shared.Building.link([in_temp('dlmalloc.o'), in_temp('new.o')], in_temp('dlmalloc_full.o'))
+ return in_temp('dlmalloc_full.o')
def fix_dlmalloc():
# dlmalloc needs some sign correction. # If we are in mode 0, switch to 2. We will add our lines
try:
@@ -464,11 +467,11 @@ 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 = 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'])
+ dlmalloc_symbols = open(shared.path_from_root('system', 'lib', 'dlmalloc.symbols')).read().split('\n')
# libcxx
def create_libcxx():
- print >> sys.stderr, 'emcc: building libcxx for cache'
+ if DEBUG: print >> sys.stderr, 'emcc: building libcxx for cache'
shared.Building.build_library('libcxx', shared.EMSCRIPTEN_TEMP_DIR, shared.EMSCRIPTEN_TEMP_DIR, ['libcxx.bc'], configure=None, copy_project=True, source_dir=shared.path_from_root('system', 'lib', 'libcxx'))
return os.path.join(shared.EMSCRIPTEN_TEMP_DIR, 'libcxx', 'libcxx.bc')
def fix_libcxx():
diff --git a/system/lib/dlmalloc.symbols b/system/lib/dlmalloc.symbols
new file mode 100644
index 00000000..d41f4140
--- /dev/null
+++ b/system/lib/dlmalloc.symbols
@@ -0,0 +1,50 @@
+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
+_ZdaPv
+_ZdaPvRKSt9nothrow_t
+_ZdlPv
+_ZdlPvRKSt9nothrow_t
+_Znaj
+_ZnajRKSt9nothrow_t
+_Znwj
+_ZnwjRKSt9nothrow_t
+_ZL13__new_handler
+_ZSt15get_new_handlerv
+_ZSt15set_new_handlerPFvvE
+_ZTVSt9bad_alloc
+_ZTSSt9bad_alloc
+_ZNKSt9bad_alloc4whatEv
+_ZNSt9bad_allocC1Ev
+_ZNSt9bad_allocC2Ev
+_ZNSt9bad_allocD0Ev
+_ZNSt9bad_allocD1Ev
+_ZNSt9bad_allocD2Ev
+_ZSt17__throw_bad_allocv
+_ZTISt9bad_alloc
+_ZTVSt20bad_array_new_length
+_ZTSSt20bad_array_new_length
+_ZTISt20bad_array_new_length
+_ZNKSt20bad_array_new_length4whatEv
+_ZNSt20bad_array_new_lengthC1Ev
+_ZNSt20bad_array_new_lengthC2Ev
+_ZNSt20bad_array_new_lengthD0Ev
+_ZNSt20bad_array_new_lengthD1Ev
+_ZNSt20bad_array_new_lengthD2Ev
diff --git a/system/lib/libcxx/Makefile b/system/lib/libcxx/Makefile
index 432ba492..98a5974d 100644
--- a/system/lib/libcxx/Makefile
+++ b/system/lib/libcxx/Makefile
@@ -20,7 +20,6 @@ OBJECTS = \
exception.bc \
ios.bc \
locale.bc \
- new.bc \
regex.bc \
strstream.bc \
typeinfo.bc
diff --git a/system/lib/libcxx/symbols b/system/lib/libcxx/symbols
index 4b1e4398..124a88f4 100644
--- a/system/lib/libcxx/symbols
+++ b/system/lib/libcxx/symbols
@@ -49,7 +49,6 @@
d _ZGVZNSt3__1L11init_wam_pmEvE5am_pm
d _ZGVZNSt3__1L11init_wweeksEvE5weeks
d _ZGVZNSt3__1L12init_wmonthsEvE6months
- d _ZL13__new_handler
d _ZL19__terminate_handler
d _ZL20__unexpected_handler
T _ZN12_GLOBAL__N_114__libcpp_nmstrC1EPKc
@@ -66,7 +65,6 @@
T _ZNKSt13bad_exception4whatEv
T _ZNKSt13runtime_error4whatEv
T _ZNKSt16nested_exception14rethrow_nestedEv
- T _ZNKSt20bad_array_new_length4whatEv
T _ZNKSt3__110__time_put8__do_putEPcRS1_PK2tmcc
T _ZNKSt3__110__time_put8__do_putEPwRS1_PK2tmcc
T _ZNKSt3__110error_code7messageEv
@@ -770,7 +768,6 @@
W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_bRNS_8ios_baseEwRKNS_12basic_stringIwS3_NS_9allocatorIwEEEE
W _ZNKSt3__19money_putIwNS_19ostreambuf_iteratorIwNS_11char_traitsIwEEEEE6do_putES4_bRNS_8ios_baseEwe
T _ZNKSt8bad_cast4whatEv
- T _ZNKSt9bad_alloc4whatEv
T _ZNKSt9exception4whatEv
T _ZNSt10bad_typeidC1Ev
T _ZNSt10bad_typeidC2Ev
@@ -831,11 +828,6 @@
T _ZNSt16nested_exceptionD0Ev
T _ZNSt16nested_exceptionD1Ev
T _ZNSt16nested_exceptionD2Ev
- T _ZNSt20bad_array_new_lengthC1Ev
- T _ZNSt20bad_array_new_lengthC2Ev
- T _ZNSt20bad_array_new_lengthD0Ev
- ? _ZNSt20bad_array_new_lengthD1Ev
- T _ZNSt20bad_array_new_lengthD2Ev
C _ZNSt3__110__find_endIRNS_11__traits_eqINS_11char_traitsIcEEEEPKcS7_EET0_S8_S8_T1_S9_T_NS_26random_access_iterator_tagESB_
C _ZNSt3__110__find_endIRNS_11__traits_eqINS_11char_traitsIwEEEEPKwS7_EET0_S8_S8_T1_S9_T_NS_26random_access_iterator_tagESB_
C _ZNSt3__110__sscanf_lEPKcPvS1_z
@@ -2574,11 +2566,6 @@
T _ZNSt8bad_castD0Ev
T _ZNSt8bad_castD1Ev
T _ZNSt8bad_castD2Ev
- T _ZNSt9bad_allocC1Ev
- T _ZNSt9bad_allocC2Ev
- T _ZNSt9bad_allocD0Ev
- T _ZNSt9bad_allocD1Ev
- T _ZNSt9bad_allocD2Ev
T _ZNSt9exceptionD0Ev
T _ZNSt9exceptionD1Ev
T _ZNSt9exceptionD2Ev
@@ -2587,9 +2574,6 @@
T _ZSt13set_terminatePFvvE
T _ZSt14get_unexpectedv
T _ZSt14set_unexpectedPFvvE
- T _ZSt15get_new_handlerv
- T _ZSt15set_new_handlerPFvvE
- T _ZSt17__throw_bad_allocv
T _ZSt17current_exceptionv
T _ZSt17rethrow_exceptionSt13exception_ptr
C _ZSt18make_exception_ptrINSt3__112future_errorEESt13exception_ptrT_
@@ -2737,9 +2721,7 @@
D _ZTISt15underflow_error
D _ZTISt16invalid_argument
D _ZTISt16nested_exception
- D _ZTISt20bad_array_new_length
D _ZTISt8bad_cast
- D _ZTISt9bad_alloc
D _ZTISt9exception
C _ZTSNSt3__110__stdinbufIcEE
C _ZTSNSt3__110__stdinbufIwEE
@@ -2875,9 +2857,7 @@
D _ZTSSt15underflow_error
D _ZTSSt16invalid_argument
D _ZTSSt16nested_exception
- D _ZTSSt20bad_array_new_length
D _ZTSSt8bad_cast
- D _ZTSSt9bad_alloc
D _ZTSSt9exception
D _ZTTNSt3__110istrstreamE
D _ZTTNSt3__110ostrstreamE
@@ -3002,9 +2982,7 @@
D _ZTVSt15underflow_error
D _ZTVSt16invalid_argument
D _ZTVSt16nested_exception
- D _ZTVSt20bad_array_new_length
D _ZTVSt8bad_cast
- D _ZTVSt9bad_alloc
D _ZTVSt9exception
W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__XEv
W _ZThn8_NKSt3__115time_get_bynameIcNS_19istreambuf_iteratorIcNS_11char_traitsIcEEEEE3__cEv
@@ -3119,11 +3097,3 @@
d _ZZNSt3__1L11init_wam_pmEvE5am_pm
d _ZZNSt3__1L11init_wweeksEvE5weeks
d _ZZNSt3__1L12init_wmonthsEvE6months
- W _ZdaPv
- W _ZdaPvRKSt9nothrow_t
- W _ZdlPv
- W _ZdlPvRKSt9nothrow_t
- W _Znaj
- W _ZnajRKSt9nothrow_t
- W _Znwj
- W _ZnwjRKSt9nothrow_t
diff --git a/tests/runner.py b/tests/runner.py
index 407cfc00..15a088e8 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -257,6 +257,8 @@ if 'benchmark' not in str(sys.argv) and 'sanity' not in str(sys.argv):
print "Running Emscripten tests..."
+ Cache.erase() # Wipe the cache, so that we always test populating it in the test runner
+
class T(RunnerCore): # Short name, to make it more fun to use manually on the commandline
## Does a complete test - builds, runs, checks output, etc.
def do_run(self, src, expected_output=None, args=[], output_nicerizer=None, output_processor=None, no_build=False, main_file=None, additional_files=[], js_engines=None, post_build=None, basename='src.cpp', libraries=[], includes=[], force_c=False, build_ll_hook=None, extra_emscripten_args=[]):