Page MenuHomePhabricator

[DWARFYAML] Offsets should be omitted when the OffsetEntryCount is 0.
ClosedPublic

Authored by Higuoxing on Jul 31 2020, 12:40 AM.

Details

Summary

The offsets field should be omitted when the 'OffsetEntryCount' entry is
specified to be 0.

Diff Detail

Event Timeline

Higuoxing created this revision.Jul 31 2020, 12:40 AM
Herald added a project: Restricted Project. · View Herald Transcript
Higuoxing requested review of this revision.Jul 31 2020, 12:40 AM
jhenderson added inline comments.Aug 3 2020, 1:51 AM
llvm/test/tools/yaml2obj/ELF/DWARF/debug-rnglists.yaml
674
699

Rather than having three different YAML docs for these cases, you can use -D and default options. You might even be able to get rid of some of the other YAML using similar methods.

For example:

## Generate an object with default offset entries and entry count.
# RUN: yaml2obj %s -o %t1
## Generate an object with default offset entries but a non-default entry count
# RUN: yaml2obj %s -o %t2 -D OFFSETENTRIES=0
## Generate an object with non-default offset entries but a default entry count
# RUN: yaml2obj %s -o %t3 -D OFFSETS=[0, 1, 2]
## Generate an object with non-default of both.
# RUN: yaml2obj %s -o %t4 -D OFFSETENTRIES=42 -D OFFSETS=[]

--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2LSB
  Type:    ET_EXEC
  Machine: EM_X86_64
DWARF:
  debug_rnglists:
    - OffsetEntryCount: [[OFFSETENTRIES=<none>]] # equivalent to not specifying the field at all, if -D OFFSETENTRIES not specified.
      Offsets: [[OFFSETS=<none>]]
      Lists:
        <etc>
709
732–733
Higuoxing updated this revision to Diff 282550.Aug 3 2020, 2:48 AM
Higuoxing marked 4 inline comments as done.

Address comments.

Thanks for reviewing!

This revision is now accepted and ready to land.Aug 3 2020, 2:57 AM