Skip to content

Commit

Permalink
Fix: Hexagon relocations (#2612)
Browse files Browse the repository at this point in the history
* Add more relocation types.
* Replace flawed patching algorithm with the `llvm-llds` algorithm.
* Add macros for bitmasks.
* Remove code duplicates.
* Add relocation tests.
  • Loading branch information
Rot127 authored May 13, 2022
1 parent e767046 commit fb66527
Show file tree
Hide file tree
Showing 3 changed files with 310 additions and 115 deletions.
15 changes: 15 additions & 0 deletions librz/bin/format/elf/glibc_elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -4225,6 +4225,21 @@ enum {
#define R_HEX_LD_PLT_B32_PCREL_X 98 /* Word32_X26 (S + A - P) >> 6 Signed Truncate */
#define R_HEX_27_REG 99 /* Word32_M25 (S + A - MB) >> 2 Unsigned Verify */

#define R_HEX_BITMASK_WORD8 0xff
#define R_HEX_BITMASK_WORD16 0xffff
#define R_HEX_BITMASK_WORD32 0xffffffff
#define R_HEX_BITMASK_WORD32_LO 0x00c03fff
#define R_HEX_BITMASK_WORD32_HL 0x00c03fff
#define R_HEX_BITMASK_WORD32_B7 0x00001f18
#define R_HEX_BITMASK_WORD32_B9 0x003000fe
#define R_HEX_BITMASK_WORD32_B13 0x00202ffe
#define R_HEX_BITMASK_WORD32_B15 0x00df20fe
#define R_HEX_BITMASK_WORD32_B22 0x01ff3ffe
#define R_HEX_BITMASK_WORD32_M21 0x0fff3fe0
#define R_HEX_BITMASK_WORD32_M25 0x0fff3fef
#define R_HEX_BITMASK_WORD32_R6 0x000007e0
#define R_HEX_BITMASK_WORD32_X26 0x0fff3fff

/* Dynamic array tags */

#define DT_HEXAGON_SYMSZ 0x70000000
Expand Down
Loading

0 comments on commit fb66527

Please sign in to comment.