Skip to content

Commit c20110d

Browse files
committed
Speed up emcc -v by not running sanity checks.
ince some build tools run `emcc -v` regularly we want to be fast. This change avoid running sanity checks which means fewer subprocesses. On my machine this takes `emcc -v ` from ~300 ro ~200 ms. Sanity checks are still run on first use. See: #13004
1 parent 98ce0cb commit c20110d

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

ChangeLog.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ Current Trunk
2323

2424
2.0.11: 12/17/2020
2525
------------------
26+
- `emcc -v` no longer forces the running the sanity checks. Sanity checks
27+
are always run on first use (or when the cache is cleaned), and when
28+
`EMCC_DEBUG` is set in the environment. Not forcing this allows `emcc -v`
29+
to run a little faster which speeds up build systems that depend on running
30+
this frequently.
2631
- An upstream LLVM regression with global initializer linking has been fixed
2732
(#13038).
2833
- Remove a racy unneeded assertion about async dynamic linking (#13060).

docs/emcc.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,10 +401,8 @@ Options that are modified or new in *emcc* are listed below:
401401
"-v"
402402
Turns on verbose output.
403403

404-
This will pass "-v" to *Clang*, and also enable "EMCC_DEBUG" to
405-
generate intermediate files for the compiler's various stages. It
406-
will also run Emscripten's internal sanity checks on the toolchain,
407-
etc.
404+
This will print the internal sub-commands run by emscripten as well
405+
as "-v" to *Clang*.
408406

409407
Tip:
410408

emcc.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -796,9 +796,7 @@ def run(args):
796796
if len(args) == 1 and args[0] == '-v': # -v with no inputs
797797
# autoconf likes to see 'GNU' in the output to enable shared object support
798798
print('emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) %s' % shared.EMSCRIPTEN_VERSION, file=sys.stderr)
799-
code = shared.check_call([clang, '-v'] + shared.get_clang_flags(), check=False).returncode
800-
shared.check_sanity(force=True)
801-
return code
799+
return shared.check_call([clang, '-v'] + shared.get_clang_flags(), check=False).returncode
802800

803801
if '-dumpmachine' in args:
804802
print(shared.get_llvm_target())
@@ -2519,7 +2517,6 @@ def consume_arg_file():
25192517
options.ignore_dynamic_linking = True
25202518
elif arg == '-v':
25212519
shared.PRINT_STAGES = True
2522-
shared.check_sanity(force=True)
25232520
elif check_arg('--shell-file'):
25242521
options.shell_path = consume_arg_file()
25252522
elif check_arg('--source-map-base'):

site/source/docs/getting_started/FAQ.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Why do I get multiple errors building basic code and the tests?
1717

1818
All the tests in the :ref:`Emscripten test suite <emscripten-test-suite>` are known to build and pass on our test infrastructure, so if you see failures locally it is likely that there is some problem with your environment. (Rarely, there may be temporary breakage, but never on a tagged release version.)
1919

20-
First call ``emcc -v``, which runs basic sanity checks and prints out useful environment information. If that doesn't help, follow the instructions in :ref:`verifying-the-emscripten-environment`.
20+
First call ``emcc -v``, prints out useful environment information. If that doesn't help, follow the instructions in :ref:`verifying-the-emscripten-environment`.
2121

2222
You might also want to go through the :ref:`Tutorial` again, as it is updated as Emscripten changes.
2323

site/source/docs/porting/Debugging.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ directory (e.g. **/tmp** on UNIX).
5757

5858
The debug logs can be analysed to profile and review the changes that were made in each step.
5959

60-
.. note:: The debug mode can also be enabled by specifying the :ref:`verbose output <debugging-emcc-v>` compiler flag (``emcc -v``).
60+
.. note:: The more limited amount of debug information can also be enabled by specifying the :ref:`verbose output <debugging-emcc-v>` compiler flag (``emcc -v``).
6161

6262

6363
.. _debugging-compilation-settings:
@@ -121,10 +121,8 @@ Emscripten also supports some of Clang's sanitizers, such as :ref:`sanitizer_ubs
121121
emcc verbose output
122122
===================
123123

124-
Compiling with the :ref:`emcc -v <emcc-verbose>` option passes ``-v`` to LLVM and runs Emscripten's internal sanity checks on the toolchain.
125-
126-
The verbose mode also enables Emscripten's :ref:`debugging-EMCC_DEBUG` to generate intermediate files for the compiler’s various stages.
127-
124+
Compiling with the :ref:`emcc -v <emcc-verbose>` will cause Emscripten to output
125+
the sub-command that it runs as well as passes ``-v`` to Clang.
128126

129127
.. _debugging-manual-debugging:
130128

site/source/docs/tools_reference/emcc.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,8 @@ Options that are modified or new in *emcc* are listed below:
323323
``-v``
324324
Turns on verbose output.
325325

326-
This will pass ``-v`` to *Clang*, and also enable ``EMCC_DEBUG`` to generate intermediate files for the compiler's various stages. It will also run Emscripten's internal sanity checks on the toolchain, etc.
326+
This will print the internal sub-commands run by emscripten as well as ``-v``
327+
to *Clang*.
327328

328329
.. tip:: ``emcc -v`` is a useful tool for diagnosing errors. It works with or without other arguments.
329330

0 commit comments

Comments
 (0)