|Summary:||[DWARF-5] support for checksums in .file directives|
|Product:||binutils||Reporter:||Nick Desaulniers <ndesaulniers>|
|Component:||gas||Assignee:||Not yet assigned to anyone <unassigned>|
|Build:||Last reconfirmed:||2020-03-03 00:00:00|
Description Nick Desaulniers 2020-02-28 21:47:29 UTC
I was playing around trying to enable -gdwarf-5 in the Linux kernel, and hit an issue where it looks like clang is emitting .file directives like: .file 1 "/home/nick/linux/init/do_mounts.c" md5 0x62e8a195aa9d4d8b466f84b7775ea4cd with GAS producing errors like: do_mounts.s:19: Error: junk at end of line, first unrecognized character is `m' A quick grep through the DWARF-5 spec  doesn't mention anything about assembly directives. The docs on .file directives also doesn't mention this.  I assume this is maybe an extension that Clang implemented? IIUC, it's used by debuggers to tell when/if a file has been modified. Is this something that can be implemented in GNU as? I'm happy to also pursue a command line flag in Clang to disable the emission of these checksums. See also .  http://www.dwarfstd.org/doc/DWARF5.pdf  https://sourceware.org/binutils/docs/as/File.html#File  https://bugs.llvm.org/show_bug.cgi?id=45040
Comment 1 Nick Desaulniers 2020-02-28 22:47:51 UTC
Pawing more through the spec (previously linked), it looks like "1.4 Changes from Version 4 to Version 5" on pdf pg 26 kind of hints at this: 20 • Replace the line number program header format with a new format that 21 provides the ability to use an MD5 hash to validate the source file version in 22 use, allows pooling of directory and file name strings and makes provision 23 for vendor-defined extensions. Also add a string section specific to the line 24 number table (.debug_line_str) to properly support the common practice 25 of stripping all DWARF sections except for line number information.
Comment 2 Nick Desaulniers 2020-02-28 22:59:51 UTC
Also, documentation here would have to be updated. https://sourceware.org/binutils/docs/as/File.html#File
Comment 3 Nick Clifton 2020-03-03 13:39:51 UTC
Hi Nick, OK, so this looks like it would be a useful extension to support. I'll have a look at it in my copious free time (tm) unless of course you want to have a go yourself ? Cheers Nick
Comment 4 Nick Clifton 2020-03-11 10:25:58 UTC
Support for this feature has now been added to the assembler: commit 5496f3c635
Comment 5 firstname.lastname@example.org 2020-03-31 22:03:04 UTC
The master branch has been updated by Maciej W. Rozycki <email@example.com>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=876678f05e70235ed71d5b9ec63e4f6db1ec76e4 commit 876678f05e70235ed71d5b9ec63e4f6db1ec76e4 Author: Maciej W. Rozycki <firstname.lastname@example.org> Date: Tue Mar 31 23:01:36 2020 +0100 PR 25611, PR 25614: GAS: Remove a double inclusion of "bignum.h" Correct an issue with commit 5496f3c635dc ("Add support for generating DWARF-5 format directory and file name tables from the assembler.") and remove a duplicate direct inclusion of "bignum.h" from dwarf2dbg.c that causes a GAS compilation error: In file included from .../gas/dwarf2dbg.c:33: .../gas/bignum.h:42: error: redefinition of typedef 'LITTLENUM_TYPE' .../gas/bignum.h:42: error: previous declaration of 'LITTLENUM_TYPE' was here make: *** [dwarf2dbg.o] Error 1 with some GCC versions, as this header has been already included via "as.h" and then "flonum.h". gas/ PR 25611 PR 25614 * dwarf2dbg.c: Do not include "bignum.h".