[PATCH] D86341: [llvm-readobj/elf][test] - Add testing for EM_* specific OS/ABI values.
George Rimar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 21 04:30:46 PDT 2020
grimar created this revision.
grimar added reviewers: jhenderson, MaskRay.
Herald added subscribers: rupprecht, kristof.beyls, tpr, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
grimar requested review of this revision.
We have no tests for OS/ABI values specific to
`EM_TI_C6000`, `ELFOSABI_AMDGPU_MESA3D` and `ELFOSABI_ARM` machines.
Also, related arrays in the code are not grouped together.
(I guess that is why such testing was missed initially).
The patch fixes that all.
https://reviews.llvm.org/D86341
Files:
llvm/test/tools/llvm-readobj/ELF/Inputs/trivial.obj.elf-amdhsa-gfx803
llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
llvm/tools/llvm-readobj/ELFDumper.cpp
Index: llvm/tools/llvm-readobj/ELFDumper.cpp
===================================================================
--- llvm/tools/llvm-readobj/ELFDumper.cpp
+++ llvm/tools/llvm-readobj/ELFDumper.cpp
@@ -1318,11 +1318,6 @@
{"Standalone", "Standalone App", ELF::ELFOSABI_STANDALONE}
};
-static const EnumEntry<unsigned> SymVersionFlags[] = {
- {"Base", "BASE", VER_FLG_BASE},
- {"Weak", "WEAK", VER_FLG_WEAK},
- {"Info", "INFO", VER_FLG_INFO}};
-
static const EnumEntry<unsigned> AMDGPUElfOSABI[] = {
{"AMDGPU_HSA", "AMDGPU - HSA", ELF::ELFOSABI_AMDGPU_HSA},
{"AMDGPU_PAL", "AMDGPU - PAL", ELF::ELFOSABI_AMDGPU_PAL},
@@ -1338,6 +1333,11 @@
{"C6000_LINUX", "Linux C6000", ELF::ELFOSABI_C6000_LINUX}
};
+static const EnumEntry<unsigned> SymVersionFlags[] = {
+ {"Base", "BASE", VER_FLG_BASE},
+ {"Weak", "WEAK", VER_FLG_WEAK},
+ {"Info", "INFO", VER_FLG_INFO}};
+
static const EnumEntry<unsigned> ElfMachineType[] = {
ENUM_ENT(EM_NONE, "None"),
ENUM_ENT(EM_M32, "WE32100"),
Index: llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
===================================================================
--- llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
+++ llvm/test/tools/llvm-readobj/ELF/file-header-os-abi.test
@@ -10,10 +10,11 @@
--- !ELF
FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- OSABI: [[OSABI]]
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: [[MACHINE=<none>]]
+ OSABI: [[OSABI]]
## EI_OSABI is set to ELFOSABI_HPUX.
# RUN: yaml2obj %s -DOSABI=ELFOSABI_HPUX -o %t.osabi.hpux
@@ -158,3 +159,51 @@
# OSABI-UNKNOWN-LLVM: OS/ABI: 0xFE
# OSABI-UNKNOWN-GNU: OS/ABI: fe
+
+## Check all EM_AMDGPU specific values.
+
+# RUN: yaml2obj %s -DOSABI=ELFOSABI_AMDGPU_HSA -DMACHINE=EM_AMDGPU -o %t.osabi.amd.hsa
+# RUN: llvm-readobj --file-headers %t.osabi.amd.hsa | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDHSA-LLVM
+# RUN: llvm-readelf --file-headers %t.osabi.amd.hsa | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDHSA-GNU
+
+# OSABI-AMDHSA-LLVM: OS/ABI: AMDGPU_HSA (0x40)
+# OSABI-AMDHSA-GNU: OS/ABI: 40
+
+# RUN: yaml2obj %s -DOSABI=ELFOSABI_AMDGPU_PAL -DMACHINE=EM_AMDGPU -o %t.osabi.amd.pal
+# RUN: llvm-readobj --file-headers %t.osabi.amd.pal | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDPAL-LLVM
+# RUN: llvm-readelf --file-headers %t.osabi.amd.pal | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDPAL-GNU
+
+# OSABI-AMDPAL-LLVM: OS/ABI: AMDGPU_PAL (0x41)
+# OSABI-AMDPAL-GNU: OS/ABI: 41
+
+# RUN: yaml2obj %s -DOSABI=ELFOSABI_AMDGPU_MESA3D -DMACHINE=EM_AMDGPU -o %t.osabi.amd.mesa3d
+# RUN: llvm-readobj --file-headers %t.osabi.amd.mesa3d | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDMESA3D-LLVM
+# RUN: llvm-readelf --file-headers %t.osabi.amd.mesa3d | FileCheck %s --match-full-lines --check-prefix=OSABI-AMDMESA3D-GNU
+
+# OSABI-AMDMESA3D-LLVM: OS/ABI: AMDGPU_MESA3D (0x42)
+# OSABI-AMDMESA3D-GNU: OS/ABI: 42
+
+# Check all EM_ARM specific values.
+
+# RUN: yaml2obj %s -DOSABI=ELFOSABI_ARM -DMACHINE=EM_ARM -o %t.osabi.arm
+# RUN: llvm-readobj --file-headers %t.osabi.arm | FileCheck %s --match-full-lines --check-prefix=OSABI-ARM-LLVM
+# RUN: llvm-readelf --file-headers %t.osabi.arm | FileCheck %s --match-full-lines --check-prefix=OSABI-ARM-GNU
+
+# OSABI-ARM-LLVM: OS/ABI: ARM (0x61)
+# OSABI-ARM-GNU: OS/ABI: 61
+
+## Check all EM_TI_C6000 specific values.
+
+# RUN: yaml2obj %s -DOSABI=ELFOSABI_C6000_ELFABI -DMACHINE=EM_TI_C6000 -o %t.osabi.c6000.elfabi
+# RUN: llvm-readobj --file-headers %t.osabi.c6000.elfabi | FileCheck %s --match-full-lines --check-prefix=OSABI-C6000ELFABI-LLVM
+# RUN: llvm-readelf --file-headers %t.osabi.c6000.elfabi | FileCheck %s --match-full-lines --check-prefix=OSABI-C6000ELFABI-GNU
+
+# OSABI-C6000ELFABI-LLVM: OS/ABI: C6000_ELFABI (0x40)
+# OSABI-C6000ELFABI-GNU: OS/ABI: 40
+
+# RUN: yaml2obj %s -DOSABI=ELFOSABI_C6000_LINUX -DMACHINE=EM_TI_C6000 -o %t.osabi.c6000.linux
+# RUN: llvm-readobj --file-headers %t.osabi.c6000.linux | FileCheck %s --match-full-lines --check-prefix=OSABI-C6000LINUX-LLVM
+# RUN: llvm-readelf --file-headers %t.osabi.c6000.linux | FileCheck %s --match-full-lines --check-prefix=OSABI-C6000LINUX-GNU
+
+# OSABI-C6000LINUX-LLVM: OS/ABI: C6000_LINUX (0x41)
+# OSABI-C6000LINUX-GNU: OS/ABI: 41
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86341.287001.patch
Type: text/x-patch
Size: 4405 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200821/ec130516/attachment.bin>
More information about the llvm-commits
mailing list