@@ -49,8 +49,8 @@ Options that are modified or new in *emcc* are listed below:
49
49
50
50
"-O1"
51
51
[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 .
54
54
55
55
"-O2"
56
56
[compile+link] Like "-O1", but enables more optimizations. During
@@ -68,15 +68,16 @@ Options that are modified or new in *emcc* are listed below:
68
68
69
69
"-O3"
70
70
[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 .
72
72
73
73
Note:
74
74
75
75
This is a good setting for a release build.
76
76
77
77
"-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.
80
81
81
82
"-Os"
82
83
[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:
182
183
with "-c".
183
184
184
185
"-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").
188
190
189
191
When this option is provided, the **.wasm** file is updated to have
190
192
a "sourceMappingURL" section. The resulting URL will have format:
@@ -200,32 +202,34 @@ Options that are modified or new in *emcc* are listed below:
200
202
a large source map file).
201
203
202
204
"-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:
205
209
206
210
* "-g0": Make no effort to keep code debuggable.
207
211
208
- * "-g1": When linking, preserve whitespace in JavaScript.
212
+ * "-g1": Preserve whitespace in JavaScript.
209
213
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).
211
216
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).
215
219
216
220
"--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".
223
226
224
227
"--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.
229
233
230
234
"--tracing"
231
235
[link] Enable the Emscripten Tracing API.
@@ -240,7 +244,9 @@ Options that are modified or new in *emcc* are listed below:
240
244
[link] Save a map file between function indexes in the Wasm and
241
245
function names. By storing the names on a file on the side, you can
242
246
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.
244
250
245
251
Note:
246
252
0 commit comments