From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752812AbbJORDS (ORCPT ); Thu, 15 Oct 2015 13:03:18 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:38527 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752088AbbJORDQ (ORCPT ); Thu, 15 Oct 2015 13:03:16 -0400 Date: Thu, 15 Oct 2015 18:03:07 +0100 From: Russell King - ARM Linux To: "H. Nikolaus Schaller" Cc: Szabolcs Nagy , Nathan Lynch , Will Deacon , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, marek@goldelico.com Subject: Re: [PATCH v3] ARM: fix vdsomunge not to depend on glibc specific byteswap.h Message-ID: <20151015170306.GF32532@n2100.arm.linux.org.uk> References: <160a66a415cdb49174bc7d05b3e4dda9bba0e9d6.1444888374.git.hns@goldelico.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <160a66a415cdb49174bc7d05b3e4dda9bba0e9d6.1444888374.git.hns@goldelico.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 15, 2015 at 07:52:56AM +0200, H. Nikolaus Schaller wrote: > If the host toolchain is not glibc based then the arm kernel build > fails with > > HOSTCC arch/arm/vdso/vdsomunge > arch/arm/vdso/vdsomunge.c:48:22: fatal error: byteswap.h: No such file or directory > > Observed: with omap2plus_defconfig and compile on Mac OS X with arm ELF > cross-compiler. > > Reason: byteswap.h is a glibc only header. > > Solution: replace by private byte-swapping macros (taken from > arch/mips/boot/elf2ecoff.c) > > Tested to compile on Mac OS X 10.9.5 host. > > Signed-off-by: H. Nikolaus Schaller > --- > arch/arm/vdso/vdsomunge.c | 19 +++++++++++++++---- > 1 file changed, 15 insertions(+), 4 deletions(-) > > diff --git a/arch/arm/vdso/vdsomunge.c b/arch/arm/vdso/vdsomunge.c > index aedec81..513f9eb 100644 > --- a/arch/arm/vdso/vdsomunge.c > +++ b/arch/arm/vdso/vdsomunge.c > @@ -45,7 +45,6 @@ > * it does. > */ > > -#include > #include > #include > #include > @@ -59,6 +58,18 @@ > #include > #include > > +#define swab16(x) \ > + ((unsigned short)( \ > + (((unsigned short)(x) & (unsigned short)0x00ffU) << 8) | \ > + (((unsigned short)(x) & (unsigned short)0xff00U) >> 8))) ((((x) & 0x00ff) << 8) | \ (((x) & 0xff00) >> 8)) > + > +#define swab32(x) \ > + ((unsigned int)( \ > + (((unsigned int)(x) & (unsigned int)0x000000ffUL) << 24) | \ > + (((unsigned int)(x) & (unsigned int)0x0000ff00UL) << 8) | \ > + (((unsigned int)(x) & (unsigned int)0x00ff0000UL) >> 8) | \ > + (((unsigned int)(x) & (unsigned int)0xff000000UL) >> 24))) ((((x) & 0x000000ff) << 24) | \ (((x) & 0x0000ff00) << 8) | \ (((x) & 0x00ff0000) >> 8) | \ (((x) & 0xff000000) << 24)) We can get rid of all the casts because we know what size 'x' is in both cases. -- FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up according to speedtest.net.