RFR: 8284437: Building from different users/workspace is not always deterministic [v2]
Magnus Ihse Bursie
ihse at openjdk.java.net
Fri Apr 8 08:34:43 UTC 2022
On Fri, 8 Apr 2022 08:14:18 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:
>> It would certainly be possible to identify the objects created from assembly source files based on file extensions, but it wouldn't help. The command line would still be dependent on the current working directory (correctly guessed!) if just one of the argument files is relative.
>>
>> The property Magnus is trying to preserve is to be able to copy a command line from the build log and run it in whichever directory you happen to be in, without having to figure out what the CWD was for that particular command. We worked hard to try to figure out ways of preserving that as much as possible, but as you say, if we want true reproducibility, then we have to give it up for link command lines where assembly source files are included.
>>
>> Now I realize that you aren't even checking if the link unit contains any objects from assembly files. I think we should be able to deduce that by filtering on the extension in the source file list. That would miss assembly input in EXTRA_OBJS, so perhaps we need an explicit parameter to SetupNativeCompilation for cases where this would happen. I think it applies to gtest, where we add all the object files from libjvm.
>
> One way would be to check if we have either assembly source files, or anything in EXTRA_OBJ, and if so, do the relative linking. That would at least bring down collateral damage significantly, since the majority of libs have neither.
>
> It will still hurt the most important libs (like hotspot) but unless we can't find a way to get this working in some other way, it seems we'll have to accept that.
>
> @andrew-m-leonard Do you know if there is any bug on gcc tracking their inability to set debug prefix mapping for assembly files?
Actually, I think that the GNU assembler supports debug prefix mapping. See e.g. [this bug report](https://github.com/ocaml/ocaml/issues/10770), stating: "With GNU tools, to enable debug prefix map on C source we pass -fdebug-prefix-map to cc and --debug-prefix-map to as."
@andrew-m-leonard Can you check if we can pass `--debug-prefix-map` to the assembler if on the gcc toolchain, and thus get rid of the relative linking? (And oh, speaking of that, the if statement here checks for target OS. It should, most likely, have checked for toolchain.)
-------------
PR: https://git.openjdk.java.net/jdk/pull/8124
More information about the build-dev
mailing list