-
Notifications
You must be signed in to change notification settings - Fork 77
Much better support for ELF files #755
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
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If you care about binary size you are probably going to strip all debuginfo and symbols anyway. Unlike wasm, for elf twiggy requires debuginfo so people can't strip the executable before running twiggy on it and as such using the file size as total is misleading.
This allows functioning without debuginfo. Some standard library crates are intentionally compiled without debuginfo and as such previously didn't show up in the report at all or without function name. Same for the main function. This also adds statics and anonymous allocations as a side effect by not filtering their symbols out.
This also nicely handles edges involving statics and anonymous allocations too.
Hi, it seems the CI is totally broken somehow :(. |
Yeah, locally tests pass. |
Thanks for this. I also added you to maintainers so you don't have to wait on me for other PRs |
Thanks! |
Fixed CI in #756. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This now uses symbols rather than debuginfo as source of truth of which functions exist. This allows analyzing binaries which don't have debuginfo and ensures symbols for which rustc doesn't generate debuginfo for whatever reason are still accounted for.
For ELF files we now take the runtime allocated size rather than the file size into account. When developing for microcontrollers the runtime allocated size is what matters, not the file size as only the runtime allocated segments actually get flashed onto the device. The rest of the ELF file is ignored.
This also adds support for getting the graph of references between symbols. This is done asking the user to compile with
--emit-relocs
and then reading the resulting relocations. Unlike the twiggy backend for WASM this supports both references originating from functions as well as references originating from data objects. So it will handle vtables and references in statics just fine.This contains three commits regenerating hello_elf to see step by step how the command outputs improve by these changes. The regenerations should probably be squashed together into a single commit before merging to save a couple of MB in repo size.