Skip to content

Commit

Permalink
Merge branch 'master' into fix_singlepass_codegen_regression
Browse files Browse the repository at this point in the history
  • Loading branch information
ptitSeb authored Feb 11, 2022
2 parents a9fab00 + 20c73a7 commit bc1dfd8
Showing 1 changed file with 29 additions and 17 deletions.
46 changes: 29 additions & 17 deletions lib/compiler-llvm/src/object_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,36 @@ where
.map_err(map_object_err)?
.relocations()
{
let kind = match (reloc.kind(), reloc.size()) {
(object::RelocationKind::Absolute, 64) => RelocationKind::Abs8,
(object::RelocationKind::Elf(object::elf::R_X86_64_PC64), 0) => {
RelocationKind::X86PCRel8
let kind = match (elf.architecture(), reloc.kind(), reloc.size()) {
(_, object::RelocationKind::Absolute, 64) => RelocationKind::Abs8,
(
object::Architecture::X86_64,
object::RelocationKind::Elf(object::elf::R_X86_64_PC64),
0,
) => RelocationKind::X86PCRel8,
(
object::Architecture::Aarch64,
object::RelocationKind::Elf(object::elf::R_AARCH64_MOVW_UABS_G0_NC),
0,
) => RelocationKind::Arm64Movw0,
(
object::Architecture::Aarch64,
object::RelocationKind::Elf(object::elf::R_AARCH64_MOVW_UABS_G1_NC),
0,
) => RelocationKind::Arm64Movw1,
(
object::Architecture::Aarch64,
object::RelocationKind::Elf(object::elf::R_AARCH64_MOVW_UABS_G2_NC),
0,
) => RelocationKind::Arm64Movw2,
(
object::Architecture::Aarch64,
object::RelocationKind::Elf(object::elf::R_AARCH64_MOVW_UABS_G3),
0,
) => RelocationKind::Arm64Movw3,
(object::Architecture::Aarch64, object::RelocationKind::PltRelative, 26) => {
RelocationKind::Arm64Call
}
(object::RelocationKind::Elf(object::elf::R_AARCH64_MOVW_UABS_G0_NC), 0) => {
RelocationKind::Arm64Movw0
}
(object::RelocationKind::Elf(object::elf::R_AARCH64_MOVW_UABS_G1_NC), 0) => {
RelocationKind::Arm64Movw1
}
(object::RelocationKind::Elf(object::elf::R_AARCH64_MOVW_UABS_G2_NC), 0) => {
RelocationKind::Arm64Movw2
}
(object::RelocationKind::Elf(object::elf::R_AARCH64_MOVW_UABS_G3), 0) => {
RelocationKind::Arm64Movw3
}
(object::RelocationKind::PltRelative, 26) => RelocationKind::Arm64Call,
_ => {
return Err(CompileError::Codegen(format!(
"unknown relocation {:?}",
Expand Down

0 comments on commit bc1dfd8

Please sign in to comment.