[all-commits] [llvm/llvm-project] e39512: [yaml2obj] Add -D k=v to preprocess the input YAML

Fangrui Song via All-commits all-commits at lists.llvm.org
Fri Feb 7 09:40:00 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e3951248b14f5523cb93b380f0995d611a56192f
      https://github.com/llvm/llvm-project/commit/e3951248b14f5523cb93b380f0995d611a56192f
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-02-07 (Fri, 07 Feb 2020)

  Changed paths:
    A llvm/test/tools/yaml2obj/macro.yaml
    M llvm/tools/yaml2obj/yaml2obj.cpp

  Log Message:
  -----------
  [yaml2obj] Add -D k=v to preprocess the input YAML

Examples:

```
yaml2obj -D MACHINE=EM_386 a.yaml -o a.o
yaml2obj -D MACHINE=0x1234 a.yaml -o a.o
```

where a.yaml contains:

```
--- !ELF
FileHeader:
  Class:   ELFCLASS64
  Data:    ELFDATA2MSB
  Type:    ET_REL
  Machine: [[MACHINE]]
```

Reviewed By: grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D73821


  Commit: e2d7c5b2b6559f311938c0853b46ff21df55938a
      https://github.com/llvm/llvm-project/commit/e2d7c5b2b6559f311938c0853b46ff21df55938a
  Author: Fangrui Song <maskray at google.com>
  Date:   2020-02-07 (Fri, 07 Feb 2020)

  Changed paths:
    M llvm/test/tools/llvm-objdump/section-headers.test
    M llvm/test/tools/llvm-readobj/ELF/hash-histogram.test
    M llvm/test/tools/obj2yaml/relr-section.yaml
    M llvm/test/tools/yaml2obj/ELF/class-endianness.yaml
    M llvm/test/tools/yaml2obj/ELF/emachine.yaml
    M llvm/test/tools/yaml2obj/ELF/reloc-sec-entry-size.yaml
    M llvm/test/tools/yaml2obj/ELF/relr-section.yaml
    M llvm/test/tools/yaml2obj/ELF/stack-sizes.yaml

  Log Message:
  -----------
  [yaml2obj][test] Simplify some e_machine EI_CLASS EI_DATA tests

When both little-endian and big-endian are tested, or both 32-bit and 64-bit are tested, use a template like the following with `-D BITS=32 -D ENCODE=LSB`

```
--- !ELF
FileHeader:
 Class:   ELFCLASS[[BITS]]
 Data:    ELFDATA2[[ENCODE]]
 Type:    ET_DYN
 Machine: EM_X86_64
```

Reviewed By: grimar, jhenderson

Differential Revision: https://reviews.llvm.org/D73828


Compare: https://github.com/llvm/llvm-project/compare/e52414b1ae46...e2d7c5b2b655


More information about the All-commits mailing list