port(wasm): Resolve __data_end and __heap_base as linker data addresses#2188
Open
lapla-cogito wants to merge 1 commit into
Open
port(wasm): Resolve __data_end and __heap_base as linker data addresses#2188lapla-cogito wants to merge 1 commit into
__data_end and __heap_base as linker data addresses#2188lapla-cogito wants to merge 1 commit into
Conversation
__data_end and __heap_base as linker data addresses__data_end and __heap_base as linker data addresses
| data_end: u32, | ||
| ) -> Result<Option<LinkerDefinedDataAddress>> { | ||
| match name { | ||
| b"__data_end" => Ok(Some(LinkerDefinedDataAddress { |
Member
There was a problem hiding this comment.
Similar to previous PRs, the matching on symbol names makes me wary. It feels potentially wasteful and like it ideally shouldn't be necessary. Fine for now, but longer-term it'd be good to consider alternatives.
| @@ -0,0 +1,4 @@ | |||
| extern char __data_end; | |||
Member
There was a problem hiding this comment.
Does this actually cause a symbol reference to be emitted? At least from my previous observations when compiling for x86_64, it doesn't - you'd need to actually have code that references the symbol for that.
| .ok_or_else(|| crate::error!("Wasm __heap_base address overflow"))?; | ||
| Ok(Some(LinkerDefinedDataAddress { | ||
| address, | ||
| needs_stack_gap: true, |
Member
There was a problem hiding this comment.
What is it about __heap_base that means it needs stack gap? Could be good to document that here.
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
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.
Clang references these as undefined data symbols with
MEMORY_ADDRrelocations, not as globals. Assign absolute addresses after static data layout (data_end, and data_end plus the reserved stack gap for heap_base) and grow memory when the stack gap is required.Part of #1431