[llvm-dev] [yaml2obj] GSoC-20: Add DWARF support to yaml2obj

Fangrui Song via llvm-dev llvm-dev at lists.llvm.org
Tue Mar 31 11:22:23 PDT 2020


On 2020-03-31, Adrian Prantl via llvm-dev wrote:
>
>
>> On Mar 31, 2020, at 10:55 AM, David Blaikie <dblaikie at gmail.com> wrote:
>>
>> +1 to all that & cc'ing a few of the usual suspects as FYI
>>
>> On Tue, Mar 31, 2020 at 10:36 AM Pavel Labath via llvm-dev <llvm-dev at lists.llvm.org <mailto:llvm-dev at lists.llvm.org>> wrote:
>>
>>
>> For me personally, the ability to write/edit syntactically correct dwarf
>> easily is much more important than being able to generate "incorrect"
>> dwarf -- I'm perfectly happy to continue to write the latter in
>> assembly, but there is a lot that could be improved about the experience
>> of writing "correct" dwarf. Ideally, I'd have a mode where I can just
>
>Do we think that yaml2obj is the best format for this, or would high-level DWARF DIE assembler directives be a more useful abstraction level? If you think about the .loc directive, there is actually some prior art in assembler.
>
>-- adrian

I also find YAML tests unwieldy but for some tests (especiall malformed)
we may have to use them because it is diffult for an assembly directive to produce invalid output (invalid offset/relocation/string table/etc).

An assembly syntax can be conciser than its YAML counterpart, e.g. to
describe a section:

   assembly: .section .foo,"a", at progbits
   YAML: - Name: foo
           Type: SHT_PROGBITS
           Flags: [ SHF_ALLOC ]

A symbol table entry is similar. A YAML entry usually takes several
lines of code.

Another advantage of assembly syntax is that it is composable. To define a
local symbol:

   label:

To make it global:

   .globl label
   label:

Some directives are more expressive, e.g. .file .loc
An assembler even supports some meta programming features (macros). The
syntax may be strange.

We do need some composable directives to make DWARF tests easier to
write/read.


More information about the llvm-dev mailing list