From patchwork Sat Nov 26 04:18:00 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Gray X-Patchwork-Id: 699465 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 3tQfnd4tYXz9t0X for ; Sat, 26 Nov 2016 15:18:28 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 5C71E4BA35; Sat, 26 Nov 2016 05:18:24 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KJesf4Ou_kgr; Sat, 26 Nov 2016 05:18:23 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2B7F44B98A; Sat, 26 Nov 2016 05:18:23 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3E4924B98A for ; Sat, 26 Nov 2016 05:18:20 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id qeC8jFhcA53m for ; Sat, 26 Nov 2016 05:18:20 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from lechuck.jsg.id.au (jsg.id.au [210.15.216.215]) by theia.denx.de (Postfix) with ESMTPS id 0A7F14B811 for ; Sat, 26 Nov 2016 05:18:13 +0100 (CET) Received: from largo.jsg.id.au (largo.jsg.id.au [192.168.1.43]) by lechuck.jsg.id.au (OpenSMTPD) with ESMTP id 3f3d1d6b for ; Sat, 26 Nov 2016 15:18:00 +1100 (AEDT) Received: from largo.jsg.id.au (localhost [127.0.0.1]) by largo.jsg.id.au (OpenSMTPD) with ESMTP id 654acf33 for ; Sat, 26 Nov 2016 15:18:00 +1100 (AEDT) From: Jonathan Gray To: u-boot@lists.denx.de Date: Sat, 26 Nov 2016 15:18:00 +1100 Message-Id: <20161126041800.22980-1-jsg@jsg.id.au> X-Mailer: git-send-email 2.9.0 Subject: [U-Boot] [PATCH] compiler.h: use u-boot endian macros on OpenBSD X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" When building u-boot on sparc64 and powerpc hosts it became clear that u-boot expects endian conversion defines to be macros: lib/crc32.c:87: error: braced-group within expression allowed only inside a function For OpenBSD switch from using system definitions equivalent to the u-boot ones and define glibc __BYTE_ORDER __BIG_ENDIAN __LITTLE_ENDIAN names, as at least some parts of the non-cross build assumes those names are present (ie crc32.c). Signed-off-by: Jonathan Gray --- include/compiler.h | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/include/compiler.h b/include/compiler.h index 65b826e..a43fb6a 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -52,6 +52,9 @@ typedef unsigned long ulong; # include /* htole32 and friends */ #elif defined(__OpenBSD__) # include +# define __BYTE_ORDER BYTE_ORDER +# define __LITTLE_ENDIAN LITTLE_ENDIAN +# define __BIG_ENDIAN BIG_ENDIAN #endif #include @@ -84,20 +87,7 @@ typedef unsigned int uint; # define uswap_64(x) _uswap_64(x, ) #endif -#if defined(__OpenBSD__) -#define cpu_to_le16(x) htole16(x) -#define cpu_to_le32(x) htole32(x) -#define cpu_to_le64(x) htole64(x) -#define le16_to_cpu(x) letoh16(x) -#define le32_to_cpu(x) letoh32(x) -#define le64_to_cpu(x) letoh64(x) -#define cpu_to_be16(x) htobe16(x) -#define cpu_to_be32(x) htobe32(x) -#define cpu_to_be64(x) htobe64(x) -#define be16_to_cpu(x) betoh16(x) -#define be32_to_cpu(x) betoh32(x) -#define be64_to_cpu(x) betoh64(x) -#elif __BYTE_ORDER == __LITTLE_ENDIAN +#if __BYTE_ORDER == __LITTLE_ENDIAN # define cpu_to_le16(x) (x) # define cpu_to_le32(x) (x) # define cpu_to_le64(x) (x)