Skip to content

Commit 6fbbf87

Browse files
authored
Update emcc --help docs (#9741)
Rebuilt them using "make text" in site/.
1 parent 3cd1f6e commit 6fbbf87

File tree

3 files changed

+62
-120
lines changed

3 files changed

+62
-120
lines changed

emcc.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -526,13 +526,15 @@ def run(args):
526526
# An online HTML version (which may be of a different version of Emscripten)
527527
# is up at http://kripken.github.io/emscripten-site/docs/tools_reference/emcc.html
528528

529-
print('''%s
529+
with open(shared.path_from_root('site', 'build', 'text', 'docs', 'tools_reference', 'emcc.txt'), 'r') as f:
530+
print(f.read())
530531

532+
print('''
531533
------------------------------------------------------------------
532534
533535
emcc: supported targets: llvm bitcode, javascript, NOT elf
534536
(autoconf likes to see elf above to enable shared object support)
535-
''' % (open(shared.path_from_root('site', 'build', 'text', 'docs', 'tools_reference', 'emcc.txt')).read()))
537+
''')
536538
return 0
537539

538540
if '--version' in args:

site/build/text/docs/tools_reference/emcc.txt

Lines changed: 58 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
Emscripten Compiler Frontend (emcc)
32
***********************************
43

@@ -40,28 +39,24 @@ Options that are modified or new in *emcc* are listed below:
4039
No optimizations (default). This is the recommended setting for
4140
starting to port a project, as it includes various assertions.
4241

43-
"-O1"
44-
Simple optimizations. These include using **asm.js**, LLVM "-O1"
45-
optimizations, relooping, removing runtime assertions and C++
46-
exception catching, and enabling "-s ALIASING_FUNCTION_POINTERS=1".
47-
This is the recommended setting when you want a reasonably
48-
optimized build that is generated as quickly as possible (it builds
49-
much faster than "-O2").
50-
51-
Note:
52-
53-
* For details on the effects of different optimization levels,
54-
see "apply_opt_level()" in tools/shared.py and also
55-
src/settings.js.
42+
This and other optimization settings are meaningful both during
43+
compile and during link. During compile it affects LLVM
44+
optimizations, and during link it affects final optimization of the
45+
code in Binaryen as well as optimization of the JS. (For fast
46+
incremental builds "-O0" is best, while for release you should link
47+
with something higher.)
5648

57-
* To re-enable C++ exception catching, use -s
58-
DISABLE_EXCEPTION_CATCHING=0.
49+
"-O1"
50+
Simple optimizations. During the compile step these include LLVM
51+
"-O1" optimizations. During the link step this removes various
52+
runtime assertions in JS and also runs the Binaryen optimizer (that
53+
makes link slower, so even if you compiled with a higher
54+
optimization level, you may want to link with "-O0" for fast
55+
incremental builds).
5956

6057
"-O2"
61-
Like "-O1", but with various JavaScript-level optimizations and
62-
LLVM "-O3" optimizations.
63-
64-
Note: This is a reasonable setting for a release build.
58+
Like "-O1", but enables more optimizations. During link this will
59+
also enable various JavaScript optimizations.
6560

6661
Note: These JavaScript optimizations can reduce code size by
6762
removing things that the compiler does not see being used, in
@@ -72,23 +67,18 @@ Options that are modified or new in *emcc* are listed below:
7267
"EXTRA_EXPORTED_RUNTIME_METHODS", see src/settings.js.
7368

7469
"-O3"
75-
Like "-O2", but with additional JavaScript optimizations that can
76-
take a significant amount of compilation time.
70+
Like "-O2", but with additional optimizations that may take longer
71+
to run.
7772

7873
Note: This is a good setting for a release build.
7974

8075
"-Os"
81-
Like "-O3", but with extra optimizations that reduce code size at
82-
the expense of performance. This can affect both bitcode generation
83-
and JavaScript.
76+
Like "-O3", but focuses more on code size (and may make tradeoffs
77+
with speed). This can affect both wasm and JavaScript.
8478

8579
"-Oz"
86-
Like "-Os", but reduces code size even further. This can affect
87-
both bitcode generation and JavaScript.
88-
89-
For JavaScript, this turns on some code size reduction
90-
optimizations that can take a significant amount of compilation
91-
time.
80+
Like "-Os", but reduces code size even further, and may take longer
81+
to run. This can affect both wasm and JavaScript.
9282

9383
Note: For more tips on optimizing your code, see Optimizing Code.
9484

@@ -126,67 +116,37 @@ Options that are modified or new in *emcc* are listed below:
126116
"-g"
127117
Preserve debug information.
128118

129-
* When compiling to bitcode, this is the same as in *Clang* and
130-
*gcc* (it adds debug information to the object files).
119+
* When compiling to object files, this is the same as in *Clang*
120+
and *gcc*, it adds debug information to the object files.
131121

132-
* When compiling from source to JavaScript or bitcode to
133-
JavaScript, it is equivalent to -g3 (discards LLVM debug info
134-
including C/C++ line numbers, but otherwise keeps as much debug
135-
information as possible). Use -g4 to get line number debugging
136-
information in JavaScript.
122+
* When linking, this is equivalent to -g3 (preserve JS whitespace
123+
and compiled function names).
137124

138125
"-g<level>"
139-
Controls how much debug information is kept when compiling from
140-
bitcode to JavaScript. Each level builds on the previous level:
126+
Controls the level of debuggability. Each level builds on the
127+
previous one:
141128

142-
* "-g0": Make no effort to keep code debuggable. Will discard
143-
LLVM debug information (this is done by default in -01 and
144-
higher).
129+
* "-g0": Make no effort to keep code debuggable.
145130

146-
* "-g1": Preserve whitespace (do not minify).
131+
* "-g1": When linking, preserve whitespace in JavaScript.
147132

148-
function a(a, b) {
149-
a = a | 0;
150-
b = b | 0;
151-
f(a + b | 0);
152-
}
133+
* "-g2": When linking, preserve function names in compiled
134+
code.
153135

154-
* "-g2": Preserve function names.
136+
* "-g3": When compiling to object files, keep debug info (this
137+
is the same as -g).
155138

156-
function _addAndPrint(a, b) {
157-
a = a | 0;
158-
b = b | 0;
159-
_printAnInteger(a + b | 0); // _printAnInteger is human readable.
160-
}
139+
* "-g4": When linking, generate a source map using LLVM debug
140+
information (which must be present in object files, i.e., they
141+
should have been compiled with "-g").
161142

162-
* "-g3": Preserve variable names (this is the same as -g).
143+
Note:
163144

164-
function _addAndPrint($left, $right) {
165-
$left = $left | 0;
166-
$right = $right | 0;
167-
_printAnInteger($left + $right | 0);
168-
}
145+
* Source maps allow you to view and debug the *C/C++
146+
source code* in your browser's debugger!
169147

170-
Note: Variable names in the output will not necessarily
171-
match the original variable names in source. They are,
172-
however, usually similar enough to infer the purpose of
173-
the variables.
174-
175-
* "-g4": Preserve LLVM debug information. This is the highest
176-
level of debuggability. If "-g" was used when compiling the
177-
C/C++ sources, this shows line number debug comments, and
178-
generates source maps.
179-
180-
Note:
181-
182-
* This debugging level may make compilation at
183-
optimization level -O1 and above significantly slower,
184-
because JavaScript optimization will be limited to one
185-
core (the default in "-O0").
186-
187-
* Source maps allow you to view and debug the *C/C++
188-
source code* in your browser's debugger! This works in
189-
Firefox, Chrome and Safari.
148+
* This debugging level may make compilation significantly
149+
slower (this is why we only do it on "-g4").
190150

191151
"--profiling"
192152
Use reasonable defaults when emitting JavaScript to make the build
@@ -225,9 +185,8 @@ Options that are modified or new in *emcc* are listed below:
225185
optimization level will set a good value.
226186

227187
Note: Some options might override this flag (e.g. "EMTERPRETIFY",
228-
"DEAD_FUNCTIONS", "SAFE_HEAP" and
229-
"SPLIT_MEMORY" override the value with "js-opts=1"), because they
230-
depend on the js-optimizer.
188+
"DEAD_FUNCTIONS", "SAFE_HEAP" and "SPLIT_MEMORY" override the
189+
value with "js-opts=1"), because they depend on the js-optimizer.
231190

