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

elf: Add LoongArch relocation types introduced in LoongArch ABI v2.10 #578

Merged
merged 1 commit into from
Oct 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
21 changes: 20 additions & 1 deletion src/elf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6053,8 +6053,27 @@ pub const R_LARCH_TLS_GD_HI20: u32 = 98;
/// 32-bit PC relative
pub const R_LARCH_32_PCREL: u32 = 99;
/// Paired with a normal relocation at the same address to indicate the
/// insturction can be relaxed
/// instruction can be relaxed
pub const R_LARCH_RELAX: u32 = 100;
/// Delete an instruction, should be only used internally by the linker
pub const R_LARCH_DELETE: u32 = 101;
/// Delete some bytes to ensure the instruction at PC + A aligned to
/// `A.next_power_of_two()`-byte boundary
pub const R_LARCH_ALIGN: u32 = 102;
/// 22-bit PC-relative offset with two trailing zeros
pub const R_LARCH_PCREL20_S2: u32 = 103;
/// Reserved
pub const R_LARCH_CFA: u32 = 104;
/// 6-bit in-place addition
pub const R_LARCH_ADD6: u32 = 105;
/// 6-bit in-place subtraction
pub const R_LARCH_SUB6: u32 = 106;
/// LEB128 in-place addition
pub const R_LARCH_ADD_ULEB128: u32 = 107;
/// LEB128 in-place subtraction
pub const R_LARCH_SUB_ULEB128: u32 = 108;
/// 64-bit PC relative
pub const R_LARCH_64_PCREL: u32 = 109;

// Xtensa values Rel*::r_type`.
pub const R_XTENSA_NONE: u32 = 0;
Expand Down
1 change: 1 addition & 0 deletions src/read/elf/relocation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ fn parse_relocation<Elf: FileHeader>(
elf::R_LARCH_32 => (RelocationKind::Absolute, 32),
elf::R_LARCH_64 => (RelocationKind::Absolute, 64),
elf::R_LARCH_32_PCREL => (RelocationKind::Relative, 32),
elf::R_LARCH_64_PCREL => (RelocationKind::Relative, 64),
elf::R_LARCH_B16 => {
encoding = RelocationEncoding::LoongArchBranch;
(RelocationKind::Relative, 16)
Expand Down
Loading