From owner-svn-src-all@FreeBSD.ORG Sat Jul 26 17:07:32 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id B4201D0D; Sat, 26 Jul 2014 17:07:32 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A0DC72C9F; Sat, 26 Jul 2014 17:07:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s6QH7W69020574; Sat, 26 Jul 2014 17:07:32 GMT (envelope-from marcel@svn.freebsd.org) Received: (from marcel@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s6QH7WtY020573; Sat, 26 Jul 2014 17:07:32 GMT (envelope-from marcel@svn.freebsd.org) Message-Id: <201407261707.s6QH7WtY020573@svn.freebsd.org> From: Marcel Moolenaar Date: Sat, 26 Jul 2014 17:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r269129 - head/sys/powerpc/powerpc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jul 2014 17:07:32 -0000 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;