aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xemcc2
-rw-r--r--tools/shared.py8
2 files changed, 8 insertions, 2 deletions
diff --git a/emcc b/emcc
index 06a00006..6b3d8182 100755
--- a/emcc
+++ b/emcc
@@ -1066,7 +1066,7 @@ try:
# At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
exports = ','.join(map(lambda exp: exp[1:], shared.Settings.EXPORTED_FUNCTIONS))
# internalize carefully, llvm 3.2 will remove even main if not told not to
- link_opts += ['-internalize', '-internalize-public-api-list=' + exports, '-globaldce']
+ link_opts += shared.Building.get_safe_internalize() + ['-globaldce']
if DEBUG: print >> sys.stderr, 'emcc: LLVM linktime:', link_opts
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
if DEBUG: save_intermediate('dce', 'bc')
diff --git a/tools/shared.py b/tools/shared.py
index 0e219175..97b4fd05 100644
--- a/tools/shared.py
+++ b/tools/shared.py
@@ -922,6 +922,12 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
return Settings.INLINING_LIMIT == 0
@staticmethod
+ def get_safe_internalize():
+ exports = ','.join(map(lambda exp: exp[1:], Settings.EXPORTED_FUNCTIONS))
+ # internalize carefully, llvm 3.2 will remove even main if not told not to
+ return ['-internalize', '-internalize-public-api-list=' + exports]
+
+ @staticmethod
def pick_llvm_opts(optimization_level):
'''
It may be safe to use nonportable optimizations (like -OX) if we remove the platform info from the .ll
@@ -956,7 +962,7 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)''' % { 'winfix': '' if not WINDOWS e
opts.append('-basicaa') # makes fannkuch slow but primes fast
if Building.can_build_standalone():
- opts.append('-internalize')
+ opts += Building.get_safe_internalize()
opts.append('-globalopt')
opts.append('-ipsccp')