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

Allow access to section contents while building #367

Merged
merged 1 commit into from
Aug 28, 2021

Conversation

alexcrichton
Copy link
Contributor

This commit adds Section::{data, data_mut} accessors to
write::Section to allow accessing data after it's been appended. The
motivation for this is that in Wasmtime we build an Object but we try
to patch relocations after the locations of all symbols are known,
handling them before load-time. Currently the logic of
appending-with-alignment is duplicated in Wasmtime but allowing access
to the underlying section data as-been-appended-so-far should enable us
to remove that duplication.

This commit adds `Section::{data, data_mut}` accessors to
`write::Section` to allow accessing data after it's been appended. The
motivation for this is that in Wasmtime we build an `Object` but we try
to patch relocations after the locations of all symbols are known,
handling them before load-time. Currently the logic of
appending-with-alignment is duplicated in Wasmtime but allowing access
to the underlying section data as-been-appended-so-far should enable us
to remove that duplication.
alexcrichton added a commit to alexcrichton/wasmtime that referenced this pull request Aug 27, 2021
Hopefully can remove all this with gimli-rs/object#367
@philipc philipc merged commit 6178499 into gimli-rs:master Aug 28, 2021
@philipc
Copy link
Contributor

philipc commented Aug 28, 2021

I'm considering changing the section data to be Cow, but I think that'll still be compatible with this (data_mut will convert to owned first).

@alexcrichton alexcrichton deleted the section-data branch August 28, 2021 03:49
mcbegamerxx954 pushed a commit to mcbegamerxx954/object that referenced this pull request Jun 15, 2024
This commit adds `Section::{data, data_mut}` accessors to
`write::Section` to allow accessing data after it's been appended. The
motivation for this is that in Wasmtime we build an `Object` but we try
to patch relocations after the locations of all symbols are known,
handling them before load-time. Currently the logic of
appending-with-alignment is duplicated in Wasmtime but allowing access
to the underlying section data as-been-appended-so-far should enable us
to remove that duplication.
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.

None yet

2 participants