[Buildroot] [PATCH] package/gcc/gcc-final: map debug prefix when reproducible

John Keeping john at metanate.com
Tue Feb 7 20:05:17 UTC 2023


Hi Yann,

On Tue, Feb 07, 2023 at 02:55:03PM +0100, Yann E. MORIN wrote:
> On 2023-02-06 16:26 +0000, John Keeping spake thusly:
> > When building with BR2_REPRODUCIBLE the toolchain wrapper passes
> > -fdebug-prefix-map for all packages that are built.  But this doesn't
> > affect the target libraries (like libgcc) built by GCC's build system.
> > 
> > GCC 4.3 added a configure option to set the debug prefix map for these
> > libraries, which is used here to avoid encoding potentially
> > non-reproducible build paths into the debug data.
> 
> Thanks, this is indeed very interesting. We (briefly) discussed this at
> the developers day minutes ago, and the question that was brought up
> was: why is not needed for the first-stage compiler?
> 
> Indeed, the first-stage compiler builds objects files that are then used
> by the C library, we would expect the debug symbols for those to also
> need prefix mapping.
> 
> Could you look into that, and either pass the option to both the initial
> and final gcc if needed, or explain in the commit log why it is not
> needed for the initial gcc, please?

I've just sent v2 which moves this to HOST_GCC_COMMON_CONF_OPTS.

You're right that some files are affected by the initial compiler - I
missed it by focusing on executables (nearly all of which link libgcc.a)
when the initial compiler only affects some of glibc's shared objects.

I've been testing this with --enable-linker-build-id in the configure
options as well to see whether it's possible to enable build IDs for
reproducible builds and this change gets a lot closer - the differences
are now a handful of files that embed an RPATH pointing to .libs during
the build.


John



More information about the buildroot mailing list