[PATCH] D130238: [LoongArch] Parse LoongArch base ABI in ObjectYAML and llvm-readobj

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 22 00:14:20 PDT 2022


jhenderson added inline comments.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/loongarch-eflags.test:3
+
+# RUN: yaml2obj --docnum=1 %s > %t-lp64s
+# RUN: llvm-readobj -h %t-lp64s | FileCheck --check-prefix=READOBJ-LP64S %s
----------------
Minor nit: we're tending to move away from piping to a file in favour of using `-o` to write the output to that file. The logic is that it's easier to copy and paste the command from the test output to reproduce the test run.


================
Comment at: llvm/test/tools/llvm-readobj/ELF/loongarch-eflags.test:64
+  Machine:         EM_LOONGARCH
+  Flags:           [ EF_LOONGARCH_BASE_ABI_LP64S ]
+...
----------------
Didn't see this earlier, sorry, but yaml2obj has an option (which might not have been available when existing tests were written) to allow text substitution within the YAML, a bit like FileCheck's -D option. Approximate example (not tested, but should be enough of an idea to get it to work):

```
# RUN: yaml2obj %s -o %t-lp64s -DFLAG=LP64S

...

--- !ELF
FileHeader:
  Class:           ELFCLASS64
  Data:            ELFDATA2LSB
  Type:            ET_EXEC
  Machine:         EM_LOONGARCH
  Flags:           [ EF_LOONGARCH_BASE_ABI_[[FLAG]] ]
```
This will allow you to only have one YAML block.


================
Comment at: llvm/test/tools/obj2yaml/ELF/loongarch-eflags.yaml:3
+
+# RUN: yaml2obj --docnum=1 %s > %t-lp64s
+# RUN: obj2yaml %t-lp64s | FileCheck -DABI=EF_LOONGARCH_BASE_ABI_LP64S %s
----------------
Same comments as the other test re. -D and -o options.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D130238/new/

https://reviews.llvm.org/D130238



More information about the llvm-commits mailing list