From patchwork Thu Oct 15 05:52:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H. Nikolaus Schaller" X-Patchwork-Id: 7401581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5F679BEEA4 for ; Thu, 15 Oct 2015 05:55:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 78D622091B for ; Thu, 15 Oct 2015 05:55:08 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 93F29209E7 for ; Thu, 15 Oct 2015 05:55:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmbTk-0001es-GC; Thu, 15 Oct 2015 05:53:28 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::4]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmbTd-0001Z3-Cb for linux-arm-kernel@lists.infradead.org; Thu, 15 Oct 2015 05:53:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1444888379; l=2158; s=domk; d=goldelico.com; h=Date:Subject:Cc:To:From; bh=xmfvonbGIQ29ZZEtiBweeGX9CrxUG6VIVXQxZBrphbs=; b=Bt1Yn3L4ATRgrSiwxo7pUKP2+oIe/g0Kq8s1+F9l1S7TbWuDWi2cG/DpxGNvf37Zi4Y yqfFQustpuXVmD82plcKZQX4D7avkDViybpOWx3st3c9Un1pkz0xZvuctKNM7gHzok4wk CedcmEnMtOuiAjAeh3zd2jkUJQkTt3kgFNg= X-RZG-AUTH: :JGIXVUS7cutRB/49FwqZ7WcecEarQROEYabkiUo6mSAGQ+qKID81PEGSJp8= X-RZG-CLASS-ID: mo00 Received: from localhost.localdomain (p57AE0D97.dip0.t-ipconnect.de [87.174.13.151]) by smtp.strato.de (RZmta 37.14 DYNA|AUTH) with ESMTPA id m012bbr9F5quD9u; Thu, 15 Oct 2015 07:52:56 +0200 (CEST) From: "H. Nikolaus Schaller" To: Szabolcs Nagy , Russell King , Nathan Lynch , Will Deacon Subject: [PATCH v3] ARM: fix vdsomunge not to depend on glibc specific byteswap.h Date: Thu, 15 Oct 2015 07:52:56 +0200 Message-Id: <160a66a415cdb49174bc7d05b3e4dda9bba0e9d6.1444888374.git.hns@goldelico.com> X-Mailer: git-send-email 2.5.1 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151014_225321_657248_6CB2EC39 X-CRM114-Status: GOOD ( 11.26 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "H. Nikolaus Schaller" , marek@goldelico.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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))) + +#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))) + #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ #define HOST_ORDER ELFDATA2LSB #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ @@ -104,17 +115,17 @@ static void cleanup(void) static Elf32_Word read_elf_word(Elf32_Word word, bool swap) { - return swap ? bswap_32(word) : word; + return swap ? swab32(word) : word; } static Elf32_Half read_elf_half(Elf32_Half half, bool swap) { - return swap ? bswap_16(half) : half; + return swap ? swab16(half) : half; } static void write_elf_word(Elf32_Word val, Elf32_Word *dst, bool swap) { - *dst = swap ? bswap_32(val) : val; + *dst = swap ? swab32(val) : val; } int main(int argc, char **argv)