Object file support for s390x (#2872)

Add support for s390x binary format object files.  In particular,
add support for s390x ELF relocation types (currently only
S390xPCRel32Dbl).
This commit is contained in:
Ulrich Weigand
2021-05-03 18:50:00 +02:00
committed by GitHub
parent 7a3791f9e9
commit e1cc1a67d5
7 changed files with 34 additions and 0 deletions

View File

@@ -72,6 +72,15 @@ impl CompiledBlob {
write_unaligned(at as *mut i32, pcrel)
};
}
Reloc::S390xPCRel32Dbl => {
let base = get_address(name);
let what = unsafe { base.offset(isize::try_from(addend).unwrap()) };
let pcrel = i32::try_from(((what as isize) - (at as isize)) >> 1).unwrap();
#[cfg_attr(feature = "cargo-clippy", allow(clippy::cast_ptr_alignment))]
unsafe {
write_unaligned(at as *mut i32, pcrel)
};
}
_ => unimplemented!(),
}
}