[Dwarf-Discuss] Asm syntax for DWARF 5 line table info

paul.robinson at sony.com paul.robinson at sony.com
Thu Jun 14 15:40:23 PDT 2018

I have been working on adding DWARF 5 support to LLVM, and some of
that support requires some assembler syntax tweaks.  It has been
suggested that I publicize those tweaks outside of the LLVM world, 
and this list seems like the most likely place to find the people 
who would be most interested in agreeing on a common syntax.  I'll
assume people know or can easily look up the DWARF features I'm
talking about.

The two line-table features that require assembler syntax tweaks are:
(a) in the file table, adding the MD5 checksum of the source file;
(b) adding the "root" file explicitly to the file table (aka "file 0").

The LLVM assembler believes that the existing syntax for the DWARF form
of the .file directive is:
    .file filenumber [ "directory" ] "path"
where filenumber is a positive number >= 1 to be used by the .loc
directives to identify the source file for instructions.

I propose to add a new optional clause to the .file directive, like so:

    .file filenumber [ "directory" ] "path" [ md5 checksum ]

where md5 is a keyword and checksum is the integer checksum,
typically expressed as a hex 128-bit value.

If all .file directives provide an md5 checksum, then the assembler
will put that checksum into the DWARF 5 file table.  (If the 
compiler is compiling a preprocessed file, it won't necessarily be
able to provide an MD5 checksum of the original file. This is much
the same argument against having the assembler compute the MD5
checksum itself; it doesn't know that it's actually the same file.)

As a second tweak, I propose that the filenumber may be 0, in which
case the directive specifies the root file and those parameters are 
used for file entry #0.  If no ".file 0" is seen, then the assembler 
will use file #1 as the zeroth file-table entry (so that file will 
be described twice, using both file #0 and file #1).

This is all implemented in LLVM trunk currently, so there are two
questions to ask:
(1) Has your assembler implemented the necessary features differently?
(2) If not, are you okay with the changes I described above?


More information about the Dwarf-Discuss mailing list