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

Use u64/i64 instead of usize/isize for r_offset and r_addend #86

Merged
merged 2 commits into from
Apr 16, 2018
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/elf/reloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ macro_rules! elf_rela_std_impl { ($size:ident, $isize:ty) => {
impl From<Rela> for Reloc {
fn from(rela: Rela) -> Self {
Reloc {
r_offset: rela.r_offset as usize,
r_addend: rela.r_addend as isize,
r_offset: rela.r_offset as u64,
r_addend: rela.r_addend as i64,
r_sym: r_sym(rela.r_info) as usize,
r_type: r_type(rela.r_info),
is_rela: true,
Expand All @@ -132,7 +132,7 @@ macro_rules! elf_rela_std_impl { ($size:ident, $isize:ty) => {
impl From<Rel> for Reloc {
fn from(rel: Rel) -> Self {
Reloc {
r_offset: rel.r_offset as usize,
r_offset: rel.r_offset as u64,
r_addend: 0,
Copy link
Owner

Choose a reason for hiding this comment

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

We may also want this to be an Option, but I didn't do it cause i was being lazy ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since this is a breaking change anyways, I turned it into an Option as part of this PR.

r_sym: r_sym(rel.r_info) as usize,
r_type: r_type(rel.r_info),
Expand Down Expand Up @@ -266,9 +266,9 @@ if_alloc! {
/// A unified ELF relocation structure
pub struct Reloc {
/// Address
pub r_offset: usize,
pub r_offset: u64,
/// Addend
pub r_addend: isize,
pub r_addend: i64,
/// The index into the corresponding symbol table - either dynamic or regular
pub r_sym: usize,
/// The relocation type
Expand Down