From patchwork Fri Oct 2 13:10:41 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: 7315421 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 0D09ABEEA4 for ; Fri, 2 Oct 2015 13:13:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A5F60208C4 for ; Fri, 2 Oct 2015 13:13:43 +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 53C2C20892 for ; Fri, 2 Oct 2015 13:13:42 +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 1Zi07I-0000pJ-KQ; Fri, 02 Oct 2015 13:11:16 +0000 Received: from mo6-p00-ob.smtp.rzone.de ([2a01:238:20a:202:5300::5]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zi07F-0000kj-CD for linux-arm-kernel@lists.infradead.org; Fri, 02 Oct 2015 13:11:14 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1443791449; l=1977; s=domk; d=goldelico.com; h=To:References:Content-Transfer-Encoding:Cc:Date:In-Reply-To:From: Subject:Mime-Version:Content-Type; bh=VtDlKhIEJlhEnL0AvvjNt4U+5wE1WsXtxFalGQFYD1w=; b=cLIDsx1g6ufcT1ETTW/W08dvW9Lb0KiZZgGVtdvwelC+jc2f4l2ueop/ePzvgQ3wl2N s35H5snZFcW8OL9IG2mU24bmFFbqBgO3XXwczKCz+c3RAJ4Am2ait7iMy1yE2lF8YpTEB umL922gHuKZVXdUna5dc7Ib9VmEFFwPMgmo= X-RZG-AUTH: :JGIXVUS7cutRB/49FwqZ7WcKdUCnXG6JabOfSXKWrat+jdPvyuSM X-RZG-CLASS-ID: mo00 Received: from [192.168.2.104] (p57AE1C68.dip0.t-ipconnect.de [87.174.28.104]) by post.strato.de (RZmta 37.12 DYNA|AUTH) with ESMTPA id e066c5r92DAjuw2; Fri, 2 Oct 2015 15:10:45 +0200 (CEST) Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: [PATCH] ARM: fix vdsomunge not to depend on glibc specific byteswap.h From: H. Nikolaus Schaller In-Reply-To: Date: Fri, 2 Oct 2015 15:10:41 +0200 Message-Id: <0B599C1F-3788-4DA0-9187-04DF6BF54800@goldelico.com> References: To: Szabolcs Nagy , Russell King , Nathan Lynch , Will Deacon X-Mailer: Apple Mail (2.1878.6) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151002_061113_762881_9E13FC85 X-CRM114-Status: GOOD ( 12.46 ) 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: marek@goldelico.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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=ham 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..27a9a0b 100644 --- a/arch/arm/vdso/vdsomunge.c +++ b/arch/arm/vdso/vdsomunge.c @@ -45,7 +45,18 @@ * it does. */ -#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) )) + #include #include #include @@ -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)