-
Notifications
You must be signed in to change notification settings - Fork 25
Implement custom symbols referencing a section for machO #83
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
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems weird to pass in a btree map; at least from the docstring wasn’t clear to me as a user how to construct this particular input; also, what are the invariants I should enforce, etc.
Note I didn’t read the implementation deeply, just try signature stuck out at me.
Could you give some motivation for why we should expose this in this manner ? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the easiest way :) Should I introduce a
SymbolMapas wrapper?Invariants
u64is smaller than the length ofdata(no out of bound symbols)String) is used more than once.symbolsis empty for non section definitions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I thought the api would be like
define_in_section(name: String, data: Vec<u8>, section: String)Why does one define a symbol, it’s data, and then provide a set of strings (section name ?) -> u64s (offsets?)
A symbol is only ever in one section, so I’m confused why the api has a collection like thing as an argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it the other way around: A section decl has symbols referencing to certain offsets.
symbolsis a map from symbol to offset within section.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok I haven’t heard from anyone so I’m ok to merge this, but I still have a few questions.
So the symbols argument to define_with_symbols; the docs state it’s a map of custom symbols referencing a section; but where does the section come from? Is it the symbol we’re defining?
The references seem like they’re “floating” to me, relying on previous or post function calls to resolve them, is that correct ?
If yes, that worries me, because it’s essentially introduced a stateful aspect to the api; is there any way we can make the connection stronger (short of moving symbol references to interned ids (which I somewhat regret not having in the first place))
I guess the api just doesn’t seem totally clear to me; a doc example would help a lot I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
The symbols referencing the section are newly introduced when calling this method.
Will add.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok got it now; yea doc example would be really great, and maybe slightly more explanation in documentation, but example I think will be best solution to my confusion/questions.
Then I think we can merge. Ping me again aggressively if I forget :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added doc example.