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 3912ACCA468 for ; Wed, 1 Jun 2022 14:08:32 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 83E8284280; Wed, 1 Jun 2022 16:08:29 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=konsulko.com header.i=@konsulko.com header.b="kB5sh/mv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9A82F84280; Wed, 1 Jun 2022 16:08:27 +0200 (CEST) Received: from mail-qk1-x72f.google.com (mail-qk1-x72f.google.com [IPv6:2607:f8b0:4864:20::72f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id A42F180107 for ; Wed, 1 Jun 2022 16:08:24 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=konsulko.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=trini@konsulko.com Received: by mail-qk1-x72f.google.com with SMTP id 199so1399857qkk.0 for ; Wed, 01 Jun 2022 07:08:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=HTGFOZhfq8uND9lAeZAK14cszcJFLElKetvjM6AXxO4=; b=kB5sh/mvl0U3O4ph8kpiOgHGUBgx3NPEF+4fGorTz2b4mw80xPBsybSnakLthpvpcg h+abozZjM2kqfIVTM576PLlSFM6j1UZZBsK5rykmX4snTw4S4F9+t3chz9mc6Lyl9VnH O8XS520e5bC88oBHYqmmdAUXsK/88gXSwnjU0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=HTGFOZhfq8uND9lAeZAK14cszcJFLElKetvjM6AXxO4=; b=BHwZjOImh2OWoIRjRiN7Q0gpmDpAR9Id80cBjA+97kEcspbBhO5N9GqzEg+TXeOZlr HI1ixTDSbefocwX0zaC8btfntxYGpwbiSZWElUv/NNY9+6vGgb1FR3/TmYP+HbriVnPm oZZN0RQ44Q2ODTyPlXMJjMxYPExgRociL7fU2Omk6PNQL87530yzJ792O4lwL7HQdcmy LJUZJK1L110CsBNAYZT3JhI+oPghXoa5nTCd7W3+TcN/wr6uNp6xlPTMNedJ7cgQlelx yQp7v2TK3O2nrunFKJ43lXAldFiD+ClvyvkSpdjHVA3cy4k3g7Rv8XzEJd8wKXASBgZB QXZg== X-Gm-Message-State: AOAM530eTVYE+GvOjZ9VQ3LYrGq0F/Lz6sCnxLF90w+06ep2Jw3WgTpl OtidjqWP3LGZIIq8orEOSikQag== X-Google-Smtp-Source: ABdhPJy+NdNExVXn71SAGzZuMPf0CoMpBBHYCGiUUfN9kVReNU7SVU4V11UuUyAoX+wBsSjB1QZ9zg== X-Received: by 2002:a05:620a:1662:b0:6a3:5692:636 with SMTP id d2-20020a05620a166200b006a356920636mr120218qko.311.1654092503279; Wed, 01 Jun 2022 07:08:23 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-25fd-0000-0000-0000-1003.res6.spectrum.com. [2603:6081:7b00:25fd::1003]) by smtp.gmail.com with ESMTPSA id o185-20020a375ac2000000b006a36b0d7f27sm1324575qkb.76.2022.06.01.07.08.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 Jun 2022 07:08:22 -0700 (PDT) Date: Wed, 1 Jun 2022 10:08:20 -0400 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= , Miquel Raynal Cc: wJoao Marcos Costa , Thomas Petazzoni , u-boot@lists.denx.de Subject: Re: [PATCH] squashfs: Fix compilation on big endian systems Message-ID: <20220601140820.GE25375@bill-the-cat> References: <20220406213153.30437-1-pali@kernel.org> <20220407095421.7a3a2508@xps13> <20220407094159.ntw7vt5mcmdtmfp6@pali> <20220407115455.265f0cf3@xps13> <20220407095855.2b4dq37xdrqd5o37@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="oAjj1ZwgLg4oRN9q" Content-Disposition: inline In-Reply-To: <20220407095855.2b4dq37xdrqd5o37@pali> X-Clacks-Overhead: GNU Terry Pratchett 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 --oAjj1ZwgLg4oRN9q Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Apr 07, 2022 at 11:58:55AM +0200, Pali Roh=C3=A1r wrote: > On Thursday 07 April 2022 11:54:55 Miquel Raynal wrote: > > Hi Pali, > >=20 > > pali@kernel.org wrote on Thu, 7 Apr 2022 11:41:59 +0200: > >=20 > > > On Thursday 07 April 2022 09:54:21 Miquel Raynal wrote: > > > > Hi Pali, > > > >=20 > > > > pali@kernel.org wrote on Wed, 6 Apr 2022 23:31:53 +0200: > > > >=20 > > > > Would you mind explaining a little bit how this change fixes it? It > > > > does not look straightforward to me. =20 > > >=20 > > > 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. > > >=20 > > > File asm/byteorder.h is then ARCH-specific and implements macros for = the > > > current architecture (by including the correct header file). > > >=20 > > > So currently if you try to compile squashfs for big endian systems you > > > get compile error: > > >=20 > > > 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" r= edefined > > > #define __cpu_to_le32(x) ((__force __le32)__swab32((x))) > > >=20 > > > In file included from fs/squashfs/sqfs_dir.c:10: > > > include/linux/byteorder/little_endian.h:34: note: this is the locat= ion of the previous definition > > > #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) > > >=20 > > > Or: > > >=20 > > > In file included from fs/squashfs/sqfs.c:14: > > > include/linux/byteorder/little_endian.h:89:21: error: redefinition = of =E2=80=98__be16_to_cpup=E2=80=99 > > > 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 definiti= on of =E2=80=98__be16_to_cpup=E2=80=99 was here > > > static inline __u16 __be16_to_cpup(const __be16 *p) > > > ^~~~~~~~~~~~~~ > > >=20 > > > As some header files include correct asm/byteorder.h file and this > > > squashfs includes additional little_endian.h. > >=20 > > Great, thanks for the thorough explanation. Based on what you said, > > wouldn't it be cleaner to just get rid of the little_endian.h include > > rather than also use the ARCH specific byteorder.h header? >=20 > I think that this is not possible. squashfs code uses le16_to_cpu() > macro and its correct definition is provided only by arch specific > asm/byteorder.h. Miquel, is this sufficient explanation? Thanks. --=20 Tom --oAjj1ZwgLg4oRN9q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmKXcs0ACgkQFHw5/5Y0 tywX4wwAizPG4FZ+j9vSAxDAVX1PrpFoN+kERjAu70ZxOZySCzOwOJPZ5VPr+N5r SZtNIrFpcaV+S7eKxKdt2TJdMxQdIXJ2l9K0B23GU7JQ5M3R0IIXbk0XAroqXQS7 RmmQ5mLtAfZqoy9/nS8CpyAY9BSq5CDB94xV2IQ6AONqdnVAzBJkzy2zwh3Btd4A i6DBuqMl0FL0ZWMS7whwkEsAd7TQhI9DcG1J3PG6u0o+lyWRaX3Gc3i8WagAZM1A 85dKrWElqejZvOlDpZJAJElceg0GMwULoBtO1J4Ie6zcGxG2Xp1x+rs8Vq9bfVul RvFHqg+sn0h1RBboyNjnFXYaiQtPNoFhGfavMYP7OVx1ty7wn02mQjb03X9Ct3/Q CgPos8ZAlr4LyE6P2P7XwVa8yJSrSI87JK9WcozIemW1iBXgBY3zPpEUzxKnMWlP UGsSKd+Fq0i9aXk7JCJovHyO1SxCO+Tr8RCZhUyJS8Lo/yEYiqAsBzet4ZhOxOAg InGGxd1C =DLhL -----END PGP SIGNATURE----- --oAjj1ZwgLg4oRN9q--