[llvm-dev] [DWARFv5] Assembler syntax for new line-table features

via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 29 10:16:47 PDT 2018


>> To pass the MD5 checksum to the assembler, I added a new optional
>> clause to the .file directive:
>> md5 "checksum"
>> where checksum is the 16-byte checksum in hex.  It's quoted because
>> the assembler doesn't have a way to parse a 16-byte integer.
>
> I'd guess, long-term, that's probably not a great motivation for
> choosing pseudo-standardized syntax.

? anyone compiling source to asm needs to inform the assembler about the
checksum, because the assembler might not have access to the original
source when it runs.  This will be a common problem across all assemblers
that speak DWARF v5.

 
>> To convey the root source filename, I allow the file number on the
>> .file directive to have file number 0.  There is special handling in
>> the AsmParser to allow accepting ".file 0" when we're not actually
>> emitting DWARF 5, the root source file is kept in a separate field
>> and not in the normal file table.  If MC does emit a v5 .debug_line
>> section, then it dumps that file entry first before the rest of the
>> file table.
>
> So .file 0 is accepted and ignored pre-5? & that's to support some
> weird/old assembly?

No, that was just expressed badly.  File #0 is stashed in a separate
field, which used to be just the compilation dir.  The '.file 0'
parsing stuffs the info there without bothering to check the DWARF
version.  When the assembler finally emits the line table, if it's a
v5 line table then the root source file comes out first.  If it's a
v4 line table, the root source file is not emitted.  (Note the root
source file is still available from the .debug_info section.)

It would be feasible to reject '.file 0' unless the user requested
DWARF v5 specifically.  Similarly we could reject the md5 clause.
On the other hand, accepting and ignoring means an assembler file
generated for DWARF v5 could be re-assembled for DWARF v4 without
having to hand-modify the assembler source, so it seemed better to
silently accept the syntax regardless of DWARF version.

--paulr



More information about the llvm-dev mailing list