Date: Sat, 26 Jul 2014 17:07:32 +0000 (UTC) From: Marcel Moolenaar <marcel@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269129 - head/sys/powerpc/powerpc Message-ID: <201407261707.s6QH7WtY020573@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Sat Jul 26 17:07:32 2014 New Revision: 269129 URL: http://svnweb.freebsd.org/changeset/base/269129 Log: Fix relocations related to dpcpu and vnet sets. The address is rebased to point to the allocated memory, but for architectures that have non-zero relocation addends, the address comparison happens on the "unfinalized" address. After the addend is taken into account, call elf_relocaddr() to make sure we rebase properly. Modified: head/sys/powerpc/powerpc/elf32_machdep.c Modified: head/sys/powerpc/powerpc/elf32_machdep.c ============================================================================== --- head/sys/powerpc/powerpc/elf32_machdep.c Sat Jul 26 16:45:11 2014 (r269128) +++ head/sys/powerpc/powerpc/elf32_machdep.c Sat Jul 26 17:07:32 2014 (r269129) @@ -190,8 +190,7 @@ elf_reloc_internal(linker_file_t lf, Elf addr = lookup(lf, symidx, 1); if (addr == 0) return -1; - addr += addend; - *where = addr; + *where = elf_relocaddr(lf, addr + addend); break; case R_PPC_ADDR16_LO: /* #lo(S) */ @@ -204,9 +203,8 @@ elf_reloc_internal(linker_file_t lf, Elf * are relative to relocbase. Detect this condition. */ if (addr > relocbase && addr <= (relocbase + addend)) - addr = relocbase + addend; - else - addr += addend; + addr = relocbase; + addr = elf_relocaddr(lf, addr + addend); *hwhere = addr & 0xffff; break; @@ -220,9 +218,8 @@ elf_reloc_internal(linker_file_t lf, Elf * are relative to relocbase. Detect this condition. */ if (addr > relocbase && addr <= (relocbase + addend)) - addr = relocbase + addend; - else - addr += addend; + addr = relocbase; + addr = elf_relocaddr(lf, addr + addend); *hwhere = ((addr >> 16) + ((addr & 0x8000) ? 1 : 0)) & 0xffff; break;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201407261707.s6QH7WtY020573>