232191
"--llvm-opts <level>"
233192
Enables LLVM optimizations, relevant when we call the LLVM
@@ -306,15 +265,6 @@ Options that are modified or new in *emcc* are listed below:
306265
* Closure is only run if JavaScript opts are being done ("-O2"
307266
or above, or "--js-opts 1").
308267

309-
"--closure-args <args>"
310-
Specifies extra arguments to pass to Closure compiler. Use quotes
311-
to escape multiple arguments to be passed, e.g.
312-
313-
--closure-args "--externs myExterns.js"
314-
315-
Multiple passed --closure-args directives will be concatenated
316-
left to right.
317-
318268
"--pre-js <file>"
319269
Specify a file whose contents are added before the emitted code and
320270
optimized together with it. Note that this might not literally be
@@ -508,21 +458,20 @@ Options that are modified or new in *emcc* are listed below:
508458
and applied; you cannot call any C functions until it arrives.
509459
This is the default setting when compiling with -O2 or higher.
510460

511-
Note: The safest way to ensure that it is safe to call C
512-
functions (the initialisation file has loaded) is to call
513-
a notifier function from "main()".
514-
515-
Note: If you assign a network request to
516-
"Module.memoryInitializerRequest" (before the script
517-
runs), then it will use that request instead of
518-
automatically starting a download for you. This is
519-
beneficial in that you can, in your HTML, fire off a
520-
request for the memory init file before the script
521-
actually arrives. For this to work, the network request
522-
should be an XMLHttpRequest with responseType set to
523-
"'arraybuffer'". (You can also put any other object here,
524-
all it must provide is a ".response" property containing
525-
an ArrayBuffer.)
461+
Note: The safest way to ensure that it is safe to call C
462+
functions (the initialisation file has loaded) is to call a
463+
notifier function from "main()".
464+
465+
Note: If you assign a network request to
466+
"Module.memoryInitializerRequest" (before the script runs),
467+
then it will use that request instead of automatically
468+
starting a download for you. This is beneficial in that you
469+
can, in your HTML, fire off a request for the memory init
470+
file before the script actually arrives. For this to work,
471+
the network request should be an XMLHttpRequest with
472+
responseType set to "'arraybuffer'". (You can also put any
473+
other object here, all it must provide is a ".response"
474+
property containing an ArrayBuffer.)
526475

