<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Mar 29, 2018 at 10:16 AM <<a href="mailto:paul.robinson@sony.com">paul.robinson@sony.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
>> To pass the MD5 checksum to the assembler, I added a new optional<br>
>> clause to the .file directive:<br>
>> md5 "checksum"<br>
>> where checksum is the 16-byte checksum in hex.  It's quoted because<br>
>> the assembler doesn't have a way to parse a 16-byte integer.<br>
><br>
> I'd guess, long-term, that's probably not a great motivation for<br>
> choosing pseudo-standardized syntax.<br>
<br>
? anyone compiling source to asm needs to inform the assembler about the<br>
checksum, because the assembler might not have access to the original<br>
source when it runs.  This will be a common problem across all assemblers<br>
that speak DWARF v5.<br></blockquote><div><br>Sorry, I meant specifically the choice for it to be quoted rather than a bare hex literal.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">>> To convey the root source filename, I allow the file number on the<br>
>> .file directive to have file number 0.  There is special handling in<br>
>> the AsmParser to allow accepting ".file 0" when we're not actually<br>
>> emitting DWARF 5, the root source file is kept in a separate field<br>
>> and not in the normal file table.  If MC does emit a v5 .debug_line<br>
>> section, then it dumps that file entry first before the rest of the<br>
>> file table.<br>
><br>
> So .file 0 is accepted and ignored pre-5? & that's to support some<br>
> weird/old assembly?<br>
<br>
No, that was just expressed badly.  File #0 is stashed in a separate<br>
field, which used to be just the compilation dir.  The '.file 0'<br>
parsing stuffs the info there without bothering to check the DWARF<br>
version.  When the assembler finally emits the line table, if it's a<br>
v5 line table then the root source file comes out first.  If it's a<br>
v4 line table, the root source file is not emitted.  (Note the root<br>
source file is still available from the .debug_info section.)<br>
<br>
It would be feasible to reject '.file 0' unless the user requested<br>
DWARF v5 specifically.  Similarly we could reject the md5 clause.<br>
On the other hand, accepting and ignoring means an assembler file<br>
generated for DWARF v5 could be re-assembled for DWARF v4 without<br>
having to hand-modify the assembler source, so it seemed better to<br>
silently accept the syntax regardless of DWARF version.<br></blockquote><div><br>Ah, so the point you were making was that these things were accepted and ignored, rather than rejected, when in earlier dwarf version modes.<br><br>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).<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
--paulr<br>
<br>
</blockquote></div></div>