Skip to content

Ghidra is a software reverse engineering (SRE) framework

Add issing ELF reloc

mumbel9a22180efa73
diff --git a/Ghidra/Processors/AARCH64/src/main/java/ghidra/app/util/bin/format/elf/relocation/AARCH64_ElfRelocationType.java b/Ghidra/Processors/AARCH64/src/main/java/ghidra/app/util/bin/format/elf/relocation/AARCH64_ElfRelocationType.java
index 73e70d8b96..8b990df668 100644
--- a/Ghidra/Processors/AARCH64/src/main/java/ghidra/app/util/bin/format/elf/relocation/AARCH64_ElfRelocationType.java
+++ b/Ghidra/Processors/AARCH64/src/main/java/ghidra/app/util/bin/format/elf/relocation/AARCH64_ElfRelocationType.java
@@ -66,6 +66,14 @@ public enum AARCH64_ElfRelocationType implements ElfRelocationType {
R_AARCH64_P32_TLSLE_ADD_TPREL_HI12(109),
R_AARCH64_P32_TLSLE_ADD_TPREL_LO12(110),
R_AARCH64_P32_TLSLE_ADD_TPREL_LO12_NC(111),
+ R_AARCH64_P32_TLSLE_LDST8_TPREL_LO12(112),
+ R_AARCH64_P32_TLSLE_LDST8_TPREL_LO12_NC(113),
+ R_AARCH64_P32_TLSLE_LDST16_TPREL_LO12(114),
+ R_AARCH64_P32_TLSLE_LDST16_TPREL_LO12_NC(115),
+ R_AARCH64_P32_TLSLE_LDST32_TPREL_LO12(116),
+ R_AARCH64_P32_TLSLE_LDST32_TPREL_LO12_NC(117),
+ R_AARCH64_P32_TLSLE_LDST64_TPREL_LO12(118),
+ R_AARCH64_P32_TLSLE_LDST64_TPREL_LO12_NC(119),
R_AARCH64_P32_TLSDESC_LD_PREL19(122),
R_AARCH64_P32_TLSDESC_ADR_PREL21(123),
diff --git a/Ghidra/Processors/ARM/src/main/java/ghidra/app/util/bin/format/elf/relocation/ARM_ElfRelocationType.java b/Ghidra/Processors/ARM/src/main/java/ghidra/app/util/bin/format/elf/relocation/ARM_ElfRelocationType.java
index 91a672aa96..448eaed91e 100644
--- a/Ghidra/Processors/ARM/src/main/java/ghidra/app/util/bin/format/elf/relocation/ARM_ElfRelocationType.java
+++ b/Ghidra/Processors/ARM/src/main/java/ghidra/app/util/bin/format/elf/relocation/ARM_ElfRelocationType.java
@@ -147,7 +147,29 @@ public enum ARM_ElfRelocationType implements ElfRelocationType {
R_ARM_PRIVATE_15(127),
R_ARM_ME_TOO(128),
R_ARM_THM_TLS_DESCSEQ16(129),
- R_ARM_THM_TLS_DESCSEQ32(130);
+ R_ARM_THM_TLS_DESCSEQ32(130),
+ R_ARM_THM_ALU_ABS_G0_NC(132),
+ R_ARM_THM_ALU_ABS_G1_NC(133),
+ R_ARM_THM_ALU_ABS_G2_NC(134),
+ R_ARM_THM_ALU_ABS_G3_NC(135),
+ R_ARM_THM_BF16(136),
+ R_ARM_THM_BF12(137),
+ R_ARM_THM_BF18(138),
+ R_ARM_IRELATIVE(160),
+ R_ARM_GOTFUNCDEC(161),
+ R_ARM_GOTOFFFUNCDESC(162),
+ R_ARM_FUNCESC(163),
+ R_ARM_FUNCDESC_VALUE(164),
+ R_ARM_TLS_GD32_FDPIC(165),
+ R_ARM_TLS_LDM32_FDPIC(166),
+ R_ARM_TLS_IE32_FDPIC(167),
+ R_ARM_RXPC25(249),
+ R_ARM_RSBREL32(250),
+ R_ARM_THM_RPC22(251),
+ R_ARM_RREL32(252),
+ R_ARM_RABS32(253),
+ R_ARM_RPC24(254),
+ R_ARM_RBASE(255);
public final int typeId;
diff --git a/Ghidra/Processors/Atmel/src/main/java/ghidra/app/util/bin/format/elf/relocation/AVR8_ElfRelocationType.java b/Ghidra/Processors/Atmel/src/main/java/ghidra/app/util/bin/format/elf/relocation/AVR8_ElfRelocationType.java
index f682cb1625..b9f8f129c9 100644
--- a/Ghidra/Processors/Atmel/src/main/java/ghidra/app/util/bin/format/elf/relocation/AVR8_ElfRelocationType.java
+++ b/Ghidra/Processors/Atmel/src/main/java/ghidra/app/util/bin/format/elf/relocation/AVR8_ElfRelocationType.java
@@ -52,7 +52,8 @@ public enum AVR8_ElfRelocationType implements ElfRelocationType {
R_AVR_DIFF32(32),
R_AVR_LDS_STS_16(33),
R_AVR_PORT6(34),
- R_AVR_PORT5(35);
+ R_AVR_PORT5(35),
+ R_AVR_32_PCREL(36);
public final int typeId;
diff --git a/Ghidra/Processors/Loongarch/src/main/java/ghidra/app/util/bin/format/elf/relocation/Loongarch_ElfRelocationType.java b/Ghidra/Processors/Loongarch/src/main/java/ghidra/app/util/bin/format/elf/relocation/Loongarch_ElfRelocationType.java
index 78c7371602..596cf4c6dd 100644
--- a/Ghidra/Processors/Loongarch/src/main/java/ghidra/app/util/bin/format/elf/relocation/Loongarch_ElfRelocationType.java
+++ b/Ghidra/Processors/Loongarch/src/main/java/ghidra/app/util/bin/format/elf/relocation/Loongarch_ElfRelocationType.java
@@ -40,8 +40,8 @@ public enum Loongarch_ElfRelocationType implements ElfRelocationType {
R_LARCH_IRELATIVE(12), /* Runtime local indirect function resolving
* *(void **) PC((((void *)(*)()) (B + A)) ()
*/
-
- /* Relocations 13..19 reserved for dynamic linker */
+ R_LARCH_TLS_DESC32(13),
+ R_LARCH_TLS_DESC64(14),
R_LARCH_MARK_LA(20), // Mark la.abs Load absolute address for static link.
R_LARCH_MARK_PCREL(21), // Mark external label branch Access PC relative address for static link.
@@ -148,7 +148,24 @@ public enum Loongarch_ElfRelocationType implements ElfRelocationType {
R_LARCH_SUB6(106), // pcaddi
R_LARCH_ADD_ULEB128(107), // relax delete
R_LARCH_SUB_ULEB128(108), // relax delete
- R_LARCH_64_PCREL(109); // pcaddi
+ R_LARCH_64_PCREL(109), // pcaddi
+ R_LARCH_CALL32(110),
+ R_LARCH_TLS_DESC_PC_HI20(111),
+ R_LARCH_TLS_DESC_PC_LO12(112),
+ R_LARCH_TLS_DESC64_PC_LO20(113),
+ R_LARCH_TLS_DESC64_PC_HI12(114),
+ R_LARCH_TLS_DESC_HI20(115),
+ R_LARCH_TLS_DESC_LO12(116),
+ R_LARCH_TLS_DESC64_LO20(117),
+ R_LARCH_TLS_DESC64_HI12(118),
+ R_LARCH_TLS_DESC_LD(119),
+ R_LARCH_TLS_DESC_CALL(120),
+ R_LARCH_TLS_TLS_LE_HI20_R(121),
+ R_LARCH_TLS_TLS_LE_ADD_R(122),
+ R_LARCH_TLS_TLS_LE_LO12_R(123),
+ R_LARCH_TLS_TLS_LD_PCREL20_S2(124),
+ R_LARCH_TLS_TLS_GD_PCREL20_S2(125),
+ R_LARCH_TLS_TLS_DESC_PCREL20_S2(126);
public final int typeId;
diff --git a/Ghidra/Processors/MIPS/src/main/java/ghidra/app/util/bin/format/elf/relocation/MIPS_ElfRelocationType.java b/Ghidra/Processors/MIPS/src/main/java/ghidra/app/util/bin/format/elf/relocation/MIPS_ElfRelocationType.java
index 3ab727b0a5..1c480f632a 100644
--- a/Ghidra/Processors/MIPS/src/main/java/ghidra/app/util/bin/format/elf/relocation/MIPS_ElfRelocationType.java
+++ b/Ghidra/Processors/MIPS/src/main/java/ghidra/app/util/bin/format/elf/relocation/MIPS_ElfRelocationType.java
@@ -96,6 +96,7 @@ public enum MIPS_ElfRelocationType implements ElfRelocationType {
R_MIPS16_TLS_GOTTPREL(110),
R_MIPS16_TLS_TPREL_HI16(111),
R_MIPS16_TLS_TPREL_LO16(112),
+ R_MIPS16_PC16_S1(113),
R_MIPS16_LO(100), // First MIPS16 reloc type
R_MIPS16_HI(112), // Last MIPS16 reloc type
@@ -147,7 +148,11 @@ public enum MIPS_ElfRelocationType implements ElfRelocationType {
R_MICROMIPS_LO(133), // First MicroMIPS reloc type
R_MICROMIPS_HI(173), // Last MicroMIPS reloc type
- R_MIPS_PC32(248);
+ R_MIPS_PC32(248),
+ R_MIPS_EH(249),
+ R_MIPS_GNU_REL16_S2(250),
+ R_MIPS_GNU_VTINHERIT(253),
+ R_MIPS_GNU_VTENTRY(254);
public final int typeId;
diff --git a/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC64_ElfRelocationType.java b/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC64_ElfRelocationType.java
index f6c09a2709..f2ee105dd2 100644
--- a/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC64_ElfRelocationType.java
+++ b/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC64_ElfRelocationType.java
@@ -121,10 +121,25 @@ public enum PowerPC64_ElfRelocationType implements ElfRelocationType {
R_PPC64_DTPREL16_HIGHERA(104), // half16 #highera(@dtprel)
R_PPC64_DTPREL16_HIGHEST(105), // half16 #highest(@dtprel)
R_PPC64_DTPREL16_HIGHESTA(106), // half16 #highesta(@dtprel)
+ R_PPC64_TLSGD(107),
+ R_PPC64_TLSLD(108),
+ R_PPC64_TOCSAVE(109),
+ R_PPC64_ADDR16_HIGH(110),
+ R_PPC64_ADDR16_HIGHA(111),
+ R_PPC64_TPREL16_HIGH(112),
+ R_PPC64_TPREL16_HIGHA(113),
+ R_PPC64_DTPREL16_HIGH(114),
+ R_PPC64_DTPREL16_HIGHA(115),
+ R_PPC64_REL24_NOTOC(116),
+ R_PPC64_ADDR64_LOCAL(117),
+ R_PPC64_ENTRY(118),
+ R_PPC64_PLTSEQ(119),
+ R_PPC64_PLTCALL(120),
R_PPC64_PLTSEQ_NOTOC(121),
R_PPC64_PLTCALL_NOTOC(122),
R_PPC64_PCREL_OPT(123),
+ R_PPC64_REL24_P9NOTOC(124),
R_PPC64_D34(128),
R_PPC64_D34_LO(129),
@@ -158,7 +173,18 @@ public enum PowerPC64_ElfRelocationType implements ElfRelocationType {
R_PPC64_REL16_HIGHEST(244),
R_PPC64_REL16_HIGHESTA(245),
- R_PPC64_JMP_IREL(247);
+ R_PPC64_REL16DX_HA(246),
+
+ R_PPC64_JMP_IREL(247),
+ R_PPC64_IRELATIVE(248),
+
+ R_PPC64_REL16(249),
+ R_PPC64_REL16_LO(250),
+ R_PPC64_REL16_HI(251),
+ R_PPC64_REL16_HA(252),
+
+ R_PPC64_VTINHERIT(253),
+ R_PPC64_VTENTRY(254);
public final int typeId;
diff --git a/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC_ElfRelocationType.java b/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC_ElfRelocationType.java
index d69b695596..4fc76ebb5f 100644
--- a/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC_ElfRelocationType.java
+++ b/Ghidra/Processors/PowerPC/src/main/java/ghidra/app/util/bin/format/elf/relocation/PowerPC_ElfRelocationType.java
@@ -56,6 +56,11 @@ public enum PowerPC_ElfRelocationType implements ElfRelocationType {
R_PPC_SECTOFF_HA(36), // half16 #ha(R + A)
R_PPC_ADDR30(37), // word30 (S + A - P) >> 2
+ R_PPC_RELAX(48),
+ R_PPC_RELAX_PLT(49),
+ R_PPC_RELAX_PLTREL24(50),
+ R_PPC_16DX_HA(51),
+
R_POWERPC_TLS(67),
R_POWERPC_DTPMOD(68),
R_POWERPC_TPREL16(69),
diff --git a/Ghidra/Processors/RISCV/src/main/java/ghidra/app/util/bin/format/elf/relocation/RISCV_ElfRelocationType.java b/Ghidra/Processors/RISCV/src/main/java/ghidra/app/util/bin/format/elf/relocation/RISCV_ElfRelocationType.java
index 88d693ad7c..0d795d1fde 100644
--- a/Ghidra/Processors/RISCV/src/main/java/ghidra/app/util/bin/format/elf/relocation/RISCV_ElfRelocationType.java
+++ b/Ghidra/Processors/RISCV/src/main/java/ghidra/app/util/bin/format/elf/relocation/RISCV_ElfRelocationType.java
@@ -36,6 +36,7 @@ public enum RISCV_ElfRelocationType implements ElfRelocationType {
R_RISCV_TLS_DTPREL64(9), // TLS relocation word64(TLS + S + A - TLS_TP_OFFSET
R_RISCV_TLS_TPREL32(10), // TLS relocation word32(TLS + S + A + S_TLS_OFFSET - TLS_DTV_OFFSET
R_RISCV_TLS_TPREL64(11), // TLS relocation word64(TLS + S + A + S_TLS_OFFSET - TLS_DTV_OFFSET
+ R_RISCV_TLSDESC(12),
R_RISCV_BRANCH(16), // PC-relative branch (SB-Type)
R_RISCV_JAL(17), // PC-relative jump (UJ-Type)
R_RISCV_CALL(18), // PC-relative call MACRO call,tail (auipc+jalr pair)
@@ -77,9 +78,14 @@ public enum RISCV_ElfRelocationType implements ElfRelocationType {
R_RISCV_SET8(54), // Local label subtraction
R_RISCV_SET16(55), // Local label subtraction
R_RISCV_SET32(56), // Local label subtraction
- R_RISCV_32_PCREL(57); // 32-bit PC relative
- // 58-191 Reserved Reserved for future standard use
- // 192-255 Reserved Reserved for nonstandard ABI extensions
+ R_RISCV_32_PCREL(57), // 32-bit PC relative
+ R_RISCV_IRELATIVE(58),
+ R_RISCV_SET_ULEB128(60),
+ R_RISCV_SUB_ULEB128(61),
+ R_RISCV_TLSDESC_HI20(62),
+ R_RISCV_TLSDESC_LOAD_LO12(63),
+ R_RISCV_TLSDESC_ADD_LO12(64),
+ R_RISCV_TLSDESC_CALL(65);
public final int typeId;
diff --git a/Ghidra/Processors/Sparc/src/main/java/ghidra/app/util/bin/format/elf/relocation/SPARC_ElfRelocationType.java b/Ghidra/Processors/Sparc/src/main/java/ghidra/app/util/bin/format/elf/relocation/SPARC_ElfRelocationType.java
index 9807ae1599..0c6b2bd316 100644
--- a/Ghidra/Processors/Sparc/src/main/java/ghidra/app/util/bin/format/elf/relocation/SPARC_ElfRelocationType.java
+++ b/Ghidra/Processors/Sparc/src/main/java/ghidra/app/util/bin/format/elf/relocation/SPARC_ElfRelocationType.java
@@ -117,9 +117,7 @@ public enum SPARC_ElfRelocationType implements ElfRelocationType {
R_SPARC_IRELATIVE(249), //
R_SPARC_GNU_VTIHERIT(250), //
R_SPARC_GNU_VTENTRY(251), //
- R_SPARC_REV32(252), //
-
- R_SPARC_max(253); // update as needed
+ R_SPARC_REV32(252); //
public final int typeId;
diff --git a/Ghidra/Processors/SuperH4/src/main/java/ghidra/app/util/bin/format/elf/relocation/SH_ElfRelocationType.java b/Ghidra/Processors/SuperH4/src/main/java/ghidra/app/util/bin/format/elf/relocation/SH_ElfRelocationType.java
index b1d51340f6..21eeca7d1c 100644
--- a/Ghidra/Processors/SuperH4/src/main/java/ghidra/app/util/bin/format/elf/relocation/SH_ElfRelocationType.java
+++ b/Ghidra/Processors/SuperH4/src/main/java/ghidra/app/util/bin/format/elf/relocation/SH_ElfRelocationType.java
@@ -117,6 +117,15 @@ public enum SH_ElfRelocationType implements ElfRelocationType {
R_SH_JMP_SLOT64(195),
R_SH_RELATIVE64(196),
+ R_SH_GOT20(201),
+ R_SH_GOTOFF20(202),
+ R_SH_GOTFUNCDESC(203),
+ R_SH_GOTFUNCDESC20(204),
+ R_SH_GOTOFFFUNCDESC(205),
+ R_SH_GOTOFFFUNCDESC20(206),
+ R_SH_FUNCDESC(207),
+ R_SH_FUNCDESC_VALUE(208),
+
R_SH_SHMEDIA_CODE(242),
R_SH_PT_16(243),
R_SH_IMMS16(244),
diff --git a/Ghidra/Processors/eBPF/src/main/java/ghidra/app/util/bin/format/elf/relocation/eBPF_ElfRelocationType.java b/Ghidra/Processors/eBPF/src/main/java/ghidra/app/util/bin/format/elf/relocation/eBPF_ElfRelocationType.java
index 9de64e6b53..90368091d6 100644
--- a/Ghidra/Processors/eBPF/src/main/java/ghidra/app/util/bin/format/elf/relocation/eBPF_ElfRelocationType.java
+++ b/Ghidra/Processors/eBPF/src/main/java/ghidra/app/util/bin/format/elf/relocation/eBPF_ElfRelocationType.java
@@ -22,7 +22,8 @@ public enum eBPF_ElfRelocationType implements ElfRelocationType {
R_BPF_64_ABS64(2), // S + A
R_BPF_64_ABS32(3), // S + A
R_BPF_64_NODYLD32(4), // S + A
- R_BPF_64_32(10); // (S + A) / 8 - 1
+ R_BPF_64_32(10), // (S + A) / 8 - 1
+ R_BPF_GNU_64_16(256);
public final int typeId;
diff --git a/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_32_ElfRelocationType.java b/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_32_ElfRelocationType.java
index f8066692ea..579f56f4d3 100644
--- a/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_32_ElfRelocationType.java
+++ b/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_32_ElfRelocationType.java
@@ -53,7 +53,11 @@ public enum X86_32_ElfRelocationType implements ElfRelocationType {
R_386_TLS_GOTDESC(39), // GOT offset for TLS descriptor. */
R_386_TLS_DESC_CALL(40), // Marker of call through TLS descriptor for relaxation. */
R_386_TLS_DESC(41), // TLS descriptor containing pointer to code and to argument, returning the TLS offset for the symbol. */
- R_386_IRELATIVE(42); // Adjust indirectly by program base */
+ R_386_IRELATIVE(42), // Adjust indirectly by program base */
+ R_386_GOT32X(43),
+ R_386_USED_BY_INTEL_200(200),
+ R_386_GNU_VTINHERIT(250),
+ R_386_GNU_VTENTRY(251);
public final int typeId;
diff --git a/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_64_ElfRelocationType.java b/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_64_ElfRelocationType.java
index 0c0af95b60..500bd88917 100644
--- a/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_64_ElfRelocationType.java
+++ b/Ghidra/Processors/x86/src/main/java/ghidra/app/util/bin/format/elf/relocation/X86_64_ElfRelocationType.java
@@ -73,7 +73,15 @@ public enum X86_64_ElfRelocationType implements ElfRelocationType {
R_X86_64_PLT32_BND(40), // deprecated
R_X86_64_GOTPCRELX(41), // G + GOT + A - P
R_X86_64_REX_GOTPCRELX(42), //G + GOT + A - P
- R_X86_64_NUM(43),
+ R_X86_64_CODE_4_GOTPCRELX(43),
+ R_X86_64_CODE_4_GOTTPOFF(44),
+ R_X86_64_CODE_4_GOTPC32_TLSDESC(45),
+ R_X86_64_CODE_5_GOTPCRELX(46),
+ R_X86_64_CODE_5_GOTPC32_TLSDESC(47),
+ R_X86_64_CODE_5_GOTTPOFF(48),
+ R_X86_64_CODE_6_GOTPCRELX(49),
+ R_X86_64_CODE_6_GOTTPOFF(50),
+ R_X86_64_CODE_6_GOTPC32_TLSDESC(51),
R_X86_64_GNU_VTINHERIT(250),
R_X86_64_GNU_VTENTRY(251);