527476
"-Wwarn-absolute-paths"
528477
Enables warnings about the use of absolute paths in "-I" and "-L"
@@ -599,7 +548,7 @@ Options that are modified or new in *emcc* are listed below:
599548
WebAssembly object.
600549

601550
* <name> **.wasm** : WebAssembly without JavaScript support
602-
code ("standalone wasm").
551+
code ("standalone wasm"; this enables "STANDALONE_WASM").
603552

604553
Note: If "--memory-init-file" is used, a **.mem** file will be
605554
created in addition to the generated **.js** and/or **.html**
@@ -639,8 +588,6 @@ Environment variables
639588

640589
* "EMMAKEN_JUST_CONFIGURE_RECURSE"
641590

642-
* "EMCONFIGURE_JS"
643-
644591
* "CONFIGURE_CC"
645592

646593
* "EMMAKEN_CXX"

site/source/docs/api_reference/val.h.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -148,13 +148,6 @@ Guide material for this class can be found in :ref:`embind-val-guide`.
148148
Destructor. **HamishW**-Replace with further description or delete comment.
149149

150150

151-
.. cpp:function:: val(const val& v)
152-
153-
**HamishW**-Replace with description.
154-
155-
:param const val& v: **HamishW**-Replace with description.
156-
157-
158151
.. cpp:function:: val& operator=(val&& v)
159152

160153
**HamishW**-Replace with description.

0 commit comments

Comments
 (0)