summaryrefslogtreecommitdiff
path: root/emcc
diff options
context:
space:
mode:
Diffstat (limited to 'emcc')
-rwxr-xr-xemcc61
1 files changed, 43 insertions, 18 deletions
diff --git a/emcc b/emcc
index 8f71883d..df2ef38c 100755
--- a/emcc
+++ b/emcc
@@ -137,7 +137,7 @@ Options that are modified or new in %s include:
opt levels, see apply_opt_level() in
tools/shared.py and also src/settings.js.)
-O2 As -O1, plus the relooper (loop recreation),
- LLVM -O2 optimizations, and
+ LLVM -O3 optimizations, and
-s ALIASING_FUNCTION_POINTERS=1
@@ -219,6 +219,9 @@ Options that are modified or new in %s include:
1: Parallel typed arrays
2: Shared (C-like) typed arrays (default)
+ --js-opts 0: Prevent JS optimizer from running
+ 1: Use JS optimizer (default)
+
--llvm-opts <level> 0: No LLVM optimizations (default in -O0)
1: -O1 LLVM optimizations (default in -O1)
2: -O2 LLVM optimizations
@@ -462,6 +465,12 @@ Options that are modified or new in %s include:
memory initialization data embedded inside
JavaScript as text. (default is off)
+ -Wno-warn-absolute-paths If not specified, the compiler will warn about any
+ uses of absolute paths in -I and -L command line
+ directives. Pass this flag on the command line
+ to hide these warnings and acknowledge that the
+ explicit use of absolute paths is intentional.
+
The target file, if specified (-o <target>), defines what will
be generated:
@@ -706,6 +715,7 @@ try:
opt_level = 0
debug_level = 0
+ js_opts = None
llvm_opts = None
llvm_lto = None
closure = None
@@ -735,6 +745,12 @@ try:
absolute_warning_shown = False
+ # Scan for warning suppression message in advance from other cmdline flags, so that it works even if -I or -L directives are present before this.
+ for i in range(len(newargs)):
+ if newargs[i] == '-Wno-warn-absolute-paths':
+ newargs[i] = ''
+ absolute_warning_shown = True
+
settings_changes = []
def validate_arg_level(level_string, max_level, err_msg):
@@ -755,6 +771,11 @@ try:
settings_changes.append('INLINING_LIMIT=50')
opt_level = validate_arg_level(requested_level, 3, 'Invalid optimization level: ' + newargs[i])
newargs[i] = ''
+ elif newargs[i].startswith('--js-opts'):
+ check_bad_eq(newargs[i])
+ js_opts = eval(newargs[i+1])
+ newargs[i] = ''
+ newargs[i+1] = ''
elif newargs[i].startswith('--llvm-opts'):
check_bad_eq(newargs[i])
llvm_opts = eval(newargs[i+1])
@@ -879,7 +900,7 @@ try:
elif newargs[i].startswith(('-I', '-L')):
path_name = newargs[i][2:]
if not absolute_warning_shown and os.path.isabs(path_name):
- logging.warning ('-I or -L of an absolute path "' + newargs[i] + '" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript)') # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not
+ logging.warning ('-I or -L of an absolute path "' + newargs[i] + '" encountered. If this is to a local system header/library, it may cause problems (local system files make sense for compiling natively on your system, but not necessarily to JavaScript). Pass \'-Wno-warn-absolute-paths\' to emcc to hide this warning.') # Of course an absolute path to a non-system-specific library or header is fine, and you can ignore this warning. The danger are system headers that are e.g. x86 specific and nonportable. The emscripten bundled headers are modified to be portable, local system ones are generally not
absolute_warning_shown = True
newargs = [ arg for arg in newargs if arg is not '' ]
@@ -887,6 +908,7 @@ try:
if default_cxx_std:
newargs = newargs + [default_cxx_std]
+ if js_opts is None: js_opts = True
if llvm_opts is None: llvm_opts = LLVM_OPT_LEVEL[opt_level]
if llvm_lto is None and opt_level >= 3: llvm_lto = 3
if opt_level == 0: debug_level = 4
@@ -1285,6 +1307,11 @@ try:
'wctob.c',
'wctomb.c',
]],
+ ['stdlib', [
+ 'ecvt.c',
+ 'fcvt.c',
+ 'gcvt.c',
+ ]],
['string', [
'wcpcpy.c',
'wcpncpy.c',
@@ -1577,7 +1604,7 @@ try:
js_optimizer_queue = []
js_optimizer_extra_info = {}
- if opt_level >= 1:
+ if opt_level >= 1 and js_opts:
logging.debug('running pre-closure post-opts')
if DEBUG == '2':
@@ -1594,9 +1621,6 @@ try:
js_optimizer_queue += [get_eliminate(), 'simplifyExpressions']
- if shared.Settings.RELOOP and not shared.Settings.ASM_JS:
- js_optimizer_queue += ['optimizeShiftsAggressive', get_eliminate()] # aggressive shifts optimization requires loops, it breaks on switches
-
if closure and not shared.Settings.ASM_JS:
flush_js_optimizer_queue()
@@ -1606,23 +1630,24 @@ try:
final = shared.Building.closure_compiler(final)
if DEBUG: save_intermediate('closure')
- if shared.Settings.OUTLINING_LIMIT > 0:
- js_optimizer_queue += ['outline']
- js_optimizer_extra_info['sizeToOutline'] = shared.Settings.OUTLINING_LIMIT
+ if js_opts:
+ if shared.Settings.OUTLINING_LIMIT > 0:
+ js_optimizer_queue += ['outline']
+ js_optimizer_extra_info['sizeToOutline'] = shared.Settings.OUTLINING_LIMIT
- if (not closure or shared.Settings.ASM_JS) and shared.Settings.RELOOP and debug_level < 3:
- js_optimizer_queue += ['registerize']
+ if (not closure or shared.Settings.ASM_JS) and shared.Settings.RELOOP and debug_level < 3:
+ js_optimizer_queue += ['registerize']
- if opt_level > 0:
- if debug_level < 2 and shared.Settings.ASM_JS: js_optimizer_queue = map(lambda p: p if p != 'registerize' else 'registerizeAndMinify', js_optimizer_queue)
- if debug_level == 0: js_optimizer_queue += ['minifyWhitespace']
+ if opt_level > 0:
+ if debug_level < 2 and shared.Settings.ASM_JS: js_optimizer_queue = map(lambda p: p if p != 'registerize' else 'registerizeAndMinify', js_optimizer_queue)
+ if debug_level == 0: js_optimizer_queue += ['minifyWhitespace']
- if closure and shared.Settings.ASM_JS:
- js_optimizer_queue += ['closure']
+ if closure and shared.Settings.ASM_JS:
+ js_optimizer_queue += ['closure']
- if not shared.Settings.SIDE_MODULE: js_optimizer_queue += ['last'] # side modules are not finalized until after relocation
+ if not shared.Settings.SIDE_MODULE: js_optimizer_queue += ['last'] # side modules are not finalized until after relocation
- flush_js_optimizer_queue()
+ flush_js_optimizer_queue()
# Remove some trivial whitespace # TODO: do not run when compress has already been done on all parts of the code
src = open(final).read()