Skip to content

-gz argument seems to enable debugging information #24080

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jmcclellan-figma opened this issue Apr 9, 2025 · 1 comment · Fixed by #24081
Closed

-gz argument seems to enable debugging information #24080

jmcclellan-figma opened this issue Apr 9, 2025 · 1 comment · Fixed by #24081

Comments

@jmcclellan-figma
Copy link

Please include the following in your bug report:

Version of emscripten/emsdk:
emcc (Emscripten gcc/clang-like replacement + linker emulating GNU ld) 4.0.3 (a9651ff)
clang version 21.0.0git (https:/github.com/llvm/llvm-project 6dc41a639334b913e762f65410fcd14a722b137f)
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: ~/emsdk/upstream/bin

Failing command line in full:

emcc hello.cc -o hello.html -g0 -gz

Full link command and output with -v appended:

/wasm-ld -o hello.wasm /var/folders/fn/j37bx8dd6qx5_dcnlqgq110m0000gp/T/emscripten_temp_q01d0kcp/hello_0.o -L/Users/jmcclellan/emsdk/upstream/emscripten/cache/sysroot/lib/wasm32-emscripten -L/Users/jmcclellan/emsdk/upstream/emscripten/src/lib -lGL-getprocaddr -lal -lhtml5 -lstubs-debug -lnoexit -lc-debug -ldlmalloc-debug -lcompiler_rt -lc++-noexcept -lc++abi-debug-noexcept -lsockets -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr /var/folders/fn/j37bx8dd6qx5_dcnlqgq110m0000gp/T/tmp9r7nvx20libemscripten_js_symbols.so --export=emscripten_stack_get_end --export=emscripten_stack_get_free --export=emscripten_stack_get_base --export=emscripten_stack_get_current --export=emscripten_stack_init --export=_emscripten_stack_alloc --export=__wasm_call_ctors --export=_emscripten_stack_restore --export-if-defined=__start_em_asm --export-if-defined=__stop_em_asm --export-if-defined=__start_em_lib_deps --export-if-defined=__stop_em_lib_deps --export-if-defined=__start_em_js --export-if-defined=__stop_em_js --export-if-defined=main --export-if-defined=__main_argc_argv --export-if-defined=fflush --export-table -z stack-size=65536 --no-growable-memory --initial-heap=16777216 --no-entry --stack-first --table-base=1
#include <iostream>

int main() { std::cout << "Hello world\n"; }

Based on experience from clang, I would have expected -gz to enable debug compression but not necessarily enable any debugging information. Instead, it seems to enable extra debug sections.

emcc hello.cc -o hello.html -g0 -gz

creates a wasm file that is 2.2mb

while

emcc hello.cc -o hello.html -g0

creates one that is 189kb.

@sbc100
Copy link
Collaborator

sbc100 commented Apr 9, 2025

Emscripten doesn't support -gz but it looks like -g<anything> will enable debugging and superseed the previous -g flags. We should probably explicitly ignore -gz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants