Skip to content

Commit

Permalink
remove symbol removing hack; export all malloc symbols as weak; add t…
Browse files Browse the repository at this point in the history
…est for a case where symbol removing made us not merge llvm constructors properly
  • Loading branch information
kripken committed Mar 25, 2013
1 parent 09221eb commit ad285f6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 10 deletions.
8 changes: 0 additions & 8 deletions emcc
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
6 changes: 5 additions & 1 deletion system/lib/dlmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.)
*/
*/
28 changes: 28 additions & 0 deletions tests/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -6245,6 +6245,34 @@ def test_direct_string_constant_usage(self):
}
'''
self.do_run(src, "some string constant")

def test_std_cout_new(self):
src = '''
#include <iostream>
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<int i>
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')
Expand Down
2 changes: 1 addition & 1 deletion tools/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit ad285f6

Please sign in to comment.