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 33303C43217 for ; Tue, 18 Oct 2022 18:04:58 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id DE7C384E7F; Tue, 18 Oct 2022 20:04:55 +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="ID6wpETt"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CA96A84F62; Tue, 18 Oct 2022 20:04:53 +0200 (CEST) Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) (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 7B9A484E6F for ; Tue, 18 Oct 2022 20:04:50 +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-x829.google.com with SMTP id hh9so10175160qtb.13 for ; Tue, 18 Oct 2022 11:04:50 -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=VzsYmiql7pS464nKxjAU7gMi/YTHzywjx7vQzn8BvgE=; b=ID6wpETtVZc86ZCELoNspA57pcdA2uqOj17CJy9ZNpF3tazi+KOXi4COy8cmjgE2YN ZG41jDoZwpiavksoFY4VzpX9iXvdMSBa2SxYlNXZcopY6uVdEuDhoreTtvpH3xuuQnrD VJG8b2F/h55cS5y4irrAERoaG3gDQx3T12SBw= 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=VzsYmiql7pS464nKxjAU7gMi/YTHzywjx7vQzn8BvgE=; b=EAVUK+QAYQ+HrgOPqfMKc5gIr1gkn+fZ/6OZUzW5TzuWHhNYmUyzKzyzdw2PeALz5/ VgwKGwZBpJRDre3CgDunxTLCgOIlLBxCS3pNtmZVRCts66sXUDQrhO9O0IIIl1i+b7sD 2pD8IjjFgwnEaj41XnMHoXNHSnGoPFnPNBQfMbk8x7EdHM0x8DY6f6IP39Kc1nTpHFJb 5eAx7lXaivLnTSTznaP6nZ9SproBbbiVP/5vUFRxU1ck3E+aMIuF7jsvV1wPxZ2eN+Q9 5EMV2Gg7u/RT/dLnb2WrPNQvsO57tjSt5l3B0Wd+j8C2lH1/L4IQE6eChuvM1pQRRq/Z i97A== X-Gm-Message-State: ACrzQf0mRAZ9quCKQmm9i9ANAGdCs2Xa3DIe7VLPEeU8NR9OQl+jrYyT zmL5FgGhiz8shTJwYqGG4CcJjQ== X-Google-Smtp-Source: AMsMyM6Ql6+TzYo416rBAyJbR3xaFq2CNr8NcLc5IICoftsDNx1x2JTBl2nBixGbxEsQQs0NRhpUIg== X-Received: by 2002:ac8:5dd3:0:b0:393:44ed:f9e6 with SMTP id e19-20020ac85dd3000000b0039344edf9e6mr3178970qtx.651.1666116289280; Tue, 18 Oct 2022 11:04:49 -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 i17-20020a05620a405100b006cec8001bf4sm2943594qko.26.2022.10.18.11.04.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Oct 2022 11:04:48 -0700 (PDT) Date: Tue, 18 Oct 2022 14:04:46 -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: <20221018180446.GP2020586@bill-the-cat> References: <20221018174827.1393211-1-max.oss.09@gmail.com> <20221018180331.sgsufsip2p2544ip@pali> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="CpRwOJvrTIYkeTuO" Content-Disposition: inline In-Reply-To: <20221018180331.sgsufsip2p2544ip@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 --CpRwOJvrTIYkeTuO Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable 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.o > > 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@foss.s= t.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/initia= l_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_environment= =3D$@ env/common.o; \ >=20 > This code is still broken because in some cases section name is not RO. Wait, when does that happen? --=20 Tom --CpRwOJvrTIYkeTuO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEEGjx/cOCPqxcHgJu/FHw5/5Y0tywFAmNO6r4ACgkQFHw5/5Y0 tyzPxwv+PiyOgXnp3haLml9RB2ABFnc4M3hVuMpvK6S3WkL77r840QZT1cmjnYCy QNSqPsuHJ2JzFbOZNLTSY3Qd6noJCWba7XDZeI+fARVbE5r2UHEFEQfIWs4YTk7V Ez1Sr4YnVpvWJyoVGpjJyAUy6dyKPSm1i9edQR824revj7oPM9bDp2Asl0rm4ewo oHikEpE/mEQ7BAdmkO7CiYrBI17/LfNGIZvV+fSIWZ9ie1uI/kKTqB+4md0/RPRJ O2XH2OqyA3In/J/ztiy689B30O30goZvBphXvO1kn0Szzmn4BBjyI5aAw2I0DpmI OZ5lyHjEBWIsGOj0lV9VGGK5n+vUfoP7B75Z9FHeJCbirb5UlMD/XBqiY4eYAfqQ 6vDO9ZiU7g7BOxoXjQaEFQ4DDl7yDvnXUK439rssdifyfPFF17clDe7UbgaXm7iO UF9VGMH6O0QiNuCd8yIL5/saNNNcm1JciYJwTnyA0F1uY7s9g+YxVG7vzvd/L63U 0/+bIzFi =Hn/R -----END PGP SIGNATURE----- --CpRwOJvrTIYkeTuO--