diff mbox series

[u-boot,11/39] binman: declare symbols externally visible

Message ID 20210307042538.21229-12-marek.behun@nic.cz
State Superseded
Delegated to: Tom Rini
Headers show
Series U-Boot LTO (Sandbox + Some ARM boards) | expand

Commit Message

Marek Behún March 7, 2021, 4:25 a.m. UTC
Use the `externally_visible` attribute to declare binman symbols
externally visible, so that when building with LTO the compiler does not
optimize this data away.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
---
 include/binman_sym.h | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Marek Behún March 7, 2021, 4:59 a.m. UTC | #1
I forgot to drop this patch. It is not needed, please ignore it.

Marek
Bin Meng March 8, 2021, 7:47 a.m. UTC | #2
Hi Marek,

On Sun, Mar 7, 2021 at 12:59 PM Marek Behun <marek.behun@nic.cz> wrote:
>
> I forgot to drop this patch. It is not needed, please ignore it.
>

Why is this not needed anymore?

Regards,
Bin
Marek Behún March 8, 2021, 9:26 a.m. UTC | #3
On Mon, 8 Mar 2021 15:47:38 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:

> Hi Marek,
> 
> On Sun, Mar 7, 2021 at 12:59 PM Marek Behun <marek.behun@nic.cz> wrote:
> >
> > I forgot to drop this patch. It is not needed, please ignore it.
> >  
> 
> Why is this not needed anymore?

It was not needed at all, binman does not fail when its symbols are not
explicitly declared to be visible.
Bin Meng March 8, 2021, 10:31 a.m. UTC | #4
On Mon, Mar 8, 2021 at 5:26 PM Marek Behun <marek.behun@nic.cz> wrote:
>
> On Mon, 8 Mar 2021 15:47:38 +0800
> Bin Meng <bmeng.cn@gmail.com> wrote:
>
> > Hi Marek,
> >
> > On Sun, Mar 7, 2021 at 12:59 PM Marek Behun <marek.behun@nic.cz> wrote:
> > >
> > > I forgot to drop this patch. It is not needed, please ignore it.
> > >
> >
> > Why is this not needed anymore?
>
> It was not needed at all, binman does not fail when its symbols are not
> explicitly declared to be visible.

Then why was it needed in the previous patch? Or is this due to
undeterminism of LTO?

Regards,
Bin
Marek Behún March 8, 2021, 11:07 a.m. UTC | #5
On Mon, 8 Mar 2021 18:31:26 +0800
Bin Meng <bmeng.cn@gmail.com> wrote:

> On Mon, Mar 8, 2021 at 5:26 PM Marek Behun <marek.behun@nic.cz> wrote:
> >
> > On Mon, 8 Mar 2021 15:47:38 +0800
> > Bin Meng <bmeng.cn@gmail.com> wrote:
> >  
> > > Hi Marek,
> > >
> > > On Sun, Mar 7, 2021 at 12:59 PM Marek Behun <marek.behun@nic.cz> wrote:  
> > > >
> > > > I forgot to drop this patch. It is not needed, please ignore it.
> > > >  
> > >
> > > Why is this not needed anymore?  
> >
> > It was not needed at all, binman does not fail when its symbols are not
> > explicitly declared to be visible.  
> 
> Then why was it needed in the previous patch? Or is this due to
> undeterminism of LTO?

It wasn't needed. I did not test binman then, I just grepped for all
occurances of __attribute__, found occurances where it looked like it
would break LTO and applied, just to be sure.
diff mbox series

Patch

diff --git a/include/binman_sym.h b/include/binman_sym.h
index 72e6765fe5..f9c0e681c9 100644
--- a/include/binman_sym.h
+++ b/include/binman_sym.h
@@ -34,7 +34,8 @@ 
  */
 #define binman_sym_declare(_type, _entry_name, _prop_name) \
 	_type binman_symname(_entry_name, _prop_name) \
-		__attribute__((aligned(4), unused, section(".binman_sym")))
+		__attribute__((aligned(4), unused, externally_visible, \
+		section(".binman_sym")))
 
 /**
  * binman_sym_extern() - Declare a extern symbol that will be used at run-time
@@ -59,7 +60,7 @@ 
  */
 #define binman_sym_declare_optional(_type, _entry_name, _prop_name) \
 	_type binman_symname(_entry_name, _prop_name) \
-		__attribute__((aligned(4), weak, unused, \
+		__attribute__((aligned(4), weak, unused, externally_visible \
 		section(".binman_sym")))
 
 /**