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 C9D06C433FE for ; Tue, 18 Oct 2022 18:17:33 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2CF1984E09; Tue, 18 Oct 2022 20:17:32 +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="YG4ygijf"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id D115584E09; Tue, 18 Oct 2022 20:17:30 +0200 (CEST) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (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 B53F384D2B for ; Tue, 18 Oct 2022 20:17:27 +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-qt1-x82f.google.com with SMTP id c23so10209292qtw.8 for ; Tue, 18 Oct 2022 11:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=konsulko.com; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=Awl1lDvF/+oKlVlyXni3Wsyx9JuLpWQrSv+/b/lt68Y=; b=YG4ygijfaPsYLHvWelC339Zd8CrSH86dXHHdf1tdw0pHcedZzhqwwxVT1wfBZPsoU3 CX8N66X19+Vq9CbWRDo4qT244K7up3Bo+AiOORIk/GAA7QLk1+jcVFFjbr2fqFeJKwDP VXe7XbTWgndMZCIbjyZLQV4meQd02y9L0Jo14= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Awl1lDvF/+oKlVlyXni3Wsyx9JuLpWQrSv+/b/lt68Y=; b=U9m9Y5xULY+Ng4im2IA+TygX1iokAe7xdmJUpa4/WBP69E6mg7LoSY3zcbE6hnO3k5 ZTwjK8iNSc1b3PYrL9rHQG4eYWH+zJ8pL1txXCgxPR5Gg7F7ToLtEZZ2XOzWvSI+xBAz vfJ23g5tgRRhV6VcC9BgU1Kef9DVXsEKHvd0RApjuRLyvS8FWFnpa0imMWeGwe5eoiOX 9J4xAcl99EoXEXox9g/E8XOYqIRH7FasyMr6GOAtc5ZDIn4jg/BYbXPaKkkB4S58T7Pt KJsgDyxhr5MqnFjo5+70HJo4PUPeSiz24cs15nu5Q/hidoT2aNW9bUXkPRQDdG+YsV+u KUOA== X-Gm-Message-State: ACrzQf2Ko3psUGjPxtV+fWlYwcjJ0sOgFa0s3N9XBICjFUjZGnCdiFFk CfKyV+ebngxmLA0GVjCate9OWw== X-Google-Smtp-Source: AMsMyM7U7YwtZJUzbunaa3hFKlH80hHjxNEA5FLh4gXF9be+GwmQKFAwVjB/Tf0uqjkOt4S1g3KrHA== X-Received: by 2002:ac8:4e53:0:b0:39c:eec4:373f with SMTP id e19-20020ac84e53000000b0039ceec4373fmr3087534qtw.617.1666117046380; Tue, 18 Oct 2022 11:17:26 -0700 (PDT) Received: from bill-the-cat (2603-6081-7b00-6400-9c58-0588-a5a5-a6b0.res6.spectrum.com. [2603:6081:7b00:6400:9c58:588:a5a5:a6b0]) by smtp.gmail.com with ESMTPSA id 5-20020a370805000000b006ec09d7d357sm2798947qki.47.2022.10.18.11.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 11:17:25 -0700 (PDT) Date: Tue, 18 Oct 2022 14:17:23 -0400 From: Tom Rini To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Max Krummenacher , u-boot@lists.denx.de, U-Boot STM32 , Adam Ford , Patrice CHOTARD , Patrick DELAUNAY , Max Krummenacher , Heinrich Schuchardt , Marek =?iso-8859-1?Q?Beh=FAn?= , Quentin Schulz , Simon Glass Subject: Re: [PATCH] Makefile: fix u-boot-initial-env target if lto is enabled Message-ID: <20221018181723.GQ2020586@bill-the-cat> References: <20221018174827.1393211-1-max.oss.09@gmail.com> <20221018180331.sgsufsip2p2544ip@pali> <20221018180446.GP2020586@bill-the-cat> <20221018180627.eezooyqb2yyhyodu@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="93p3Mfsbf6DTJ78q" Content-Disposition: inline In-Reply-To: <20221018180627.eezooyqb2yyhyodu@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.6 at phobos.denx.de X-Virus-Status: Clean --93p3Mfsbf6DTJ78q Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 18, 2022 at 08:06:27PM +0200, Pali Roh=E1r wrote: > On Tuesday 18 October 2022 14:04:46 Tom Rini wrote: > > On Tue, Oct 18, 2022 at 08:03:31PM +0200, Pali Roh=E1r wrote: > > > On Tuesday 18 October 2022 19:48:27 Max Krummenacher wrote: > > > > From: Max Krummenacher > > > >=20 > > > > With LTO enabled the U-Boot initial environment is no longer stored > > > > in an easy accessible section in env/common.o. I.e. the section name > > > > changes from build to build, its content maybe compressed and it is > > > > annotated with additional data. > > > >=20 > > > > For GCC adding the option '-ffat-lto-objects' when compiling common= =2Eo > > > > adds additionally the traditional sections in the object file and > > > > 'make u-boot-initial-env' would work also for the LTO enabled case. > > > > However clang doesn't have that option. > > > >=20 > > > > Fix this by recompiling common.o into a object file only used for > > > > the creation of u-boot-initial-env if LTO is enabled. > > > >=20 > > > > See also: > > > > https://lore.kernel.org/all/927b122e-1f62-e790-f5ca-30bae4332c77@fo= ss.st.com/ > > > >=20 > > > > Signed-off-by: Max Krummenacher > > > >=20 > > > > --- > > > >=20 > > > > Makefile | 8 ++++++++ > > > > 1 file changed, 8 insertions(+) > > > >=20 > > > > diff --git a/Makefile b/Makefile > > > > index 3866cc62f9a..cd45c720d23 100644 > > > > --- a/Makefile > > > > +++ b/Makefile > > > > @@ -2451,9 +2451,17 @@ endif > > > > $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.modpost > > > > =20 > > > > quiet_cmd_genenv =3D GENENV $@ > > > > +ifeq ($(LTO_ENABLE),y) > > > > +cmd_genenv =3D $(CC) $(filter-out $(LTO_CFLAGS),$(c_flags)) -c -o = env/initial_env.o env/common.c; \ > > > > + $(OBJCOPY) --dump-section .rodata.default_environment=3D$@ env/in= itial_env.o; \ > > > > + sed --in-place -e 's/\x00/\x0A/g' $@; sed --in-place -e '/^\s*$$/= d' $@; \ > > > > + sort --field-separator=3D=3D -k1,1 --stable $@ -o $@; \ > > > > + rm -f env/initial_env.o env/initial_env.su > > > > +else > > > > cmd_genenv =3D $(OBJCOPY) --dump-section .rodata.default_environme= nt=3D$@ env/common.o; \ > > >=20 > > > This code is still broken because in some cases section name is not R= O. > >=20 > > Wait, when does that happen? >=20 > E.g. for mvebu_espressobin-88f3720_defconfig Erm, ugh. I see 44be835d25ba ("arm: mvebu: Espressobin: Set default value for $ethNaddr env variable") and c4df0f6f315c ("arm: mvebu: Espressobin: Set default value for $fdtfile env variable") I guess we couldn't solve this any other way? The platforms aren't unique in needing / wanting to set MAC or fdtfile variables. --=20 Tom --93p3Mfsbf6DTJ78q Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmNO7agACgkQFHw5/5Y0 tyxRNwv+P1ogdMEM3a0cSecDzjQfPN+QWAT4+ivm301c+jZC89Rj+ft4m5bzD2vw uUGSGuVN4JHnPTmJI6qpWe9/dpj0+aIzKCkEiTTsGgfIQJgNBlK/S9Uor/uiZNy8 xOoJiaKDXPKD27Gid2Lnb+4k5Qa7xbBO3pafSRXXMZi1+EeAUhGbmsm4m7WseHR7 dsA7tjv4mx2eHAcYrpCEs2o+Yqf2BTL8pYA0aPaT4OJgVovJZDRTPLcEtV3MiFVR kf4tSp5m35a9Ou24eTVWy8q4HqRqvSD20dB+j4vejHzH4xFdTO/OL/6DjdLoXNP5 h7oiUoHkS/ZTaKxXlDVdSWMgrHxgkKUel+IqORATiORXsd5hpJ6nUyKVHg8+JJFN vrfn1yS3FDs/2lPYHBlIA5zietQ/C1uF4F+t0/yMR7TYhD//ksZ7cp3UiBDIjUzc GMoDpg/OOjpcBW9rFgsjqS8iAN8PGcGE8dlynJvFNLmVRiRzBT7LrvmxQF8IkRxU ndMUxgRg =JR11 -----END PGP SIGNATURE----- --93p3Mfsbf6DTJ78q--