Skip to content

Commit 37a0baa

Browse files
committed
feat: add relocation addend section type support
1 parent baefabc commit 37a0baa

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

ee/erl/src/erl.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@ static char * reloc_types[] = {
188188
#define PROGBITS 1
189189
#define NOBITS 8
190190
#define REL 9
191+
#define RELA 4
191192
#define GLOBAL 1
192193
#define WEAK 2
193194
#define NOTYPE 0
@@ -256,6 +257,9 @@ struct elf_reloc_t {
256257
u32 r_offset, r_info;
257258
};
258259

260+
struct elf_rela_t {
261+
u32 r_offset, r_info, r_addend;
262+
};
259263

260264
/* Our internal structures. */
261265

@@ -808,12 +812,12 @@ return code
808812

809813
// Parsing sections to find relocation sections.
810814
for (i = 0; i < head.e_shnum; i++) {
811-
if (sec[i].sh_type != REL)
815+
if (sec[i].sh_type != REL && sec[i].sh_type != RELA)
812816
continue;
813817
dprintf("Section %i (%s) contains relocations for section %i (%s):\n",
814818
i, names + sec[i].sh_name, sec[i].sh_info, names + sec[sec[i].sh_info].sh_name);
815819

816-
if (sec[i].sh_entsize != sizeof(struct elf_reloc_t)) {
820+
if (sec[i].sh_entsize != sizeof(struct elf_reloc_t) && sec[i].sh_entsize != sizeof(struct elf_rela_t)) {
817821
dprintf("Warning: inconsistancy in relocation table.\n");
818822
free_and_return(-1);
819823
}

0 commit comments

Comments
 (0)