@@ -49,8 +49,8 @@ Options that are modified or new in *emcc* are listed below:
4949
5050"-O1"
5151 [compile+link] Simple optimizations. During the compile step these
52- include LLVM "-O1" optimizations. During the link step this does
53- not include various runtime assertions in JS that *-O0* would do .
52+ include LLVM "-O1" optimizations. During the link step this omits
53+ various runtime assertions in JS that *-O0* would include .
5454
5555"-O2"
5656 [compile+link] Like "-O1", but enables more optimizations. During
@@ -68,15 +68,16 @@ Options that are modified or new in *emcc* are listed below:
6868
6969"-O3"
7070 [compile+link] Like "-O2", but with additional optimizations that
71- may take longer to run.
71+ may take longer to run and may increase code size .
7272
7373 Note:
7474
7575 This is a good setting for a release build.
7676
7777"-Og"
78- [compile+link] Like "-O1". In future versions, this option might
79- disable different optimizations in order to improve debuggability.
78+ [compile+link] Like "-O1", with an additional flag to extend the
79+ liveness of variables for improved debugging. In future versions,
80+ additional optimizations might also be disabled.
8081
8182"-Os"
8283 [compile+link] Like "-O3", but focuses more on code size (and may
@@ -182,9 +183,10 @@ Options that are modified or new in *emcc* are listed below:
182183 with "-c".
183184
184185"-gsource-map[=inline]"
185- [link] Generate a source map using LLVM debug information (which
186- must be present in object files, i.e., they should have been
187- compiled with "-g").
186+ [compile+link] [same as -g3 if passed at compile time, otherwise
187+ applies at link] Generate a source map using LLVM debug information
188+ (which must be present in object files, i.e., they should have been
189+ compiled with "-g" or "-gsource-map").
188190
189191 When this option is provided, the **.wasm** file is updated to have
190192 a "sourceMappingURL" section. The resulting URL will have format:
@@ -200,32 +202,34 @@ Options that are modified or new in *emcc* are listed below:
200202 a large source map file).
201203
202204"-g<level>"
203- [compile+link] Controls the level of debuggability. Each level
204- builds on the previous one:
205+ [compile+link] If used at compile time, adds progressively more
206+ DWARF information to the object file, according to the underlying
207+ behavior of clang. If used at link time, controls the level of
208+ debuggability overall. Each level builds on the previous one:
205209
206210 * "-g0": Make no effort to keep code debuggable.
207211
208- * "-g1": When linking, preserve whitespace in JavaScript.
212+ * "-g1": Preserve whitespace in JavaScript.
209213
210- * "-g2": When linking, preserve function names in compiled code.
214+ * "-g2": Also preserve function names in compiled code (via the
215+ wasm name section).
211216
212- * "-g3": When compiling to object files, keep debug info,
213- including JS whitespace, function names, and LLVM debug info
214- (DWARF) if any (this is the same as -g).
217+ * "-g3": Also keep LLVM debug info (DWARF) if there is any in
218+ the object files (this is the same as -g).
215219
216220"--profiling"
217- [same as -g2 if passed at compile time, otherwise applies at link]
218- Use reasonable defaults when emitting JavaScript to make the build
219- readable but still useful for profiling. This sets "-g2" (preserve
220- whitespace and function names) and may also enable optimizations
221- that affect performance and otherwise might not be performed in
222- "-g2".
221+ [link] Make the output suitable for profiling. This means including
222+ function names in the wasm and JS output, and preserving whitespace
223+ in the JS output. It does not affect optimizations (to ensure that
224+ performance profiles reflect production builds). Currenly this is
225+ the same as "-g2".
223226
224227"--profiling-funcs"
225- [link] Preserve function names in profiling, but otherwise minify
226- whitespace and names as we normally do in optimized builds. This is
227- useful if you want to look at profiler results based on function
228- names, but do *not* intend to read the emitted code.
228+ [link] Preserve wasm function names as in "--profiling", but
229+ otherwise minify whitespace and names as we normally do in
230+ optimized builds. This is useful if you want to look at profiler
231+ results based on function names, but do *not* intend to read the
232+ emitted code.
229233
230234"--tracing"
231235 [link] Enable the Emscripten Tracing API.
@@ -240,7 +244,9 @@ Options that are modified or new in *emcc* are listed below:
240244 [link] Save a map file between function indexes in the Wasm and
241245 function names. By storing the names on a file on the side, you can
242246 avoid shipping the names, and can still reconstruct meaningful
243- stack traces by translating the indexes back to the names.
247+ stack traces by translating the indexes back to the names. This is
248+ a simpler format than source maps, but less detailed because it
249+ only describes function names and not source locations.
244250
245251 Note:
246252
0 commit comments