Skip to content

Commit 247f143

Browse files
authored
Merge pull request #526 from DanielSant0s/fix-erl
feat: update and restore ERL library to the current SDK
2 parents 8a9ccb1 + fa8cf4f commit 247f143

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

ee/Rules.make

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ $(EE_BIN): $(EE_OBJS) $(EE_LIB_ARCHIVES) $(EE_ADDITIONAL_DEPS) $(PS2SDK_CRT0)
106106
$(EE_CC) -T$(EE_LINKFILE) -Wl,-Map,$(EE_BIN_MAPFILE) $(EE_OPTFLAGS) \
107107
-o $(EE_BIN) -nostartfiles $(PS2SDK_CRT0) $(EE_OBJS) $(EE_LDFLAGS) $(EE_LIB_ARCHIVES) $(EE_LIBS)
108108

109+
$(EE_ERL) : $(EE_OBJS)
110+
$(DIR_GUARD)
111+
$(EE_CC) -nostdlib -o $(EE_ERL) $(EE_OBJS) $(EE_CFLAGS) $(EE_LDFLAGS) -Wl,-r -Wl,-d
112+
$(EE_STRIP) --strip-unneeded -R .mdebug.eabi64 -R .reginfo -R .comment $(EE_ERL)
113+
109114
$(EE_LIB): $(EE_OBJS) $(EE_LIB:%.a=%.erl)
110115
$(DIR_GUARD)
111116
$(EE_AR) cru $(EE_LIB) $(EE_OBJS)

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)