Skip to content
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

Strip symbols of all binaries #109

Merged
merged 1 commit into from
Apr 3, 2020

Conversation

abrown
Copy link
Collaborator

@abrown abrown commented Mar 24, 2020

@sbc100, this resolves the discussion we had in #108 about stripping symbols from all binaries.

Makefile Outdated Show resolved Hide resolved
@abrown abrown changed the title Strip symbols of all binaries generated in /bin Strip symbols of all binaries Mar 25, 2020
@sunfishcode
Copy link
Member

Testing for "ELF" is too narrow since we also support on-ELF hosts such as macOS. Would it work to just unconditionally run strip on every file under bin and ignore errors?

Alternatively, if we could add "-s" to the link command-line, that would cause it to strip executables too.

@abrown
Copy link
Collaborator Author

abrown commented Mar 30, 2020

@sunfishcode, I didn't really know all the places -s might be needed so I tried the "strip everything and ignore errors" approach. Note that due to the discussion above with @sbc100 (resolved now) we are stripping everything, not just the bin directory.

@sbc100
Copy link
Member

sbc100 commented Mar 30, 2020

I think post-stripping is probably best.

The current approach of this patch is to strip anything that find things is executable. Seems reasonable to me that we just stick with that approach. Dan?

@sunfishcode
Copy link
Member

Sounds reasonable.

@sunfishcode sunfishcode merged commit f754491 into WebAssembly:master Apr 3, 2020
kildom pushed a commit to kildom/clang-wasi-port that referenced this pull request Jul 14, 2021
…s. (WebAssembly#109)

* Link `populate_environ` only if we actually need environment variables.

This avoids linking in the environment variable initialization code,
and the __wasi_environ_sizes_get and __wasi_environ_get imports, in
programs that don't use environment variables.

This also removes the "___environ" (three underscores) alias symbol,
which is only in musl for backwards compatibility.

* Switch to //-style comments.

* If malloc fails, don't leave `__environ` pointing to an uninitialized buffer.

* Fix a memory leak if one malloc succeeds and the other fails.

* Use calloc to handle multiplication overflow.

This also handles the NULL terminator.

* Don't initialize __environ until everything has succeeded.

* Avoid leaking in case __wasi_environ_get fails.

* Handle overflow in the add too.

* Add #include <stdlib.h> for malloc etc.

* If the environment is empty, don't allocate any memory.
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.

3 participants