Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B846C433F5 for ; Thu, 7 Apr 2022 09:44:10 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8869683DB5; Thu, 7 Apr 2022 11:43:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="OOhqkOkC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id DEB3C83CAF; Thu, 7 Apr 2022 11:42:21 +0200 (CEST) Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 1926983CEF for ; Thu, 7 Apr 2022 11:42:05 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 90D8161BE0; Thu, 7 Apr 2022 09:42:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9671DC385A0; Thu, 7 Apr 2022 09:42:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1649324522; bh=onf2x3ZEegm196tox6uB421LYEVYY7/Wnv2sh9pOTqQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=OOhqkOkCptpRL4CoXblg1iTzdYi2ResU5VvwG3VH+iEMM6rUJ8q3rTfrwNtyp/x3+ lqJJ41R4S+/cjvdLMhARVXyvHhUhh/vE+OlFrgbOj46pyswUN0E0f4pgjbigktDt// sl6bs5n0tLH5kzAu+bpmiPpnle15ELJMehY2SKL3Yg6OBQX0JoiBDNDgQNrPLv/Qdy pTD8c6gZEoIdaYdEkGWW0pPaySacAMaOfEnRENou50j9Tl5Hhg2lfnuN5ML4FnGBOc /FObgECvUA2c5b+UgLPgdPApF9zyV0Fmee4uA218F9PsH/qFwlRIjK8aoE22KNOK+1 ALaWSDjFS4mEQ== Received: by pali.im (Postfix) id DC9477E4; Thu, 7 Apr 2022 11:41:59 +0200 (CEST) Date: Thu, 7 Apr 2022 11:41:59 +0200 From: Pali =?utf-8?B?Um9ow6Fy?= To: Miquel Raynal Cc: Joao Marcos Costa , Thomas Petazzoni , u-boot@lists.denx.de Subject: Re: [PATCH] squashfs: Fix compilation on big endian systems Message-ID: <20220407094159.ntw7vt5mcmdtmfp6@pali> References: <20220406213153.30437-1-pali@kernel.org> <20220407095421.7a3a2508@xps13> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220407095421.7a3a2508@xps13> User-Agent: NeoMutt/20180716 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.5 at phobos.denx.de X-Virus-Status: Clean On Thursday 07 April 2022 09:54:21 Miquel Raynal wrote: > Hi Pali, > > pali@kernel.org wrote on Wed, 6 Apr 2022 23:31:53 +0200: > > Would you mind explaining a little bit how this change fixes it? It > does not look straightforward to me. Yes! I though that it is straightforward this change... byteorder/little_endian.h defines cpu_to_le* macros for Little Endian systems and byteorder/big_endian.h for Big Endian systems. File asm/byteorder.h is then ARCH-specific and implements macros for the current architecture (by including the correct header file). So currently if you try to compile squashfs for big endian systems you get compile error: In file included from ./arch/powerpc/include/asm/byteorder.h:82, from include/linux/unaligned/access_ok.h:4, from ./arch/powerpc/include/asm/unaligned.h:9, from fs/squashfs/sqfs_filesystem.h:11, from fs/squashfs/sqfs_dir.c:16: include/linux/byteorder/big_endian.h:34: warning: "__cpu_to_le32" redefined #define __cpu_to_le32(x) ((__force __le32)__swab32((x))) In file included from fs/squashfs/sqfs_dir.c:10: include/linux/byteorder/little_endian.h:34: note: this is the location of the previous definition #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) Or: In file included from fs/squashfs/sqfs.c:14: include/linux/byteorder/little_endian.h:89:21: error: redefinition of ‘__be16_to_cpup’ static inline __u16 __be16_to_cpup(const __be16 *p) ^~~~~~~~~~~~~~ In file included from ./arch/powerpc/include/asm/byteorder.h:82, from include/linux/unaligned/access_ok.h:4, from ./arch/powerpc/include/asm/unaligned.h:9, from fs/squashfs/sqfs.c:10: include/linux/byteorder/big_endian.h:89:21: note: previous definition of ‘__be16_to_cpup’ was here static inline __u16 __be16_to_cpup(const __be16 *p) ^~~~~~~~~~~~~~ As some header files include correct asm/byteorder.h file and this squashfs includes additional little_endian.h. > > Signed-off-by: Pali Rohár > > --- > > fs/squashfs/sqfs.c | 3 +-- > > fs/squashfs/sqfs_dir.c | 3 +-- > > 2 files changed, 2 insertions(+), 4 deletions(-) > > > > diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c > > index 5d9c52af80ba..41cb811c1b32 100644 > > --- a/fs/squashfs/sqfs.c > > +++ b/fs/squashfs/sqfs.c > > @@ -11,8 +11,7 @@ > > #include > > #include > > #include > > -#include > > -#include > > +#include > > #include > > #include > > #include > > diff --git a/fs/squashfs/sqfs_dir.c b/fs/squashfs/sqfs_dir.c > > index a265b98fe685..ed83c90682ff 100644 > > --- a/fs/squashfs/sqfs_dir.c > > +++ b/fs/squashfs/sqfs_dir.c > > @@ -7,8 +7,7 @@ > > > > #include > > #include > > -#include > > -#include > > +#include > > #include > > #include > > #include > > Cheers, > Miquèl