RFR: 8284437: Building from different users/workspace is not always deterministic [v2]

Maxim Kartashev duke at openjdk.java.net
Fri Apr 8 13:55:45 UTC 2022


On Fri, 8 Apr 2022 13:23:23 GMT, Andrew Leonard <aleonard at openjdk.org> wrote:

> I can't seem to find any online assembly documentation(?) that states that a .file symbol pointing to the absolute object file name is produced, but it obviously does! In fact maybe it's to do with how the linker generates them, as using relative path for the link changed it...?

@andrew-m-leonard 

Well, I also didn't take this idea from the documentation, but having previously worked on assemblers I thought this plausible. After all, the assembler has to provide *some* value for the  `STT_FILE` symbol, why not take literally whatever the user specified in the `.file` directive?

> Will that not affect the ability to debug these files, as GDB won't know where to find source files

@erikj79 

First, we should remember that these are assembly files, so even total absence of the source code wouldn't hurt a lot (apart from comments, of which there is little). 

Having said that, there's no reason to willingly give up on the on the ability of the debugger to find the corresponding source code. The value of `STT_FILE` is the last resort of the debugger (`dbx` uses it, but I'm not even sure that `gdb` does). The primary source of this info is the value of `DW_AT_name` of `DW_TAG_compile_unit` in the file's DWARF `.debug_info` section. For instance, this is what I'm currently getting in the release build:

build/linux-x86_64-server-release/hotspot/variant-server/libjvm/objs/linux_x86_64.o:	file format ELF64-x86-64

.debug_info contents:
0x00000000: Compile Unit: length = 0x0000002a version = 0x0002 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x0000002e)

0x0000000b: DW_TAG_compile_unit
              DW_AT_stmt_list	(0x00000000)
              DW_AT_low_pc	(0x0000000000000000)
              DW_AT_high_pc	(0x0000000000000423)
              DW_AT_name	("/home/work/work/OpenJDK/jdk/src/hotspot/os_cpu/linux_x86/linux_x86_64.S")
              DW_AT_comp_dir	("/home/work/work/OpenJDK/jdk/make/hotspot")
              DW_AT_producer	("GNU AS 2.34")
              DW_AT_language	(DW_LANG_Mips_Assembler)


This `DW_AT_name` better not change to just `linux_x86_64.S` or else `STT_FILE` wouldn't help even if it contained the absolute path.

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

PR: https://git.openjdk.java.net/jdk/pull/8124



More information about the build-dev mailing list