-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Panic related strings are still in binary with custom panic_fmt #47526
Comments
Somewhat related #47409 Using I think at some point in the past the issue seemed to be due to the fact that -B |
Compiling with this
doesn't seem to resolve the issue: the strings are still there. |
@pietroalbini To clarify, this isn't about wasm only. compiling with
will still produce these strings in binary:
|
When using Cargo, this is also leaking full filesystem paths into binaries for assertions in dependencies. ( It'd be nice if those strings could be cleaned up to something like I've been trying to work around this issue in my current project. I don't know how to make Cargo do the equivalent of
But that appears to not help, perhaps because I also tried doing the following, but the spaces apparently break a generated command somewhere:
Is there some way to make this work? I also tried building a custom libcore, hacking the |
I also was unable to pass these options via rustc command lines. It only worked if I invoke the |
It seems that custom
panic_fmt
that doesn't touchesArguments
doesnt not help to strip all panic-related strings from final binary while compiling to wasm (either emscripten or wasm32-unknown-unknown)Invocation:
rustc --target=wasm32-unknown-emscripten --emit llvm-ir -C lto -C opt-level=3 src/main.rs
this produces the following LLVM IR.
The problem is that
panic_fmt
is not using it's_args
, so it is a dead arg. However, despite this, strings for panic messages are still end up in the LLVM IR}.It seems that running
opt -deadargelim -globaldce
helps to strip this strings.The text was updated successfully, but these errors were encountered: