From: Tom Rini <trini@konsulko.com>
To: Alper Nebi Yasak <alpernebiyasak@gmail.com>
Cc: Peng Fan <peng.fan@nxp.com>,
"Peng Fan (OSS)" <peng.fan@oss.nxp.com>,
"sbabic@denx.de" <sbabic@denx.de>,
"festevam@gmail.com" <festevam@gmail.com>,
"ariel.dalessandro@collabora.com"
<ariel.dalessandro@collabora.com>,
"michael@amarulasolutions.com" <michael@amarulasolutions.com>,
"tharvey@gateworks.com" <tharvey@gateworks.com>,
"sjg@chromium.org" <sjg@chromium.org>,
"marek.behun@nic.cz" <marek.behun@nic.cz>,
"pali@kernel.org" <pali@kernel.org>, "sr@denx.de" <sr@denx.de>,
Ricardo Salveti <ricardo@foundries.io>,
"patrick.delaunay@foss.st.com" <patrick.delaunay@foss.st.com>,
"u-boot@lists.denx.de" <u-boot@lists.denx.de>
Subject: Re: [PATCH V4 1/8] spl: guard u_boot_any with X86
Date: Sun, 22 May 2022 10:50:11 -0400 [thread overview]
Message-ID: <20220522145011.GK13239@bill-the-cat> (raw)
In-Reply-To: <fad08e73-f437-181b-7098-0a8e88dfd2b0@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2645 bytes --]
On Sun, May 22, 2022 at 04:56:08PM +0300, Alper Nebi Yasak wrote:
> On 21/05/2022 15:05, Tom Rini wrote:
> > On Sat, May 21, 2022 at 08:33:56AM +0000, Peng Fan wrote:
> >>> Subject: Re: [PATCH V4 1/8] spl: guard u_boot_any with X86
> >>>
> >>> On Fri, May 20, 2022 at 10:10:40PM +0800, Peng Fan (OSS) wrote:
> >>>
> >>>> From: Peng Fan <peng.fan@nxp.com>
> >>>>
> >>>> set the symbol as weak not work if LTO is enabled. Since u_boot_any is
> >>>> only used on X86 for now, so guard it with X86, otherwise build break
> >>>> if we use BINMAN_SYMBOLS on i.MX.
> >>>>
> >>>> Tested-by: Tim Harvey <tharvey@gateworks.com> #imx8m[m,n,p]-venice
> >>>> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> >>>> ---
> >>>> common/spl/spl.c | 8 ++++++--
> >>>> common/spl/spl_ram.c | 4 ++++
> >>>> 2 files changed, 10 insertions(+), 2 deletions(-)
> >>>
> >>> I think we long term need to figure this out and address it so LTO works. But
> >>> for now can you please guard this with a test on LTO instead, so it's clear
> >>> where the problem is?
> >>
> >> Sorry, I could not get your point about guard with a test on LTO.
> >>
> >> Actually binman weak symbol will report a warning log if there is no u_boot_any
> >> binman symbol. Since only X86 use it, I guard with X86.
> >
> > Why are you mentioning LTO in the commit message? When I read the
> > commit message it sounds like you're saying the problem is that LTO
> > doesn't like how this symbol is handled, but if LTO was disabled,
> > everything would be fine. If it's not LTO-related, please re-word the
> > message instead.
>
> It looks like we should be able to change things in common/spl/spl.c to:
>
> #if CONFIG_IS_ENABLED(BINMAN_SYMBOLS)
> /* See spl.h for information about this */
> binman_sym_declare_optional(ulong, u_boot_any, image_pos);
> binman_sym_declare_optional(ulong, u_boot_any, size);
> #endif
>
> which would mark the symbol as 'weak' and turn the error into a warning
> on the binman side. But that is somehow being undone by LTO.
So, looking at binman_sym_declare_optional we tell the linker that it's
weak and might even be unused. LTO gets very aggressive about finding
things that aren't used in the resulting binary and discarding them.
Typically we have the problem of a function that is used but it's hard
for LTO to see it, so we give it the "used" attribute. But for
something we're already saying is "unused" this would be wrong. So why
do we mark things as unused here? I assume it's marked weak as it could
be overridden at link time by a definition elsewhere.
--
Tom
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2022-05-22 14:50 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-20 14:10 [PATCH V4 0/8] arm64: binman: use binman symbols for imx Peng Fan (OSS)
2022-05-20 14:10 ` [PATCH V4 1/8] spl: guard u_boot_any with X86 Peng Fan (OSS)
2022-05-20 15:21 ` Tom Rini
2022-05-21 8:33 ` Peng Fan
2022-05-21 12:05 ` Tom Rini
2022-05-22 13:56 ` Alper Nebi Yasak
2022-05-22 14:50 ` Tom Rini [this message]
2022-05-23 21:10 ` Alper Nebi Yasak
2022-05-23 6:19 ` Peng Fan (OSS)
2022-05-23 6:28 ` Peng Fan (OSS)
2022-05-23 14:10 ` Tom Rini
2022-05-23 21:10 ` Alper Nebi Yasak
2022-05-22 13:55 ` Alper Nebi Yasak
2022-05-20 14:10 ` [PATCH V4 2/8] arm: dts: imx8m: update binman ddr firmware node name Peng Fan (OSS)
2022-05-22 13:56 ` Alper Nebi Yasak
2022-05-23 7:01 ` Peng Fan (OSS)
2022-05-23 21:11 ` Alper Nebi Yasak
2022-05-20 14:10 ` [PATCH V4 3/8] imx: imx8mm-icore: migrate to use BINMAN Peng Fan (OSS)
2022-05-22 13:56 ` Alper Nebi Yasak
2022-05-23 7:02 ` Peng Fan (OSS)
2022-05-20 14:10 ` [PATCH V4 4/8] armv8: u-boot-spl.lds: mark __image_copy_start as symbol Peng Fan (OSS)
2022-05-20 15:21 ` Tom Rini
2022-05-20 14:10 ` [PATCH V4 5/8] tools: binman: section: replace @ with - Peng Fan (OSS)
2022-05-22 13:57 ` Alper Nebi Yasak
2022-05-23 7:05 ` Peng Fan (OSS)
2022-05-20 14:10 ` [PATCH V4 6/8] ddr: imx8m: helper: load ddr firmware according to binman symbols Peng Fan (OSS)
2022-05-22 13:57 ` Alper Nebi Yasak
2022-05-23 7:08 ` Peng Fan (OSS)
2022-05-20 14:10 ` [PATCH V4 7/8] arm: dts: imx8m: shrink ddr firmware size to actual file size Peng Fan (OSS)
2022-05-23 21:12 ` Alper Nebi Yasak
2022-05-24 5:50 ` Michael Nazzareno Trimarchi
2022-05-20 14:10 ` [PATCH V4 8/8] binman_sym: guard with CONFIG_SPL_BINMAN_SYMBOLS Peng Fan (OSS)
2022-05-22 13:57 ` Alper Nebi Yasak
2022-05-23 7:10 ` Peng Fan (OSS)
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=20220522145011.GK13239@bill-the-cat \
--to=trini@konsulko.com \
--cc=alpernebiyasak@gmail.com \
--cc=ariel.dalessandro@collabora.com \
--cc=festevam@gmail.com \
--cc=marek.behun@nic.cz \
--cc=michael@amarulasolutions.com \
--cc=pali@kernel.org \
--cc=patrick.delaunay@foss.st.com \
--cc=peng.fan@nxp.com \
--cc=peng.fan@oss.nxp.com \
--cc=ricardo@foundries.io \
--cc=sbabic@denx.de \
--cc=sjg@chromium.org \
--cc=sr@denx.de \
--cc=tharvey@gateworks.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