Skip to content

Commit

Permalink
write/elf: support some LoongArch ELF relative relocations
Browse files Browse the repository at this point in the history
  • Loading branch information
xry111 committed Jul 29, 2022
1 parent e70b470 commit a2b3751
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/write/elf/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,13 @@ impl<'a> Object<'a> {
{
(RelocationKind::Absolute, _, 32) => elf::R_LARCH_32,
(RelocationKind::Absolute, _, 64) => elf::R_LARCH_64,
(RelocationKind::Relative, _, 32) => elf::R_LARCH_32_PCREL,
(RelocationKind::Relative, RelocationEncoding::LoongArchBranch, 16)
| (RelocationKind::PltRelative, RelocationEncoding::LoongArchBranch, 16) => elf::R_LARCH_B16,
(RelocationKind::Relative, RelocationEncoding::LoongArchBranch, 21)
| (RelocationKind::PltRelative, RelocationEncoding::LoongArchBranch, 21) => elf::R_LARCH_B21,
(RelocationKind::Relative, RelocationEncoding::LoongArchBranch, 26)
| (RelocationKind::PltRelative, RelocationEncoding::LoongArchBranch, 26) => elf::R_LARCH_B26,
(RelocationKind::Elf(x), _, _) => x,
_ => {
return Err(Error(format!("unimplemented relocation {:?}", reloc)));
Expand Down

0 comments on commit a2b3751

Please sign in to comment.