aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemcc5
-rw-r--r--tools/shared.py2
2 files changed, 5 insertions, 2 deletions
diff --git a/emcc b/emcc
index eea3b782..21f8f914 100755
--- a/emcc
+++ b/emcc
@@ -1117,6 +1117,11 @@ try:
input_files.append(shared.path_from_root('third_party', 'stb_image.c'))
shared.Settings.EXPORTED_FUNCTIONS += ['_stbi_load', '_stbi_load_from_memory', '_stbi_image_free']
+ for required_export in ['_malloc', '_free']:
+ # always need malloc and free to be kept alive and exported, for internal use and other modules
+ if required_export not in shared.Settings.EXPORTED_FUNCTIONS:
+ shared.Settings.EXPORTED_FUNCTIONS.append(required_export)
+
## Compile source code to bitcode
logging.debug('compiling to bitcode')
diff --git a/tools/shared.py b/tools/shared.py
index 786d8d71..774d95fe 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -1179,8 +1179,6 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
def get_safe_internalize():
if not Building.can_build_standalone(): return [] # do not internalize anything
exps = expand_response(Settings.EXPORTED_FUNCTIONS)
- if '_malloc' not in exps: exps.append('_malloc') # needed internally, even if user did not add to EXPORTED_FUNCTIONS
- if '_free' not in exps: exps.append('_free')
exports = ','.join(map(lambda exp: exp[1:], exps))
# internalize carefully, llvm 3.2 will remove even main if not told not to
return ['-internalize', '-internalize-public-api-list=' + exports]