u-boot contains a static crc table with endian calls that essentially
requires the endian calls to be macros.

lib/crc32.c:87: error: braced-group within expression allowed only inside a 
function

Define the glibc names in u-boot compiler.h as at least some parts of
the non-cross build assumes those names are present (ie crc32.c).

The cross built parts use local definitions that set __BYTE_ORDER etc
but it isn't always entirely clear which is which.

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/u-boot/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile    14 Sep 2016 05:52:25 -0000      1.7
+++ Makefile    22 Oct 2016 02:36:27 -0000
@@ -2,6 +2,7 @@
 
 COMMENT=       U-Boot firmware
 DISTNAME=      u-boot-2016.09
+REVISION=      0
 CATEGORIES=    sysutils
 HOMEPAGE=      http://www.denx.de/wiki/U-Boot
 MAINTAINER=    Jonathan Gray <[email protected]>
Index: patches/patch-include_configs_omap3_beagle_h
===================================================================
RCS file: 
/cvs/ports/sysutils/u-boot/patches/patch-include_configs_omap3_beagle_h,v
retrieving revision 1.1
diff -u -p -r1.1 patch-include_configs_omap3_beagle_h
--- patches/patch-include_configs_omap3_beagle_h        18 Jun 2016 03:04:44 
-0000      1.1
+++ patches/patch-include_configs_omap3_beagle_h        22 Oct 2016 02:42:17 
-0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-include_configs_omap3_beagle_h,v 1.1 2016/06/18 03:04:44 jsg 
Exp $
---- include/configs/omap3_beagle.h.orig        Tue May 17 00:40:32 2016
-+++ include/configs/omap3_beagle.h     Mon Jun 13 17:28:45 2016
-@@ -113,9 +113,12 @@
+--- include/configs/omap3_beagle.h.orig        Tue Sep 13 00:05:51 2016
++++ include/configs/omap3_beagle.h     Sat Oct 22 13:42:04 2016
+@@ -112,9 +112,12 @@
  
  #define CONFIG_EXTRA_ENV_SETTINGS \
        "loadaddr=0x80200000\0" \
@@ -15,7 +15,7 @@ $OpenBSD: patch-include_configs_omap3_be
        "usbtty=cdc_acm\0" \
        "bootfile=uImage\0" \
        "ramdisk=ramdisk.gz\0" \
-@@ -210,39 +213,17 @@
+@@ -209,39 +212,17 @@
        "userbutton=if gpio input 173; then run userbutton_xm; " \
                "else run userbutton_nonxm; fi;\0" \
        "userbutton_xm=gpio input 4;\0" \
Index: patches/patch-include_configs_ti_omap5_common_h
===================================================================
RCS file: 
/cvs/ports/sysutils/u-boot/patches/patch-include_configs_ti_omap5_common_h,v
retrieving revision 1.2
diff -u -p -r1.2 patch-include_configs_ti_omap5_common_h
--- patches/patch-include_configs_ti_omap5_common_h     6 Aug 2016 08:07:51 
-0000       1.2
+++ patches/patch-include_configs_ti_omap5_common_h     22 Oct 2016 02:42:21 
-0000
@@ -1,7 +1,7 @@
 $OpenBSD: patch-include_configs_ti_omap5_common_h,v 1.2 2016/08/06 08:07:51 
jsg Exp $
---- include/configs/ti_omap5_common.h.orig     Tue Jul 12 05:01:01 2016
-+++ include/configs/ti_omap5_common.h  Sat Aug  6 17:10:52 2016
-@@ -66,6 +66,18 @@
+--- include/configs/ti_omap5_common.h.orig     Tue Sep 13 00:05:51 2016
++++ include/configs/ti_omap5_common.h  Sat Oct 22 13:42:04 2016
+@@ -64,6 +64,18 @@
  #define DFUARGS
  #endif
  
@@ -20,7 +20,7 @@ $OpenBSD: patch-include_configs_ti_omap5
  #ifndef CONFIG_SPL_BUILD
  #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
  #define CONFIG_EXTRA_ENV_SETTINGS \
-@@ -115,21 +127,8 @@
+@@ -113,21 +125,8 @@
        "loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \
        DFUARGS \
        NETARGS \
--- /dev/null   Sat Oct 22 13:45:57 2016
+++ patches/patch-include_compiler_h    Sat Oct 22 13:36:07 2016
@@ -0,0 +1,35 @@
+$OpenBSD$
+--- include/compiler.h.orig    Sat Oct 22 12:27:18 2016
++++ include/compiler.h Sat Oct 22 12:29:01 2016
+@@ -52,6 +52,9 @@ typedef unsigned long ulong;
+ # include <sys/endian.h> /* htole32 and friends */
+ #elif defined(__OpenBSD__)
+ # include <endian.h>
++# define __BYTE_ORDER BYTE_ORDER
++# define __LITTLE_ENDIAN LITTLE_ENDIAN
++# define __BIG_ENDIAN BIG_ENDIAN
+ #endif
+ 
+ #include <time.h>
+@@ -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)

Reply via email to