From ad285f60d0be807e7e49e7c86ca8f9bedec4714f Mon Sep 17 00:00:00 2001 From: Alon Zakai Date: Mon, 25 Mar 2013 12:58:25 -0700 Subject: remove symbol removing hack; export all malloc symbols as weak; add test for a case where symbol removing made us not merge llvm constructors properly --- emcc | 8 -------- system/lib/dlmalloc.c | 6 +++++- tests/runner.py | 28 ++++++++++++++++++++++++++++ tools/shared.py | 2 +- 4 files changed, 34 insertions(+), 10 deletions(-) diff --git a/emcc b/emcc index cd906c7b..bc76b01d 100755 --- a/emcc +++ b/emcc @@ -1232,14 +1232,6 @@ try: # We need to build and link the library in if DEBUG: print >> sys.stderr, 'emcc: including %s' % name libfile = shared.Cache.get(name, create) - if has and len(has) > 0: - # remove the symbols we do not need - fixed = in_temp(uniquename(libfile)) + '.bc' - shutil.copyfile(libfile, fixed) - for haz in has: - if DEBUG: print >> sys.stderr, 'emcc: including: removing symbol "%s" that we have' % haz - shared.Building.remove_symbol(fixed, haz) - libfile = fixed extra_files_to_link.append(libfile) force = True if fix and need: diff --git a/system/lib/dlmalloc.c b/system/lib/dlmalloc.c index 7e04a726..9a84d48f 100644 --- a/system/lib/dlmalloc.c +++ b/system/lib/dlmalloc.c @@ -532,6 +532,10 @@ #define DLMALLOC_VERSION 20806 #endif /* DLMALLOC_VERSION */ +#if EMSCRIPTEN +#define DLMALLOC_EXPORT __attribute__((__weak__, __visibility__("default"))) +#endif + #ifndef DLMALLOC_EXPORT #define DLMALLOC_EXPORT extern #endif @@ -6291,4 +6295,4 @@ int mspace_mallopt(int param_number, int value) { * Based loosely on libg++-1.2X malloc. (It retains some of the overall structure of old version, but most details differ.) - */ \ No newline at end of file + */ diff --git a/tests/runner.py b/tests/runner.py index f0b5445c..e3b62110 100755 --- a/tests/runner.py +++ b/tests/runner.py @@ -6245,6 +6245,34 @@ def process(filename): } ''' self.do_run(src, "some string constant") + + def test_std_cout_new(self): + src = ''' + #include + + struct NodeInfo { //structure that we want to transmit to our shaders + float x; + float y; + float s; + float c; + }; + const int nbNodes = 100; + NodeInfo * data = new NodeInfo[nbNodes]; //our data that will be transmitted using float texture. + + template + void printText( const char (&text)[ i ] ) + { + std::cout << text << std::endl; + } + + int main() + { + printText( "some string constant" ); + return 0; + } + ''' + + self.do_run(src, "some string constant") def test_istream(self): if self.emcc_args is None: return self.skip('requires libcxx') diff --git a/tools/shared.py b/tools/shared.py index 7514171c..c4efc974 100644 --- a/tools/shared.py +++ b/tools/shared.py @@ -181,7 +181,7 @@ def check_node_version(): # we re-check sanity when the settings are changed) # We also re-check sanity and clear the cache when the version changes -EMSCRIPTEN_VERSION = '1.3.4' +EMSCRIPTEN_VERSION = '1.3.5' def check_sanity(force=False): try: -- cgit v1.2.3-18-g5258