summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2012-01-13 07:00:47 +0000
committergonzo <gonzo@FreeBSD.org>2012-01-13 07:00:47 +0000
commit675e68d8b51fcf1d12f97da41cc363f393b3dfab (patch)
tree1cea4bda21d51199f308c67ce83b607b242bc108 /sys/mips
parentbc60183644608e350c93eba5f5bbbfe33b0307f5 (diff)
downloadFreeBSD-src-675e68d8b51fcf1d12f97da41cc363f393b3dfab.zip
FreeBSD-src-675e68d8b51fcf1d12f97da41cc363f393b3dfab.tar.gz
- 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.
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/mips/elf_machdep.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/mips/mips/elf_machdep.c b/sys/mips/mips/elf_machdep.c
index a147a7f..d374713 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;
OpenPOWER on IntegriCloud