All of lore.kernel.org
 help / color / mirror / Atom feed
* [master][PATCH 3/4] bitbake.conf: add DEBUG_PREFIX_MAP to TARGET_LDFLAGS
@ 2021-07-27 13:36 Tony Battersby
  2021-07-27 17:58 ` [OE-core] " Khem Raj
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Tony Battersby @ 2021-07-27 13:36 UTC (permalink / raw)
  To: openembedded-core; +Cc: randy.macleod

-f*-prefix-map flags are required when linking with LTO enabled to make
the output binary reproducible.

See discussion here:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101473

[YOCTO #14481]

Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
---

/usr/sbin/lspci from pciutils is a good program to test that shows how
adding -f*-prefix-map to LDFLAGS makes a program binary reproducible
with LTO enabled.

 meta/conf/bitbake.conf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
index 160abf40ee..c0d2e3f82f 100644
--- a/meta/conf/bitbake.conf
+++ b/meta/conf/bitbake.conf
@@ -595,7 +595,7 @@ TARGET_LINK_HASH_STYLE ?= "${@['-Wl,--hash-style=gnu',''][d.getVar('LINKER_HASH_
 ASNEEDED ?= "-Wl,--as-needed"
 
 export LDFLAGS = "${TARGET_LDFLAGS}"
-TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}"
+TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${DEBUG_PREFIX_MAP}"
 # mips does not support GNU hash style therefore we override
 LINKER_HASH_STYLE_mipsarch_libc-musl = "sysv"
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [OE-core] [master][PATCH 3/4] bitbake.conf: add DEBUG_PREFIX_MAP to TARGET_LDFLAGS
  2021-07-27 13:36 [master][PATCH 3/4] bitbake.conf: add DEBUG_PREFIX_MAP to TARGET_LDFLAGS Tony Battersby
@ 2021-07-27 17:58 ` Khem Raj
  2021-08-05 16:00 ` Richard Purdie
       [not found] ` <1698745FB6BE4CCB.3515@lists.openembedded.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Khem Raj @ 2021-07-27 17:58 UTC (permalink / raw)
  To: Tony Battersby, openembedded-core; +Cc: randy.macleod



On 7/27/21 6:36 AM, Tony Battersby wrote:
> -f*-prefix-map flags are required when linking with LTO enabled to make
> the output binary reproducible.
> 
> See discussion here:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101473
> 
> [YOCTO #14481]
> 

Looks ok

> Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
> ---
> 
> /usr/sbin/lspci from pciutils is a good program to test that shows how
> adding -f*-prefix-map to LDFLAGS makes a program binary reproducible
> with LTO enabled.
> 
>   meta/conf/bitbake.conf | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 160abf40ee..c0d2e3f82f 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -595,7 +595,7 @@ TARGET_LINK_HASH_STYLE ?= "${@['-Wl,--hash-style=gnu',''][d.getVar('LINKER_HASH_
>   ASNEEDED ?= "-Wl,--as-needed"
>   
>   export LDFLAGS = "${TARGET_LDFLAGS}"
> -TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}"
> +TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${DEBUG_PREFIX_MAP}"
>   # mips does not support GNU hash style therefore we override
>   LINKER_HASH_STYLE_mipsarch_libc-musl = "sysv"
>   
> 
> 
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] [master][PATCH 3/4] bitbake.conf: add DEBUG_PREFIX_MAP to TARGET_LDFLAGS
  2021-07-27 13:36 [master][PATCH 3/4] bitbake.conf: add DEBUG_PREFIX_MAP to TARGET_LDFLAGS Tony Battersby
  2021-07-27 17:58 ` [OE-core] " Khem Raj
@ 2021-08-05 16:00 ` Richard Purdie
       [not found] ` <1698745FB6BE4CCB.3515@lists.openembedded.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2021-08-05 16:00 UTC (permalink / raw)
  To: Tony Battersby, openembedded-core; +Cc: randy.macleod

[-- Attachment #1: Type: text/plain, Size: 2383 bytes --]

On Tue, 2021-07-27 at 09:36 -0400, Tony Battersby wrote:
> -f*-prefix-map flags are required when linking with LTO enabled to make
> the output binary reproducible.
> 
> See discussion here:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101473
> 
> [YOCTO #14481]
> 
> Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
> ---
> 
> /usr/sbin/lspci from pciutils is a good program to test that shows how
> adding -f*-prefix-map to LDFLAGS makes a program binary reproducible
> with LTO enabled.
> 
>  meta/conf/bitbake.conf | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> index 160abf40ee..c0d2e3f82f 100644
> --- a/meta/conf/bitbake.conf
> +++ b/meta/conf/bitbake.conf
> @@ -595,7 +595,7 @@ TARGET_LINK_HASH_STYLE ?= "${@['-Wl,--hash-style=gnu',''][d.getVar('LINKER_HASH_
>  ASNEEDED ?= "-Wl,--as-needed"
>  
> 
>  export LDFLAGS = "${TARGET_LDFLAGS}"
> -TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}"
> +TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${DEBUG_PREFIX_MAP}"
>  # mips does not support GNU hash style therefore we override
>  LINKER_HASH_STYLE_mipsarch_libc-musl = "sysv"
>  

This failed in testing in ruby:

https://autobuilder.yoctoproject.org/typhoon/#/builders/115/builds/514

The error is a bit obtuse but in summary, the file:

/tmp/work/core2-64-poky-linux/ruby/3.0.2-r0/sysroot-destdir/usr/lib/pkgconfig/ruby-3.0.pc

contained build paths as it adds LDFLAGS to the file with a line like:

DLDFLAGS=-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fmacro-prefix-map=/home/pokybuild/yocto-
worker/reproducible-centos/build/build-st/reproducibleA/tmp/work/core2-64-poky-linux/ruby/3.0.2-
r0=/usr/src/debug/ruby/3.0.2-r0 -fdebug-prefix-map=/home/pokybuild/yocto-worker/reproducible-
centos/build/build-st/reproducibleA/tmp/work/core2-64-poky-linux/ruby/3.0.2-r0=/usr/src/debug/ruby/3.0.2-r0 -
fdebug-prefix-map=/home/pokybuild/yocto-worker/reproducible-centos/build/build-
st/reproducibleA/tmp/work/core2-64-poky-linux/ruby/3.0.2-r0/recipe-sysroot= -fdebug-prefix-
map=/home/pokybuild/yocto-worker/reproducible-centos/build/build-st/reproducibleA/tmp/work/core2-64-poky-
linux/ruby/3.0.2-r0/recipe-sysroot-native= -Wl,-z,relro,-z,now -Wl,--compress-debug-sections=zlib

Cheers,

Richard


[-- Attachment #2: Type: text/html, Size: 3282 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [OE-core] [master][PATCH 3/4] bitbake.conf: add DEBUG_PREFIX_MAP to TARGET_LDFLAGS
       [not found] ` <1698745FB6BE4CCB.3515@lists.openembedded.org>
