All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below for reproducibility
@ 2020-04-15 22:00 Brandon Maier
  2020-04-15 22:00 ` [Buildroot] [PATCH 2/2] toolchain/toolchain-wrapper: Omit absolute paths from debug symbols " Brandon Maier
  2022-01-08 13:49 ` [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below " Arnout Vandecappelle
  0 siblings, 2 replies; 3+ messages in thread
From: Brandon Maier @ 2020-04-15 22:00 UTC (permalink / raw)
  To: buildroot

In GCC8 the flag -ffile-prefix-map handles cleaning up both the __FILE__
macros and the debug info paths. In GCC7 or below we are manually
handling the __FILE__ macros, but not debug info paths. Use
-fdebug-prefix-map to clean them up.

See for more detail: https://reproducible-builds.org/docs/build-path/

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
 toolchain/toolchain-wrapper.mk | 1 +
 1 file changed, 1 insertion(+)

diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index 09dda17890..7d55050135 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -26,6 +26,7 @@ TOOLCHAIN_WRAPPER_OPTS += -Wl,--build-id=none
 ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
 TOOLCHAIN_WRAPPER_OPTS += -ffile-prefix-map=$(BASE_DIR)=buildroot
 else
+TOOLCHAIN_WRAPPER_OPTS += -fdebug-prefix-map=$(BASE_DIR)=buildroot
 TOOLCHAIN_WRAPPER_OPTS += -D__FILE__=\"\" -D__BASE_FILE__=\"\" -Wno-builtin-macro-redefined
 endif
 endif
-- 
2.25.1

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

* [Buildroot] [PATCH 2/2] toolchain/toolchain-wrapper: Omit absolute paths from debug symbols for reproducibility
  2020-04-15 22:00 [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below for reproducibility Brandon Maier
@ 2020-04-15 22:00 ` Brandon Maier
  2022-01-08 13:49 ` [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below " Arnout Vandecappelle
  1 sibling, 0 replies; 3+ messages in thread
From: Brandon Maier @ 2020-04-15 22:00 UTC (permalink / raw)
  To: buildroot

In GCC6 the compiler was made smarter to omit the flag
-fdebug-prefix-map from the DWARF DW_AT_producer section[1]. That flag
contains the absolute path '$(BASE_DIR)' which breaks reproducibility.
Prior to GCC6 however, the only way to omit the flag is to use
-gno-record-gcc-switches which omits all flags.

[1] https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=266cc0c181549c2fb6b50f8f26213cdc89101026

Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>
---
 toolchain/toolchain-wrapper.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
index 7d55050135..291366b093 100644
--- a/toolchain/toolchain-wrapper.mk
+++ b/toolchain/toolchain-wrapper.mk
@@ -29,6 +29,9 @@ else
 TOOLCHAIN_WRAPPER_OPTS += -fdebug-prefix-map=$(BASE_DIR)=buildroot
 TOOLCHAIN_WRAPPER_OPTS += -D__FILE__=\"\" -D__BASE_FILE__=\"\" -Wno-builtin-macro-redefined
 endif
+ifneq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_6),y)
+TOOLCHAIN_WRAPPER_OPTS += -gno-record-gcc-switches
+endif
 endif
 
 # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each flag is a
-- 
2.25.1

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

* Re: [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below for reproducibility
  2020-04-15 22:00 [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below for reproducibility Brandon Maier
  2020-04-15 22:00 ` [Buildroot] [PATCH 2/2] toolchain/toolchain-wrapper: Omit absolute paths from debug symbols " Brandon Maier
@ 2022-01-08 13:49 ` Arnout Vandecappelle
  1 sibling, 0 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2022-01-08 13:49 UTC (permalink / raw)
  To: Brandon Maier, buildroot
  Cc: matthew.weber, Romain Naour, Thomas Petazzoni, Thomas De Schampheleire



On 16/04/2020 00:00, Brandon Maier wrote:
> In GCC8 the flag -ffile-prefix-map handles cleaning up both the __FILE__
> macros and the debug info paths. In GCC7 or below we are manually
> handling the __FILE__ macros, but not debug info paths. Use
> -fdebug-prefix-map to clean them up.
> 
> See for more detail: https://reproducible-builds.org/docs/build-path/
> 
> Signed-off-by: Brandon Maier <brandon.maier@rockwellcollins.com>

  Both applied to master, thanks. Sorry it took so long for such a simple patch.

  Regards,
  Arnout

> ---
>   toolchain/toolchain-wrapper.mk | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/toolchain/toolchain-wrapper.mk b/toolchain/toolchain-wrapper.mk
> index 09dda17890..7d55050135 100644
> --- a/toolchain/toolchain-wrapper.mk
> +++ b/toolchain/toolchain-wrapper.mk
> @@ -26,6 +26,7 @@ TOOLCHAIN_WRAPPER_OPTS += -Wl,--build-id=none
>   ifeq ($(BR2_TOOLCHAIN_GCC_AT_LEAST_8),y)
>   TOOLCHAIN_WRAPPER_OPTS += -ffile-prefix-map=$(BASE_DIR)=buildroot
>   else
> +TOOLCHAIN_WRAPPER_OPTS += -fdebug-prefix-map=$(BASE_DIR)=buildroot
>   TOOLCHAIN_WRAPPER_OPTS += -D__FILE__=\"\" -D__BASE_FILE__=\"\" -Wno-builtin-macro-redefined
>   endif
>   endif
> 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

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

end of thread, other threads:[~2022-01-08 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-15 22:00 [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below for reproducibility Brandon Maier
2020-04-15 22:00 ` [Buildroot] [PATCH 2/2] toolchain/toolchain-wrapper: Omit absolute paths from debug symbols " Brandon Maier
2022-01-08 13:49 ` [Buildroot] [PATCH 1/2] toolchain/toolchain-wrapper: Handle debug info paths in gcc7 or below " Arnout Vandecappelle

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.