[PATCH] D86610: [ELF] Add a new e_machine value EM_CSKY and add some CSKY relocation types

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 2 01:56:17 PDT 2020


grimar added inline comments.


================
Comment at: llvm/include/llvm/BinaryFormat/ELFRelocs/CSKY.def:9
+ELF_RELOC(R_CKCORE_PCREL_IMM8_4         ,       2)
+ELF_RELOC(R_CKCORE_PCREL_IMM11_2        ,       3)
+ELF_RELOC(R_CKCORE_PCREL_IMM4_2         ,       4)
----------------
Please be consistent. All other *.def files have a different style.
E.g:

```
ELF_RELOC(R_390_NONE,          0)
ELF_RELOC(R_390_8,             1)
ELF_RELOC(R_390_12,            2)
ELF_RELOC(R_390_16,            3)
ELF_RELOC(R_390_32,            4)
...
```


================
Comment at: llvm/include/llvm/Object/ELFObjectFile.h:1116
+    case ELF::EM_CSKY:
+      return "elf32-littlecsky";
     case ELF::EM_SPARC:
----------------
This value should be tested in
`llvm\unittests\Object\ELFObjectFileTest.cpp`


================
Comment at: llvm/lib/Object/ELF.cpp:205
+  case ELF::EM_CSKY:
+    return ELF::R_CKCORE_RELATIVE;
   case ELF::EM_AMDGPU:
----------------
I think we do not have unit tests for `getRelativeRelocationType`,
but you probably can add the first one (for `EM_CSKY`) to `ELFObjectFileTest.cpp` to test this value.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D86610



More information about the llvm-commits mailing list