s390x: Enable object backend (#4680)

This enables the object backend for s390x, in particular the
processing of all required relocations.

This uncovered a bug: we need to use PLT relocations for the
target of calls, which we currently do not.  Fixed by adding
a new S390xPLTRel32Dbl reloc type and using it where needed.
This commit is contained in:
Ulrich Weigand
2022-08-10 22:07:54 +02:00
committed by GitHub
parent ecb91c0b06
commit be36dd6b1e
5 changed files with 37 additions and 2 deletions

View File

@@ -72,7 +72,7 @@ impl CompiledBlob {
write_unaligned(at as *mut i32, pcrel)
};
}
Reloc::S390xPCRel32Dbl => {
Reloc::S390xPCRel32Dbl | Reloc::S390xPLTRel32Dbl => {
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();