public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: u-boot@lists.denx.de
Subject: [PATCH v2 3/3] kbuild: SPL/TPL: generate separate asm-offsets.h for SPL and TPL
Date: Tue, 28 Apr 2020 15:44:14 -0400	[thread overview]
Message-ID: <20200428194414.GG4468@bill-the-cat> (raw)
In-Reply-To: <CAK7LNAQLHNHhKMk3iFNhaGDaG76n6nRBg+r+8boSD83V+2miFg@mail.gmail.com>

On Wed, Apr 29, 2020 at 12:20:46AM +0900, Masahiro Yamada wrote:
> On Wed, Apr 29, 2020 at 12:01 AM Bin Meng <bmeng.cn@gmail.com> wrote:
> >
> > Hi Tom,
> >
> > On Tue, Apr 28, 2020 at 10:46 PM Tom Rini <trini@konsulko.com> wrote:
> > >
> > > On Mon, Apr 27, 2020 at 10:50:48PM +0800, Bin Meng wrote:
> > > > Hi Tom,
> > > >
> > > > On Mon, Apr 27, 2020 at 9:37 PM Tom Rini <trini@konsulko.com> wrote:
> > > > >
> > > > > On Mon, Apr 27, 2020 at 09:37:28AM +0800, Bin Meng wrote:
> > > > > > Hi Tom,
> > > > > >
> > > > > > On Sat, Apr 18, 2020 at 8:37 PM Bin Meng <bmeng.cn@gmail.com> wrote:
> > > > > > >
> > > > > > > On Fri, Apr 17, 2020 at 3:22 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
> > > > > > > >
> > > > > > > > Currently generic-asm-offsets.h and asm-offsets.h are generated based
> > > > > > > > on U-Boot proper config options. The same asm-offsets headers are used
> > > > > > > > for building U-Boot SPL/TPL, which causes potential offset mismatch if
> > > > > > > > U-Boot proper has different config options from U-Boot SPL/TPL.
> > > > > > > >
> > > > > > > > This commit adds:
> > > > > > > >   spl/include/generated/(generic-)asm-offsets.h
> > > > > > > >   tpl/include/generated/(generic-)asm-offsets.h
> > > > > > > >
> > > > > > > > spl/include/generated/(generic-)asm-offsets.h is generated if
> > > > > > > > CONFIG_SPL=y, and included when building SPL.
> > > > > > > >
> > > > > > > > tpl/include/generated/(generic-)asm-offsets.h is generated if
> > > > > > > > CONFIG_TPL=y, and included when building TPL.
> > > > > > > >
> > > > > > > > They are created before Kbuild descends into SPL/TPL object directories
> > > > > > > > and builds $(obj)/dts/dt-platdata.o because $(obj)/dts/dt-platdata.c
> > > > > > > > includes a bunch of headers.
> > > > > > > >
> > > > > > > > Prepend -I$(obj)/include to $(UBOOTINCLUDE) so (generic-)asm-offsets.h
> > > > > > > > is searched in {spl,tpl}/include/generated/.
> > > > > > > >
> > > > > > > > Requested-by: Bin Meng <bmeng.cn@gmail.com>
> > > > > > > > Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
> > > > > > > > ---
> > > > > > > >
> > > > > > > > Changes in v2: None
> > > > > > > >
> > > > > > > >  Kbuild               |  4 ++--
> > > > > > > >  scripts/Makefile.spl | 10 ++++++++--
> > > > > > > >  2 files changed, 10 insertions(+), 4 deletions(-)
> > > > > > > >
> > > > > > >
> > > > > > > It works like a charm. Thanks!
> > > > > > >
> > > > > > > Tested-by: Bin Meng <bmeng.cn@gmail.com>
> > > > > >
> > > > > > It looks only patch 1 and 2 in this series were applied. This patch was missed.
> > > > >
> > > > > So, I was going to ask and forgot, sorry.  Why do we need to have these
> > > > > differ between TPL/SPL/U-Boot itself, and then why is that good?  I
> > > >
> > > > Because currently the offsets
> > > > {spl,tpl}/include/generated/(generic-)asm-offsets.h are generated per
> > > > the U-Boot config options. But SPL and TPL are not guaranteed to have
> > > > the same config options.
> > > >
> > > > For example it's possible to have SPL/TPL turned on
> > > > {SPL,TPL}_CONFIG_XXX but U-Boot to turn off CONFIG_XXX, or vice verse.
> > > >
> > > > To me this is more like a bug fix other than a feature.
> > >
> > > Ah, OK.  But shouldn't we make sure that asm-offsets are consistent
> > > between SPL/TPL/U-Boot?  Or is there a use-case where it makes sense for
> > > them to differ intentionally?
> 
> Maybe, save memory for SPL/TPL ?
> We can say "do not do that", but it is fragile.
> 
> People are adding #ifdef around to all sort of structs,
> and it is difficult to guess which ones are used to
> construct asm-offsets.

So, you're right.  I'm doing a build now to check the differences, but
fairly often SPL and TPL disagree here, related to malloc and similar it
looks like.  So this is a bug-fix and I'll apply it shortly.  Thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200428/802957f9/attachment.sig>

  reply	other threads:[~2020-04-28 19:44 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17  7:21 [PATCH v2 0/3] support separate asm-offsets.h for SPL and TPL Masahiro Yamada
2020-04-17  7:21 ` [PATCH v2 1/3] kbuild: add FORCE to dependency of $(obj)/dts/dt-platdata.o Masahiro Yamada
2020-04-26 11:27   ` Tom Rini
2020-04-17  7:21 ` [PATCH v2 2/3] kbuild: cherry-pick kbuild changes from Linux Masahiro Yamada
2020-04-26 11:27   ` Tom Rini
2020-04-17  7:21 ` [PATCH v2 3/3] kbuild: SPL/TPL: generate separate asm-offsets.h for SPL and TPL Masahiro Yamada
2020-04-18 12:37   ` Bin Meng
2020-04-27  1:37     ` Bin Meng
2020-04-27 13:36       ` Tom Rini
2020-04-27 14:50         ` Bin Meng
2020-04-28 14:46           ` Tom Rini
2020-04-28 15:01             ` Bin Meng
2020-04-28 15:14               ` Tom Rini
2020-04-28 15:20               ` Masahiro Yamada
2020-04-28 19:44                 ` Tom Rini [this message]
2020-04-29 12:48   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200428194414.GG4468@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox