[yaml2obj] Add -D k=v to preprocess the input YAML
authorFangrui Song <maskray@google.com>
Mon, 3 Feb 2020 19:12:04 +0000 (11:12 -0800)
committerFangrui Song <maskray@google.com>
Fri, 7 Feb 2020 17:35:00 +0000 (09:35 -0800)
commite3951248b14f5523cb93b380f0995d611a56192f
tree18b8056d6d61546f0ebfa44973db71642db4cbe5
parente52414b1ae466acf900fc4515abf7de5a3fd6fca
[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
llvm/test/tools/yaml2obj/macro.yaml [new file with mode: 0644]
llvm/tools/yaml2obj/yaml2obj.cpp