From owner-svn-src-all@freebsd.org Fri Feb 26 20:38:25 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B9E1AB43A4; Fri, 26 Feb 2016 20:38:25 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::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 736E48F0; Fri, 26 Feb 2016 20:38:25 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u1QKcOWA003897; Fri, 26 Feb 2016 20:38:24 GMT (envelope-from nwhitehorn@FreeBSD.org) Received: (from nwhitehorn@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u1QKcOjl003893; Fri, 26 Feb 2016 20:38:24 GMT (envelope-from nwhitehorn@FreeBSD.org) Message-Id: <201602262038.u1QKcOjl003893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: nwhitehorn set sender to nwhitehorn@FreeBSD.org using -f From: Nathan Whitehorn Date: Fri, 26 Feb 2016 20:38:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r296113 - in head/lib/libc: powerpc powerpc/gen powerpc64 powerpc64/gen 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.20 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: Fri, 26 Feb 2016 20:38:25 -0000 Author: nwhitehorn Date: Fri Feb 26 20:38:23 2016 New Revision: 296113 URL: https://svnweb.freebsd.org/changeset/base/296113 Log: Make unions in PowerPC libc endian-safe. Modified: head/lib/libc/powerpc/_fpmath.h head/lib/libc/powerpc/gen/infinity.c head/lib/libc/powerpc64/_fpmath.h head/lib/libc/powerpc64/gen/infinity.c Modified: head/lib/libc/powerpc/_fpmath.h ============================================================================== --- head/lib/libc/powerpc/_fpmath.h Fri Feb 26 20:33:32 2016 (r296112) +++ head/lib/libc/powerpc/_fpmath.h Fri Feb 26 20:38:23 2016 (r296113) @@ -29,10 +29,17 @@ union IEEEl2bits { long double e; struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int manl :32; + unsigned int manh :20; + unsigned int exp :11; + unsigned int sign :1; +#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ unsigned int sign :1; unsigned int exp :11; unsigned int manh :20; unsigned int manl :32; +#endif } bits; }; Modified: head/lib/libc/powerpc/gen/infinity.c ============================================================================== --- head/lib/libc/powerpc/gen/infinity.c Fri Feb 26 20:33:32 2016 (r296112) +++ head/lib/libc/powerpc/gen/infinity.c Fri Feb 26 20:38:23 2016 (r296113) @@ -11,7 +11,20 @@ __FBSDID("$FreeBSD$"); #include /* bytes for +Infinity on powerpc */ -const union __infinity_un __infinity = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; +const union __infinity_un __infinity = { +#if BYTE_ORDER == BIG_ENDIAN + { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } +#else + { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } +#endif +}; /* bytes for NaN */ -const union __nan_un __nan = { { 0xff, 0xc0, 0, 0 } }; +const union __nan_un __nan = { +#if BYTE_ORDER == BIG_ENDIAN + {0xff, 0xc0, 0, 0} +#else + { 0, 0, 0xc0, 0xff } +#endif +}; + Modified: head/lib/libc/powerpc64/_fpmath.h ============================================================================== --- head/lib/libc/powerpc64/_fpmath.h Fri Feb 26 20:33:32 2016 (r296112) +++ head/lib/libc/powerpc64/_fpmath.h Fri Feb 26 20:38:23 2016 (r296113) @@ -29,10 +29,17 @@ union IEEEl2bits { long double e; struct { +#if _BYTE_ORDER == _LITTLE_ENDIAN + unsigned int manl :32; + unsigned int manh :20; + unsigned int exp :11; + unsigned int sign :1; +#else /* _BYTE_ORDER == _LITTLE_ENDIAN */ unsigned int sign :1; unsigned int exp :11; unsigned int manh :20; unsigned int manl :32; +#endif } bits; }; Modified: head/lib/libc/powerpc64/gen/infinity.c ============================================================================== --- head/lib/libc/powerpc64/gen/infinity.c Fri Feb 26 20:33:32 2016 (r296112) +++ head/lib/libc/powerpc64/gen/infinity.c Fri Feb 26 20:38:23 2016 (r296113) @@ -11,7 +11,20 @@ __FBSDID("$FreeBSD$"); #include /* bytes for +Infinity on powerpc */ -const union __infinity_un __infinity = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; +const union __infinity_un __infinity = { +#if BYTE_ORDER == BIG_ENDIAN + { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } +#else + { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } +#endif +}; /* bytes for NaN */ -const union __nan_un __nan = { { 0xff, 0xc0, 0, 0 } }; +const union __nan_un __nan = { +#if BYTE_ORDER == BIG_ENDIAN + {0xff, 0xc0, 0, 0} +#else + { 0, 0, 0xc0, 0xff } +#endif +}; +