RFR: 8326685: Linux builds not reproducible if two builds configured in different build folders

Erik Joelsson erikj at openjdk.org
Mon Feb 26 19:29:45 UTC 2024


On Mon, 26 Feb 2024 16:00:42 GMT, Andrew Leonard <aleonard at openjdk.org> wrote:

> Adds Linux -fdebug-prefix-map'ing for SUPPORT_OUTPUTDIR and HOTSPOT_OUTPUTDIR when absolute paths are not allowed in the binaries, thus making the building of a JDK identically reproducible from different build directories.

make/autoconf/flags-cflags.m4 line 126:

> 124:             DEBUG_PREFIX_MAP_GCC_INCLUDE_PATHS
> 125:             DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS -fdebug-prefix-map=\$(SUPPORT_OUTPUTDIR)/="
> 126:             DEBUG_PREFIX_CFLAGS="$DEBUG_PREFIX_CFLAGS -fdebug-prefix-map=\$(HOTSPOT_OUTPUTDIR)/="

This is only a problem if the build directory is located outside the workspace root. In the case where the build directory is inside the root, I think it would be preferable to stick to just the one prefix map, for consistent relative paths for all affected files. If the build directory is outside, like in your example, I would suggest adding just `$(OUTPUTDIR)/=` to both `-fdebug-prefix-map` and `-fmacro-prefix-map` for consistency. We don't seem to have a variable indicating if the OUTPUTDIR is inside WORKSPACE_ROOT or not, but we can add one in basic.m4 where the OUTPUTDIR is initialized. Then you can conditionally add the extra prefix maps based on that variable.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/18009#discussion_r1503181748


More information about the build-dev mailing list