Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 28 Dec 2014 19:55:45 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r276342 - head/libexec/rtld-elf/powerpc
Message-ID:  <201412281955.sBSJtj9H043565@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Sun Dec 28 19:55:44 2014
New Revision: 276342
URL: https://svnweb.freebsd.org/changeset/base/276342

Log:
  Fix the following -Werror warning from clang 3.5.0, while building
  rtld-elf for powerpc 32 bit:
  
  libexec/rtld-elf/powerpc/reloc.c:486:6: error: taking the absolute value of unsigned type 'Elf_Addr' (aka 'unsigned int') has no effect [-Werror,-Wabsolute-value]
          if (abs(offset) < 32*1024*1024) {     /* inside 32MB? */
              ^
  libexec/rtld-elf/powerpc/reloc.c:486:6: note: remove the call to 'abs' since unsigned values cannot be negative
          if (abs(offset) < 32*1024*1024) {     /* inside 32MB? */
              ^~~
  1 error generated.
  
  Cast 'offset' to int, since that was intended, and should be safe to do
  on architectures with 32-bit two's complement ints.
  
  Reviewed by:	kib
  Differential Revision: https://reviews.freebsd.org/D1387

Modified:
  head/libexec/rtld-elf/powerpc/reloc.c

Modified: head/libexec/rtld-elf/powerpc/reloc.c
==============================================================================
--- head/libexec/rtld-elf/powerpc/reloc.c	Sun Dec 28 19:24:01 2014	(r276341)
+++ head/libexec/rtld-elf/powerpc/reloc.c	Sun Dec 28 19:55:44 2014	(r276342)
@@ -483,7 +483,7 @@ reloc_jmpslot(Elf_Addr *wherep, Elf_Addr
 	 */
 	offset = target - (Elf_Addr)wherep;
 
-	if (abs(offset) < 32*1024*1024) {     /* inside 32MB? */
+	if (abs((int)offset) < 32*1024*1024) {     /* inside 32MB? */
 		/* b    value   # branch directly */
 		*wherep = 0x48000000 | (offset & 0x03fffffc);
 		__syncicache(wherep, 4);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201412281955.sBSJtj9H043565>