From 80930eca55f053e11e0ab7adc2c3b16bfcd3bd8a Mon Sep 17 00:00:00 2001 From: Arthur Blot Date: Mon, 21 Jul 2014 12:01:23 +0200 Subject: [PATCH] psp-prxgen: remove PC16 relocations It apparently appeared with binutils 2.18+. It appears when compiling an assembly file containing a branch to a global name, but looks useless (branches are relative to current position, and I do not see how the symbol could "move"). This relocation made the PSP not load the modules using it. --- tools/psp-prxgen.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/psp-prxgen.c b/tools/psp-prxgen.c index 087ffb89..80d68910 100644 --- a/tools/psp-prxgen.c +++ b/tools/psp-prxgen.c @@ -419,7 +419,8 @@ int remove_weak_relocs(struct ElfSection *pReloc, struct ElfSection *pSymbol, st } } - if(LH(pSymData[iSymbol].st_shndx) == 0) + /* Remove PC16 relocations (unsupported by PSP, and useless) */ + if(LH(pSymData[iSymbol].st_shndx) == 0 || ELF32_R_TYPE(LW(pInRel->r_info)) == R_MIPS_PC16) { if(g_verbose) {