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

Implement some ELF/Mach-O relocations #77

Merged
merged 3 commits into from
Oct 24, 2018
Merged

Conversation

philipc
Copy link
Contributor

@philipc philipc commented Oct 22, 2018

This returns the relocations only. It is up to the caller to apply them.

These are the minimum ELF relocations that I need to dwarfdump an object file. The Mach-O relocations weren't needed for that (because it has implicit addends), but it helps generalize the API.

I didn't look into PE relocations (it'll only be dynamic linking relocations?), and we don't support COFF yet.

WASM is probably going to be rather different, but I didn't look into it much. It'll be okay to add WASM specific entries to RelocationKind.

Note: there's an initial commit with rustfmt changes.

Fixes #4

@philipc philipc requested a review from fitzgen October 22, 2018 07:19
Copy link
Member

@fitzgen fitzgen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not particularly familiar with ELF or Mach-O relocs but this LGTM!

src/traits.rs Outdated
@@ -111,6 +111,12 @@ pub trait ObjectSegment<'data> {

/// A section defined in an object file.
pub trait ObjectSection<'data> {
/// An iterator over the reloctions for a section.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"reloctions" -> "relocations"

This will be useful for when we want both uncompressed data and relocations
for a named section.
@philipc philipc merged commit beb7abe into gimli-rs:master Oct 24, 2018
@philipc philipc deleted the reloc branch October 24, 2018 05:29
@philipc philipc mentioned this pull request Apr 9, 2019
mcbegamerxx954 pushed a commit to mcbegamerxx954/object that referenced this pull request Jun 15, 2024
Implement some ELF/Mach-O relocations
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.

2 participants