On Fri, 8 Apr 2022 14:11:56 GMT, Magnus Ihse Bursie <[email protected]> wrote:
>> I did some experiments both with `gcc` and `clang`. Both respect the `.file`
>> directive and put into the resulting ELF whatever was written after that
>> keyword, so no path mapping is necessary. However, debug information suffers
>> because `gcc` puts the exact same string into DWARF that debuggers need, so
>> writing
>>
>> .file "linux_x86_64.S"
>>
>> gives you `DW_AT_NAME("linux_x86_64.S")`, which is not very useful (BTW,
>> `clang` accurately points to the absolute path name of the source file) . So
>> you have to use the relative path name there:
>>
>> .file "src/hotspot/os_cpu/linux_x86/linux_x86_64.S"
>
> @mkartashev Why don't you try building with clang as two different users, in
> two different directories, and see if the build is non-reproducible without
> this patch, but is reproducible with it (incl. your suggested change to
> include clang as well)?
@magicus
> Is it possible to pass the ".file" directive on the command line?
I don't think so. Your other idea works quite well, though. If you have this in
the source
.file THIS_FILE
and you specify this on the command line
-DTHIS_FILE='"src/hotspot/os_cpu/linux_x86/linux_x86_64.S"'
you get the same reproducible and debuggable result.
-------------
PR: https://git.openjdk.java.net/jdk/pull/8124