added 4 changesets to branch 'refs/remotes/jessicah-github/boot-syslog-ng' old head: a9b6d1b5fd385686ca96b24fd86f9e234bf720fb new head: 16e30993d7b1a18e87a29661fdaacbdae32a9334 overview: https://github.com/jessicah/haiku/compare/a9b6d1b...16e3099 ---------------------------------------------------------------------------- b003dd5: Allow configuring for a given boot platform. a4c05a9: ByteOrder.h: remove use of __builtin_bswap16. * Fixes the build for host compilers older than gcc-4.8 Conflicts: headers/os/support/ByteOrder.h 5090962: Revert "ByteOrder.h: remove use of __builtin_bswap16." This reverts commit 040dc2eebc6628cc05c4ac5e287c5287c5dacf2e. 16e3099: ByteOrder.h: separate host & Haiku versions. * This avoids polluting the Haiku headers with host issues, as pointed out by Axel. * Should also resolve build issues for various versions of host compilers that were introduced in previous commits. [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ] ---------------------------------------------------------------------------- 3 files changed, 148 insertions(+), 1 deletion(-) configure | 6 ++ headers/build/os/support/ByteOrder.h | 133 ++++++++++++++++++++++++++++++- headers/os/support/ByteOrder.h | 10 +++ ############################################################################ Commit: b003dd5912c53aa77ccf535d1004fcc3d417c2cf Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> Date: Sun Jun 1 09:52:38 2014 UTC Allow configuring for a given boot platform. ---------------------------------------------------------------------------- diff --git a/configure b/configure index 9dd3acf..3b762af 100755 --- a/configure +++ b/configure @@ -84,6 +84,9 @@ options: first occurrence specifies the primary architecture of the Haiku to build, subsequent ones the secondary architectures. + --boot-platform <platform> Select the target boot platform; not supported by + all targets. + For x86_64, valid platforms=efi,bios_ia32 --update re-runs last configure invocation [must be given as first option!] --use-gcc-pipe Build with GCC option -pipe. Speeds up the build @@ -623,6 +626,7 @@ while [ $# -gt 0 ] ; do ) haikuTargetArchs="$haikuTargetArchs $targetArch" ;; + --boot-platform=*) HAIKU_BOOT_PLATFORM=`echo $1 | cut -d'=' -f2-`; shift 1;; --use-gcc-pipe) HAIKU_USE_GCC_PIPE=1; shift 1;; --use-gcc-graphite) useGccGraphiteDefault=1; shift 1;; --use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;; @@ -870,6 +874,8 @@ HAIKU_HOST_USE_XATTR ?= "${HAIKU_HOST_USE_XATTR}" ; HAIKU_HOST_USE_XATTR_REF ?= "${HAIKU_HOST_USE_XATTR_REF}" ; HAIKU_HOST_BUILD_ONLY ?= "${HAIKU_HOST_BUILD_ONLY}" ; +HAIKU_BOOT_PLATFORM ?= ${HAIKU_BOOT_PLATFORM} ; + HAIKU_PACKAGING_ARCHS ?= ${HAIKU_PACKAGING_ARCHS} ; HAIKU_BUILD_ATTRIBUTES_DIR ?= ${HAIKU_BUILD_ATTRIBUTES_DIR} ; ############################################################################ Commit: a4c05a9269ef069e331ec1183a0aa91f7442efa2 Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> Date: Thu May 29 20:01:37 2014 UTC ByteOrder.h: remove use of __builtin_bswap16. * Fixes the build for host compilers older than gcc-4.8 Conflicts: headers/os/support/ByteOrder.h ---------------------------------------------------------------------------- diff --git a/headers/os/support/ByteOrder.h b/headers/os/support/ByteOrder.h index a0cde4a..4c1d025 100644 --- a/headers/os/support/ByteOrder.h +++ b/headers/os/support/ByteOrder.h @@ -29,6 +29,11 @@ typedef enum { # define ntohl(x) B_BENDIAN_TO_HOST_INT32(x) # define htons(x) B_HOST_TO_BENDIAN_INT16(x) # define ntohs(x) B_BENDIAN_TO_HOST_INT16(x) + +static inline uint16 __swap_int16(uint16 arg) +{ + return (arg >> 8) | (arg << 8); +} #endif /* always swap macros */ @@ -122,6 +127,14 @@ extern bool is_type_swapped(type_code type); extern double __swap_double(double arg); extern float __swap_float(float arg); +#if __GNUC__ >= 4 +#define __swap_int64(arg) __builtin_bswap64(arg) +#define __swap_int32(arg) __builtin_bswap32(arg) +#else +extern uint64 __swap_int64(uint64 arg); +extern uint32 __swap_int32(uint32 arg); +#endif + #ifdef __cplusplus } #endif diff --git a/headers/posix/netinet/in.h b/headers/posix/netinet/in.h index ab891cb..169a6cb 100644 --- a/headers/posix/netinet/in.h +++ b/headers/posix/netinet/in.h @@ -31,6 +31,10 @@ typedef uint32_t in_addr_t; # else extern unsigned int __swap_int32(unsigned int); /* private */ # endif + static inline uint16_t __swap_int16(uint16_t arg) + { + return (arg >> 8) | (arg << 8); + } extern uint16_t __swap_int16(uint16_t); /* private */ # if BYTE_ORDER == LITTLE_ENDIAN # define htonl(x) ((uint32_t)__swap_int32(x)) diff --git a/src/build/libroot/byteorder.cpp b/src/build/libroot/byteorder.cpp index fdcbf32..ebd6ae0 100644 --- a/src/build/libroot/byteorder.cpp +++ b/src/build/libroot/byteorder.cpp @@ -7,12 +7,6 @@ #include <ByteOrder.h> -uint16 -__swap_int16(uint16 value) -{ - return (value >> 8) | (value << 8); -} - uint32 __swap_int32(uint32 value) { ############################################################################ Commit: 509096229d43b5ff2937d9ff6b7425508035c006 Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> Date: Fri May 30 07:56:34 2014 UTC Revert "ByteOrder.h: remove use of __builtin_bswap16." This reverts commit 040dc2eebc6628cc05c4ac5e287c5287c5dacf2e. ---------------------------------------------------------------------------- diff --git a/headers/os/support/ByteOrder.h b/headers/os/support/ByteOrder.h index 4c1d025..6024d2a 100644 --- a/headers/os/support/ByteOrder.h +++ b/headers/os/support/ByteOrder.h @@ -29,11 +29,6 @@ typedef enum { # define ntohl(x) B_BENDIAN_TO_HOST_INT32(x) # define htons(x) B_HOST_TO_BENDIAN_INT16(x) # define ntohs(x) B_BENDIAN_TO_HOST_INT16(x) - -static inline uint16 __swap_int16(uint16 arg) -{ - return (arg >> 8) | (arg << 8); -} #endif /* always swap macros */ @@ -130,9 +125,11 @@ extern float __swap_float(float arg); #if __GNUC__ >= 4 #define __swap_int64(arg) __builtin_bswap64(arg) #define __swap_int32(arg) __builtin_bswap32(arg) +#define __swap_int16(arg) __builtin_bswap16(arg) #else extern uint64 __swap_int64(uint64 arg); extern uint32 __swap_int32(uint32 arg); +extern uint16 __swap_int16(uint16 arg); #endif #ifdef __cplusplus diff --git a/headers/posix/netinet/in.h b/headers/posix/netinet/in.h index 169a6cb..ab891cb 100644 --- a/headers/posix/netinet/in.h +++ b/headers/posix/netinet/in.h @@ -31,10 +31,6 @@ typedef uint32_t in_addr_t; # else extern unsigned int __swap_int32(unsigned int); /* private */ # endif - static inline uint16_t __swap_int16(uint16_t arg) - { - return (arg >> 8) | (arg << 8); - } extern uint16_t __swap_int16(uint16_t); /* private */ # if BYTE_ORDER == LITTLE_ENDIAN # define htonl(x) ((uint32_t)__swap_int32(x)) diff --git a/src/build/libroot/byteorder.cpp b/src/build/libroot/byteorder.cpp index ebd6ae0..fdcbf32 100644 --- a/src/build/libroot/byteorder.cpp +++ b/src/build/libroot/byteorder.cpp @@ -7,6 +7,12 @@ #include <ByteOrder.h> +uint16 +__swap_int16(uint16 value) +{ + return (value >> 8) | (value << 8); +} + uint32 __swap_int32(uint32 value) { ############################################################################ Commit: 16e30993d7b1a18e87a29661fdaacbdae32a9334 Author: Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> Date: Fri May 30 08:02:25 2014 UTC ByteOrder.h: separate host & Haiku versions. * This avoids polluting the Haiku headers with host issues, as pointed out by Axel. * Should also resolve build issues for various versions of host compilers that were introduced in previous commits. ---------------------------------------------------------------------------- diff --git a/headers/build/os/support/ByteOrder.h b/headers/build/os/support/ByteOrder.h index ea63f6d..0f2f28f 100644 --- a/headers/build/os/support/ByteOrder.h +++ b/headers/build/os/support/ByteOrder.h @@ -1 +1,132 @@ -#include <../os/support/ByteOrder.h> +/* + * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _BYTEORDER_H +#define _BYTEORDER_H + + +#include <BeBuild.h> +#include <endian.h> +#include <SupportDefs.h> +#include <TypeConstants.h> + /* for convenience */ + + +/* swap directions */ +typedef enum { + B_SWAP_HOST_TO_LENDIAN, + B_SWAP_HOST_TO_BENDIAN, + B_SWAP_LENDIAN_TO_HOST, + B_SWAP_BENDIAN_TO_HOST, + B_SWAP_ALWAYS +} swap_action; + + +/* BSD/networking macros */ +#ifndef htonl +# define htonl(x) B_HOST_TO_BENDIAN_INT32(x) +# define ntohl(x) B_BENDIAN_TO_HOST_INT32(x) +# define htons(x) B_HOST_TO_BENDIAN_INT16(x) +# define ntohs(x) B_BENDIAN_TO_HOST_INT16(x) +#endif + +/* always swap macros */ +#define B_SWAP_DOUBLE(arg) __swap_double(arg) +#define B_SWAP_FLOAT(arg) __swap_float(arg) +#define B_SWAP_INT64(arg) __swap_int64(arg) +#define B_SWAP_INT32(arg) __swap_int32(arg) +#define B_SWAP_INT16(arg) __swap_int16(arg) + +#if BYTE_ORDER == __LITTLE_ENDIAN +/* Host is little endian */ + +#define B_HOST_IS_LENDIAN 1 +#define B_HOST_IS_BENDIAN 0 + +/* Host native to little endian */ +#define B_HOST_TO_LENDIAN_DOUBLE(arg) (double)(arg) +#define B_HOST_TO_LENDIAN_FLOAT(arg) (float)(arg) +#define B_HOST_TO_LENDIAN_INT64(arg) (uint64)(arg) +#define B_HOST_TO_LENDIAN_INT32(arg) (uint32)(arg) +#define B_HOST_TO_LENDIAN_INT16(arg) (uint16)(arg) + +/* Little endian to host native */ +#define B_LENDIAN_TO_HOST_DOUBLE(arg) (double)(arg) +#define B_LENDIAN_TO_HOST_FLOAT(arg) (float)(arg) +#define B_LENDIAN_TO_HOST_INT64(arg) (uint64)(arg) +#define B_LENDIAN_TO_HOST_INT32(arg) (uint32)(arg) +#define B_LENDIAN_TO_HOST_INT16(arg) (uint16)(arg) + +/* Host native to big endian */ +#define B_HOST_TO_BENDIAN_DOUBLE(arg) __swap_double(arg) +#define B_HOST_TO_BENDIAN_FLOAT(arg) __swap_float(arg) +#define B_HOST_TO_BENDIAN_INT64(arg) __swap_int64(arg) +#define B_HOST_TO_BENDIAN_INT32(arg) __swap_int32(arg) +#define B_HOST_TO_BENDIAN_INT16(arg) __swap_int16(arg) + +/* Big endian to host native */ +#define B_BENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg) +#define B_BENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg) +#define B_BENDIAN_TO_HOST_INT64(arg) __swap_int64(arg) +#define B_BENDIAN_TO_HOST_INT32(arg) __swap_int32(arg) +#define B_BENDIAN_TO_HOST_INT16(arg) __swap_int16(arg) + +#else /* BYTE_ORDER */ +/* Host is big endian */ + +#define B_HOST_IS_LENDIAN 0 +#define B_HOST_IS_BENDIAN 1 + +/* Host native to little endian */ +#define B_HOST_TO_LENDIAN_DOUBLE(arg) __swap_double(arg) +#define B_HOST_TO_LENDIAN_FLOAT(arg) __swap_float(arg) +#define B_HOST_TO_LENDIAN_INT64(arg) __swap_int64(arg) +#define B_HOST_TO_LENDIAN_INT32(arg) __swap_int32(arg) +#define B_HOST_TO_LENDIAN_INT16(arg) __swap_int16(arg) + +/* Little endian to host native */ +#define B_LENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg) +#define B_LENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg) +#define B_LENDIAN_TO_HOST_INT64(arg) __swap_int64(arg) +#define B_LENDIAN_TO_HOST_INT32(arg) __swap_int32(arg) +#define B_LENDIAN_TO_HOST_INT16(arg) __swap_int16(arg) + +/* Host native to big endian */ +#define B_HOST_TO_BENDIAN_DOUBLE(arg) (double)(arg) +#define B_HOST_TO_BENDIAN_FLOAT(arg) (float)(arg) +#define B_HOST_TO_BENDIAN_INT64(arg) (uint64)(arg) +#define B_HOST_TO_BENDIAN_INT32(arg) (uint32)(arg) +#define B_HOST_TO_BENDIAN_INT16(arg) (uint16)(arg) + +/* Big endian to host native */ +#define B_BENDIAN_TO_HOST_DOUBLE(arg) (double)(arg) +#define B_BENDIAN_TO_HOST_FLOAT(arg) (float)(arg) +#define B_BENDIAN_TO_HOST_INT64(arg) (uint64)(arg) +#define B_BENDIAN_TO_HOST_INT32(arg) (uint32)(arg) +#define B_BENDIAN_TO_HOST_INT16(arg) (uint16)(arg) + +#endif /* BYTE_ORDER */ + + +#ifdef __cplusplus +extern "C" { +#endif + +extern status_t swap_data(type_code type, void *data, size_t length, + swap_action action); +extern bool is_type_swapped(type_code type); + + +/* Private implementations */ +extern double __swap_double(double arg); +extern float __swap_float(float arg); +extern uint64 __swap_int64(uint64 arg); +extern uint32 __swap_int32(uint32 arg); +extern uint16 __swap_int16(uint16 arg); + +#ifdef __cplusplus +} +#endif + +#endif /* _BYTEORDER_H */