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 addends in data section relocations #71

Open
bjorn3 opened this issue Mar 9, 2019 · 0 comments · May be fixed by #75
Open

Implement addends in data section relocations #71

bjorn3 opened this issue Mar 9, 2019 · 0 comments · May be fixed by #75

Comments

@bjorn3
Copy link
Contributor

bjorn3 commented Mar 9, 2019

https://github.com/CraneStation/cranelift/blob/master/cranelift-faerie/src/backend.rs#L236-L239

They are needed for at least one test in the rustc test suite. cc https://github.com/bjorn3/rustc_codegen_cranelift/issues/381.

Aaron1011 added a commit to Aaron1011/faerie that referenced this issue Apr 4, 2019
Fixes m4b#71

This commit creates a new variant 'Data' of the 'Reloc' enum.
This can be used to define a relocation to a data section entry
with a custom addend.

With this change, it's now possible to create a relocation representing
an index into an array or some other structure, where the addebd
represents the offset from the base.

I've only implemented this for ELF. Unfortunately, I'm completely
unfamiliar with Mach-O, and don't have an OS X instance available to
test with.

Additionally, I've moved the magic '-4' into a constant, and added some
documentation explaining where it comes from (though I may have a few
details wrong).

I've also tweaked the binary created by src/bin/main.rs to demonstrate
using Reloc::Data
@Aaron1011 Aaron1011 linked a pull request Apr 4, 2019 that will close this issue
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 a pull request may close this issue.

1 participant