diff mbox series

[RFC,u-boot,05/12] binman: declare symbols externally visible

Message ID 20210303041211.26945-6-marek.behun@nic.cz
State RFC
Delegated to: Tom Rini
Headers show
Series U-Boot LTO (Sandbox + ARM Nokia RX-51) | expand

Commit Message

Marek Behún March 3, 2021, 4:12 a.m. UTC
Use the `__visible` macro 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.h     | 1 +
 include/binman_sym.h | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

Comments

Tom Rini March 4, 2021, 12:37 a.m. UTC | #1
On Wed, Mar 03, 2021 at 05:12:04AM +0100, Marek Behún wrote:

> Use the `__visible` macro 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.h     | 1 +
>  include/binman_sym.h | 4 ++--
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/include/binman.h b/include/binman.h
> index 5958dfb448..e72e85d4b7 100644
> --- a/include/binman.h
> +++ b/include/binman.h
> @@ -9,6 +9,7 @@
>  #ifndef _BINMAN_H_
>  #define _BINMAN_H_
>  
> +#include <linux/compiler.h>
>  #include <dm/ofnode.h>
>  
>  /**
> diff --git a/include/binman_sym.h b/include/binman_sym.h
> index 72e6765fe5..55421f5893 100644
> --- a/include/binman_sym.h
> +++ b/include/binman_sym.h
> @@ -33,7 +33,7 @@
>   * @_prop_name: Property value to get from that entry (e.g. 'pos')
>   */
>  #define binman_sym_declare(_type, _entry_name, _prop_name) \
> -	_type binman_symname(_entry_name, _prop_name) \
> +	_type binman_symname(_entry_name, _prop_name) __visible \
>  		__attribute__((aligned(4), unused, section(".binman_sym")))
>  
>  /**
> @@ -58,7 +58,7 @@
>   * @_prop_name: Property value to get from that entry (e.g. 'pos')
>   */
>  #define binman_sym_declare_optional(_type, _entry_name, _prop_name) \
> -	_type binman_symname(_entry_name, _prop_name) \
> +	_type binman_symname(_entry_name, _prop_name) __visible \
>  		__attribute__((aligned(4), weak, unused, \
>  		section(".binman_sym")))

I see failure to run test suites:
https://source.denx.de/u-boot/u-boot/-/jobs/232926
and adding <linux/compiler.h> to binman_sym.h leads to the same problem.
Marek Behún March 4, 2021, 1:53 a.m. UTC | #2
On Wed, 3 Mar 2021 19:37:09 -0500
Tom Rini <trini@konsulko.com> wrote:

> On Wed, Mar 03, 2021 at 05:12:04AM +0100, Marek Behún wrote:
> 
> > Use the `__visible` macro 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.h     | 1 +
> >  include/binman_sym.h | 4 ++--
> >  2 files changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/include/binman.h b/include/binman.h
> > index 5958dfb448..e72e85d4b7 100644
> > --- a/include/binman.h
> > +++ b/include/binman.h
> > @@ -9,6 +9,7 @@
> >  #ifndef _BINMAN_H_
> >  #define _BINMAN_H_
> >  
> > +#include <linux/compiler.h>
> >  #include <dm/ofnode.h>
> >  
> >  /**
> > diff --git a/include/binman_sym.h b/include/binman_sym.h
> > index 72e6765fe5..55421f5893 100644
> > --- a/include/binman_sym.h
> > +++ b/include/binman_sym.h
> > @@ -33,7 +33,7 @@
> >   * @_prop_name: Property value to get from that entry (e.g. 'pos')
> >   */
> >  #define binman_sym_declare(_type, _entry_name, _prop_name) \
> > -	_type binman_symname(_entry_name, _prop_name) \
> > +	_type binman_symname(_entry_name, _prop_name) __visible \
> >  		__attribute__((aligned(4), unused, section(".binman_sym")))
> >  
> >  /**
> > @@ -58,7 +58,7 @@
> >   * @_prop_name: Property value to get from that entry (e.g. 'pos')
> >   */
> >  #define binman_sym_declare_optional(_type, _entry_name, _prop_name) \
> > -	_type binman_symname(_entry_name, _prop_name) \
> > +	_type binman_symname(_entry_name, _prop_name) __visible \
> >  		__attribute__((aligned(4), weak, unused, \
> >  		section(".binman_sym")))  
> 
> I see failure to run test suites:
> https://source.denx.de/u-boot/u-boot/-/jobs/232926
> and adding <linux/compiler.h> to binman_sym.h leads to the same problem.
> 

I have this fixed in CI already. There is new version of these patches
there.
diff mbox series

Patch

diff --git a/include/binman.h b/include/binman.h
index 5958dfb448..e72e85d4b7 100644
--- a/include/binman.h
+++ b/include/binman.h
@@ -9,6 +9,7 @@ 
 #ifndef _BINMAN_H_
 #define _BINMAN_H_
 
+#include <linux/compiler.h>
 #include <dm/ofnode.h>
 
 /**
diff --git a/include/binman_sym.h b/include/binman_sym.h
index 72e6765fe5..55421f5893 100644
--- a/include/binman_sym.h
+++ b/include/binman_sym.h
@@ -33,7 +33,7 @@ 
  * @_prop_name: Property value to get from that entry (e.g. 'pos')
  */
 #define binman_sym_declare(_type, _entry_name, _prop_name) \
-	_type binman_symname(_entry_name, _prop_name) \
+	_type binman_symname(_entry_name, _prop_name) __visible \
 		__attribute__((aligned(4), unused, section(".binman_sym")))
 
 /**
@@ -58,7 +58,7 @@ 
  * @_prop_name: Property value to get from that entry (e.g. 'pos')
  */
 #define binman_sym_declare_optional(_type, _entry_name, _prop_name) \
-	_type binman_symname(_entry_name, _prop_name) \
+	_type binman_symname(_entry_name, _prop_name) __visible \
 		__attribute__((aligned(4), weak, unused, \
 		section(".binman_sym")))