From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932901AbbI3RsM (ORCPT ); Wed, 30 Sep 2015 13:48:12 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.218]:57902 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932243AbbI3RsL convert rfc822-to-8bit (ORCPT ); Wed, 30 Sep 2015 13:48:11 -0400 X-RZG-AUTH: :JGIXVUS7cutRB/49FwqZ7WcKdUCnXG6JabOfSXKWrat+jNPpz40= X-RZG-CLASS-ID: mo00 Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: [PATCH] ARM: fix vdsomunge depends on glibc specific byteswap.h From: "H. Nikolaus Schaller" In-Reply-To: <560C1DD0.1000907@mentor.com> Date: Wed, 30 Sep 2015 19:47:39 +0200 Cc: Ard Biesheuvel , Szabolcs Nagy , Russell King , Will Deacon , Marek Belisko , LKML , linux-arm-kernel Content-Transfer-Encoding: 8BIT Message-Id: <8B76E3E8-52BF-4803-B1F9-E5704A858870@goldelico.com> References: <2039A9BE-ADA4-4D28-84F4-C8B9D76834AD@goldelico.com> <560C1DD0.1000907@mentor.com> To: Nathan Lynch X-Mailer: Apple Mail (2.1878.6) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 30.09.2015 um 19:37 schrieb Nathan Lynch : > On 09/30/2015 11:17 AM, Ard Biesheuvel wrote: >> On 30 September 2015 at 18:13, H. Nikolaus Schaller wrote: >>> >>> Am 30.09.2015 um 18:02 schrieb Ard Biesheuvel : >>>> >>>> Have you tried this? >>>> >>>> #define bswap_16 __builtin_bswap16 >>>> #define bswap_32 __builtin_bswap32 >>>> #define bswap_64 __builtin_bswap64 >>>> >>>> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html >>> >>> OS X host uses llvm and I am not sure if these builtins are >>> always available. >>> >> >> I am pretty sure recent clang supports these as well. Could you please try it? > > Well, I think GCC did not provide __builtin_bswap16 consistently until > the 4.8 release: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 > > That seems too recent to me. Same for me. > > vdsomunge makes only three or four potentially byteswapped accesses to > the ELF header. It's not worth a lot of effort to try to use the most > optimal implementation available. Especially as it does not run on the target device but the build host. > Why not just use a generic > implementation like is found in mips' elf2ecoff? Do you have a reference? I can't find byte swapping in https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/elf2ecoff.c?id=refs/tags/v4.3-rc3 BR and thanks, Nikolaus Schaller From mboxrd@z Thu Jan 1 00:00:00 1970 From: hns@goldelico.com (H. Nikolaus Schaller) Date: Wed, 30 Sep 2015 19:47:39 +0200 Subject: [PATCH] ARM: fix vdsomunge depends on glibc specific byteswap.h In-Reply-To: <560C1DD0.1000907@mentor.com> References: <2039A9BE-ADA4-4D28-84F4-C8B9D76834AD@goldelico.com> <560C1DD0.1000907@mentor.com> Message-ID: <8B76E3E8-52BF-4803-B1F9-E5704A858870@goldelico.com> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Am 30.09.2015 um 19:37 schrieb Nathan Lynch : > On 09/30/2015 11:17 AM, Ard Biesheuvel wrote: >> On 30 September 2015 at 18:13, H. Nikolaus Schaller wrote: >>> >>> Am 30.09.2015 um 18:02 schrieb Ard Biesheuvel : >>>> >>>> Have you tried this? >>>> >>>> #define bswap_16 __builtin_bswap16 >>>> #define bswap_32 __builtin_bswap32 >>>> #define bswap_64 __builtin_bswap64 >>>> >>>> https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html >>> >>> OS X host uses llvm and I am not sure if these builtins are >>> always available. >>> >> >> I am pretty sure recent clang supports these as well. Could you please try it? > > Well, I think GCC did not provide __builtin_bswap16 consistently until > the 4.8 release: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=52624 > > That seems too recent to me. Same for me. > > vdsomunge makes only three or four potentially byteswapped accesses to > the ELF header. It's not worth a lot of effort to try to use the most > optimal implementation available. Especially as it does not run on the target device but the build host. > Why not just use a generic > implementation like is found in mips' elf2ecoff? Do you have a reference? I can't find byte swapping in https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/mips/boot/elf2ecoff.c?id=refs/tags/v4.3-rc3 BR and thanks, Nikolaus Schaller