Skip to content

Use llvm-objcpy to strip the producers section when not running wasm-opt #12075

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

Merged
merged 3 commits into from
Aug 31, 2020

Conversation

kripken
Copy link
Member

@kripken kripken commented Aug 28, 2020

As part of WebAssembly/binaryen#3043 we stopped
stripping the producers section in unoptimized builds in #11996

However there is a way to still strip it with very little overhead, using llvm-objcpy.
This PR makes us strip it using wasm-opt normally if we are running wasm-opt
anyhow, but if we are not (as we hope to get to soon in some builds) then it uses
llvm-objcpy. This does a little more work after link but it's pretty trivial and does
not rewrite code or anything like that.

This does add some complexity, but it is complexity we'll need anyhow for
not running wasm-opt when it isn't needed.

Fixes #12071

Copy link
Collaborator

@sbc100 sbc100 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By the way it looks like wasm-ld --strip-all will avoid the emitting this in the first place.

@kripken
Copy link
Member Author

kripken commented Aug 31, 2020

Thanks @sbc100 , yes, looks like --strip-all does avoid emitting the producers section. Looks like we can't use it here though since it also strips out all debug info (I see those tests fails with that change), but we need to be able to not emit the producers section while still emitting debug info.

@kripken kripken merged commit 0565791 into master Aug 31, 2020
@kripken kripken deleted the noprod branch August 31, 2020 16:41
kripken added a commit that referenced this pull request Aug 31, 2020
…12077)

Relative to / followup to #12075. This does the same for debug info, it gets
us back to the same output as before (even stripping it in unoptimized
builds if -g is not present) by using llvm-objcopy when wasm-opt isn't
being run anyhow.

Together these PRs make our work on WebAssembly/binaryen#3043
have less noticeable effect that could surprise users.

Note that wasm-ld has --strip-debug which we could use, but it will
strip both the Names section and DWARF sections, and we may want
just the Names section, so we can't just use that.
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 this pull request may close these issues.

-s EMIT_PRODUCERS_SECTION=0 does not work
2 participants