Skip to content

Commit ad285f6

Browse files
committed
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
1 parent 09221eb commit ad285f6

File tree

4 files changed

+34
-10
lines changed

4 files changed

+34
-10
lines changed

emcc

-8
Original file line numberDiff line numberDiff line change
@@ -1232,14 +1232,6 @@ try:
12321232
# We need to build and link the library in
12331233
if DEBUG: print >> sys.stderr, 'emcc: including %s' % name
12341234
libfile = shared.Cache.get(name, create)
1235-
if has and len(has) > 0:
1236-
# remove the symbols we do not need
1237-
fixed = in_temp(uniquename(libfile)) + '.bc'
1238-
shutil.copyfile(libfile, fixed)
1239-
for haz in has:
1240-
if DEBUG: print >> sys.stderr, 'emcc: including: removing symbol "%s" that we have' % haz
1241-
shared.Building.remove_symbol(fixed, haz)
1242-
libfile = fixed
12431235
extra_files_to_link.append(libfile)
12441236
force = True
12451237
if fix and need:

system/lib/dlmalloc.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@
532532
#define DLMALLOC_VERSION 20806
533533
#endif /* DLMALLOC_VERSION */
534534

535+
#if EMSCRIPTEN
536+
#define DLMALLOC_EXPORT __attribute__((__weak__, __visibility__("default")))
537+
#endif
538+
535539
#ifndef DLMALLOC_EXPORT
536540
#define DLMALLOC_EXPORT extern
537541
#endif
@@ -6291,4 +6295,4 @@ int mspace_mallopt(int param_number, int value) {
62916295
* Based loosely on libg++-1.2X malloc. (It retains some of the overall
62926296
structure of old version, but most details differ.)
62936297
6294-
*/
6298+
*/

tests/runner.py

+28
Original file line numberDiff line numberDiff line change
@@ -6245,6 +6245,34 @@ def test_direct_string_constant_usage(self):
62456245
}
62466246
'''
62476247
self.do_run(src, "some string constant")
6248+
6249+
def test_std_cout_new(self):
6250+
src = '''
6251+
#include <iostream>
6252+
6253+
struct NodeInfo { //structure that we want to transmit to our shaders
6254+
float x;
6255+
float y;
6256+
float s;
6257+
float c;
6258+
};
6259+
const int nbNodes = 100;
6260+
NodeInfo * data = new NodeInfo[nbNodes]; //our data that will be transmitted using float texture.
6261+
6262+
template<int i>
6263+
void printText( const char (&text)[ i ] )
6264+
{
6265+
std::cout << text << std::endl;
6266+
}
6267+
6268+
int main()
6269+
{
6270+
printText( "some string constant" );
6271+
return 0;
6272+
}
6273+
'''
6274+
6275+
self.do_run(src, "some string constant")
62486276

62496277
def test_istream(self):
62506278
if self.emcc_args is None: return self.skip('requires libcxx')

tools/shared.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def check_node_version():
181181
# we re-check sanity when the settings are changed)
182182
# We also re-check sanity and clear the cache when the version changes
183183

184-
EMSCRIPTEN_VERSION = '1.3.4'
184+
EMSCRIPTEN_VERSION = '1.3.5'
185185

186186
def check_sanity(force=False):
187187
try:

0 commit comments

Comments
 (0)