Skip to content

Commit 68fa40a

Browse files
committed
safely internalize in s_x_x tests too
1 parent 5d28c31 commit 68fa40a

2 files changed

Lines changed: 8 additions & 2 deletions

File tree

emcc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ try:
10661066
# At minimum remove dead functions etc., this potentially saves a lot in the size of the generated code (and the time to compile it)
10671067
exports = ','.join(map(lambda exp: exp[1:], shared.Settings.EXPORTED_FUNCTIONS))
10681068
# internalize carefully, llvm 3.2 will remove even main if not told not to
1069-
link_opts += ['-internalize', '-internalize-public-api-list=' + exports, '-globaldce']
1069+
link_opts += shared.Building.get_safe_internalize() + ['-globaldce']
10701070
if DEBUG: print >> sys.stderr, 'emcc: LLVM linktime:', link_opts
10711071
shared.Building.llvm_opt(in_temp(target_basename + '.bc'), link_opts)
10721072
if DEBUG: save_intermediate('dce', 'bc')

tools/shared.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,12 @@ def can_use_unsafe_opts():
921921
def can_inline():
922922
return Settings.INLINING_LIMIT == 0
923923

924+
@staticmethod
925+
def get_safe_internalize():
926+
exports = ','.join(map(lambda exp: exp[1:], Settings.EXPORTED_FUNCTIONS))
927+
# internalize carefully, llvm 3.2 will remove even main if not told not to
928+
return ['-internalize', '-internalize-public-api-list=' + exports]
929+
924930
@staticmethod
925931
def pick_llvm_opts(optimization_level):
926932
'''
@@ -956,7 +962,7 @@ def pick_llvm_opts(optimization_level):
956962
opts.append('-basicaa') # makes fannkuch slow but primes fast
957963

958964
if Building.can_build_standalone():
959-
opts.append('-internalize')
965+
opts += Building.get_safe_internalize()
960966

961967
opts.append('-globalopt')
962968
opts.append('-ipsccp')

0 commit comments

Comments
 (0)