@ 2021-08-05 16:59   ` Richard Purdie
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Purdie @ 2021-08-05 16:59 UTC (permalink / raw)
  To: Tony Battersby, openembedded-core; +Cc: randy.macleod

On Thu, 2021-08-05 at 17:00 +0100, Richard Purdie via lists.openembedded.org wrote:
> On Tue, 2021-07-27 at 09:36 -0400, Tony Battersby wrote:
> > -f*-prefix-map flags are required when linking with LTO enabled to make
> > the output binary reproducible.
> > 
> > See discussion here:
> > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101473
> > 
> > [YOCTO #14481]
> > 
> > Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
> > ---
> > 
> > /usr/sbin/lspci from pciutils is a good program to test that shows how
> > adding -f*-prefix-map to LDFLAGS makes a program binary reproducible
> > with LTO enabled.
> > 
> >  meta/conf/bitbake.conf | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf
> > index 160abf40ee..c0d2e3f82f 100644
> > --- a/meta/conf/bitbake.conf
> > +++ b/meta/conf/bitbake.conf
> > @@ -595,7 +595,7 @@ TARGET_LINK_HASH_STYLE ?= "${@['-Wl,--hash-style=gnu',''][d.getVar('LINKER_HASH_
> >  ASNEEDED ?= "-Wl,--as-needed"
> >  
> > 
> >  export LDFLAGS = "${TARGET_LDFLAGS}"
> > -TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED}"
> > +TARGET_LDFLAGS = "-Wl,-O1 ${TARGET_LINK_HASH_STYLE} ${ASNEEDED} ${DEBUG_PREFIX_MAP}"
> >  # mips does not support GNU hash style therefore we override
> >  LINKER_HASH_STYLE_mipsarch_libc-musl = "sysv"
> >  
> 
> This failed in testing in ruby:
> 
> https://autobuilder.yoctoproject.org/typhoon/#/builders/115/builds/514
> 
> The error is a bit obtuse but in summary, the file:
> 
> /tmp/work/core2-64-poky-linux/ruby/3.0.2-r0/sysroot-destdir/usr/lib/pkgconfig/ruby-3.0.pc
> 

The fix for this looked relatively straight forward so I've queued a patch
in master-next for this.

Cheers,

Richard


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-08-05 16:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-27 13:36 [master][PATCH 3/4] bitbake.conf: add DEBUG_PREFIX_MAP to TARGET_LDFLAGS Tony Battersby
2021-07-27 17:58 ` [OE-core] " Khem Raj
2021-08-05 16:00 ` Richard Purdie
     [not found] ` <1698745FB6BE4CCB.3515@lists.openembedded.org>
2021-08-05 16:59   ` Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.