From 33b570d34836b42c0fa921a7c106709beb57bc55 Mon Sep 17 00:00:00 2001 From: Oleksandr Tymoshenko Date: Fri, 13 Jan 2012 07:00:47 +0000 Subject: [PATCH] - Fix .rela case of R_MIPS_26 relocation. Addednds save diferently for .rel and .rela sections. It's shifted right two bits for former but saved as-is for latter. --- sys/mips/mips/elf_machdep.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c index a147a7f170cc..d37471388ae5 100644 --- a/sys/mips/mips/elf_machdep.c +++ b/sys/mips/mips/elf_machdep.c @@ -227,7 +227,11 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbase, const void *data, return (-1); addend &= 0x03ffffff; - addend <<= 2; + /* + * Addendum for .rela R_MIPS_26 is not shifted right + */ + if (rela == NULL) + addend <<= 2; addr += ((Elf_Addr)where & 0xf0000000) | addend; addr >>= 2;