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

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 29 10:22:57 PDT 2018


On Thu, Mar 29, 2018 at 10:16 AM <paul.robinson at sony.com> wrote:

>
> >> 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.
>

Sorry, I meant specifically the choice for it to be quoted rather than a
bare hex literal.


> >> 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.
>

Ah, so the point you were making was that these things were accepted and
ignored, rather than rejected, when in earlier dwarf version modes.

Makes sense to me - generally you don't even pass a dwarf flag to the
assembler, right? If it contains line directives, the assembler produces a
line table, if it doesn't, it doesn't, yeah? Flags passed are to tweak that
behavior - to a non-default format (more recent (v5) in this case).


>
> --paulr
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180329/6ef5d11f/attachment.html>


More information about the llvm-dev mailing list