Page MenuHomePhabricator

[DWARFYAML] make obj2yaml use existing DWARF support for ELF
Needs ReviewPublic

Authored by haberman on Jun 9 2021, 7:23 PM.

Details

Summary

These DWARF routines were previously only used for Mach-O.
yaml2obj can handle these DWARF sections, but prior to this
change obj2yaml would not emit them (insted it would just
emit the raw bytes of the .debug_* sections).

Diff Detail

Unit TestsFailed

TimeTest
30 msx64 debian > LLVM.MC/AsmParser::directive_file-3.s
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llvm-mc -g -triple i386-unknown-unknown /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/AsmParser/directive_file-3.s | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck -check-prefix=CHECK-DEFAULT /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/AsmParser/directive_file-3.s
30 msx64 debian > LLVM.MC/RISCV/rvv::snippet.s
Script: -- : 'RUN: at line 3'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llvm-mc -triple=riscv64 -filetype=obj --mattr=+experimental-v < /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/RISCV/rvv/snippet.s | /var/lib/buildkite-agent/builds/llvm-project/build/bin/llvm-objdump -d --mattr=+experimental-v - | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/RISCV/rvv/snippet.s --check-prefix=CHECK-INST
30 msx64 debian > LLVM.MC/RISCV/rvv::vsetvl.s
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/llvm-mc -triple=riscv64 -show-encoding --mattr=+experimental-v /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/RISCV/rvv/vsetvl.s | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/MC/RISCV/rvv/vsetvl.s --check-prefixes=CHECK-ENCODING,CHECK-INST
180 msx64 debian > LLVM.tools/obj2yaml/ELF/DWARF::debug-ranges.yaml
Script: -- : 'RUN: at line 8'; /var/lib/buildkite-agent/builds/llvm-project/build/bin/yaml2obj --docnum=1 /var/lib/buildkite-agent/builds/llvm-project/llvm/test/tools/obj2yaml/ELF/DWARF/debug-ranges.yaml -DBITS=32 -DLOWOFFSET=0xFFFFFFFF -DHIGHOFFSET=0x10 | /var/lib/buildkite-agent/builds/llvm-project/build/bin/obj2yaml | /var/lib/buildkite-agent/builds/llvm-project/build/bin/FileCheck /var/lib/buildkite-agent/builds/llvm-project/llvm/test/tools/obj2yaml/ELF/DWARF/debug-ranges.yaml --check-prefix=BASIC -DADDRSIZE=0x4 -DOFFSET=0x18 -DLOWOFFSET=0xFFFFFFFF -DHIGHOFFSET=0x10
110 msx64 windows > LLVM.MC/AsmParser::directive_file-3.s
Script: -- : 'RUN: at line 1'; c:\ws\w3\llvm-project\premerge-checks\build\bin\llvm-mc.exe -g -triple i386-unknown-unknown C:\ws\w3\llvm-project\premerge-checks\llvm\test\MC\AsmParser\directive_file-3.s | c:\ws\w3\llvm-project\premerge-checks\build\bin\filecheck.exe -check-prefix=CHECK-DEFAULT C:\ws\w3\llvm-project\premerge-checks\llvm\test\MC\AsmParser\directive_file-3.s
View Full Test Results (9 Failed)

Event Timeline

haberman requested review of this revision.Jun 9 2021, 7:23 PM
haberman created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2021, 7:23 PM

As you see, the original DWARF parser is buggy and lacking of tests, so we haven't employed it in elf2yaml. You might need to modify the parser before adding it to elf2yaml. Could you please split this patch into several small patches and add some tests for it? Test cases for DWARF of elf2yaml are in llvm/test/tools/obj2yaml/ELF/DWARF (https://github.com/llvm/llvm-project/tree/main/llvm/test/tools/obj2yaml/ELF/DWARF).