[llvm] a95f56f - [test] Move AMDGPU reloc test from Object to tools/llvm-readobj and simplify it
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 12 10:04:37 PDT 2021
Author: Fangrui Song
Date: 2021-07-12T10:04:32-07:00
New Revision: a95f56f60089ce810dd1d66a640042133f56ccd8
URL: https://github.com/llvm/llvm-project/commit/a95f56f60089ce810dd1d66a640042133f56ccd8
DIFF: https://github.com/llvm/llvm-project/commit/a95f56f60089ce810dd1d66a640042133f56ccd8.diff
LOG: [test] Move AMDGPU reloc test from Object to tools/llvm-readobj and simplify it
We already have some reloc-types-elf-*.test serving the similar purpose.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D105783
Added:
llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-amdgpu.test
Modified:
Removed:
llvm/test/Object/AMDGPU/elf64-relocs.yaml
################################################################################
diff --git a/llvm/test/Object/AMDGPU/elf64-relocs.yaml b/llvm/test/Object/AMDGPU/elf64-relocs.yaml
deleted file mode 100644
index 6af062fb3182c..0000000000000
--- a/llvm/test/Object/AMDGPU/elf64-relocs.yaml
+++ /dev/null
@@ -1,74 +0,0 @@
-# RUN: yaml2obj %s -o %t
-# RUN: llvm-readobj -r %t | FileCheck %s
-
-# CHECK: Relocations [
-# CHECK: Section (2) .rela.text {
-# CHECK: 0x0 R_AMDGPU_NONE - 0x0
-# CHECK: 0x2 R_AMDGPU_ABS32_LO - 0x0
-# CHECK: 0x4 R_AMDGPU_ABS32_HI - 0x0
-# CHECK: 0x6 R_AMDGPU_ABS64 - 0x0
-# CHECK: 0x8 R_AMDGPU_REL32 - 0x0
-# CHECK: 0x10 R_AMDGPU_REL64 - 0x0
-# CHECK: 0x12 R_AMDGPU_ABS32 - 0x0
-# CHECK: 0x14 R_AMDGPU_GOTPCREL - 0x0
-# CHECK: 0x16 R_AMDGPU_GOTPCREL32_LO - 0x0
-# CHECK: 0x18 R_AMDGPU_GOTPCREL32_HI - 0x0
-# CHECK: 0x20 R_AMDGPU_REL32_LO - 0x0
-# CHECK: 0x22 R_AMDGPU_REL32_HI - 0x0
-# CHECK: 0x24 R_AMDGPU_RELATIVE64 - 0x0
-# CHECK: }
-# CHECK: ]
-
-!ELF
-FileHeader:
- Class: ELFCLASS64
- Data: ELFDATA2LSB
- Type: ET_REL
- Machine: EM_AMDGPU
-Sections:
- - Type: SHT_PROGBITS
- Name: .text
- Flags: [ SHF_ALLOC, SHF_EXECINSTR ]
- AddressAlign: 0x08
- Content: 0000000000000000
- - Type: SHT_RELA
- Name: .rela.text
- Link: .symtab
- Info: .text
- AddressAlign: 0x08
- Relocations:
- - Type: R_AMDGPU_NONE
- - Offset: 0x2
- Type: R_AMDGPU_ABS32_LO
- - Offset: 0x4
- Type: R_AMDGPU_ABS32_HI
- - Offset: 0x6
- Type: R_AMDGPU_ABS64
- - Offset: 0x8
- Type: R_AMDGPU_REL32
- - Offset: 0x10
- Type: R_AMDGPU_REL64
- - Offset: 0x12
- Type: R_AMDGPU_ABS32
- - Offset: 0x14
- Type: R_AMDGPU_GOTPCREL
- - Offset: 0x16
- Type: R_AMDGPU_GOTPCREL32_LO
- - Offset: 0x18
- Type: R_AMDGPU_GOTPCREL32_HI
- - Offset: 0x20
- Type: R_AMDGPU_REL32_LO
- - Offset: 0x22
- Type: R_AMDGPU_REL32_HI
- - Offset: 0x24
- Type: R_AMDGPU_RELATIVE64
-
-Symbols:
- - Name: .text
- Type: STT_SECTION
- Section: .text
- - Name: main
- Type: STT_FUNC
- Section: .text
- Size: 0x08
- Binding: STB_GLOBAL
diff --git a/llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-amdgpu.test b/llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-amdgpu.test
new file mode 100644
index 0000000000000..30ba07b939627
--- /dev/null
+++ b/llvm/test/tools/llvm-readobj/ELF/reloc-types-elf-amdgpu.test
@@ -0,0 +1,45 @@
+## Test that llvm-readobj/llvm-readelf shows proper relocation type
+## names and values for AMDGPU target.
+
+# RUN: yaml2obj %s -o %t
+# RUN: llvm-readobj -r %t | FileCheck %s
+
+# CHECK: Section ({{.*}}) .rela.text {
+# CHECK-NEXT: 0x0 R_AMDGPU_NONE - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_ABS32_LO - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_ABS32_HI - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_ABS64 - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_REL32 - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_REL64 - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_ABS32 - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_GOTPCREL - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_GOTPCREL32_LO - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_GOTPCREL32_HI - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_REL32_LO - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_REL32_HI - 0x0
+# CHECK-NEXT: 0x0 R_AMDGPU_RELATIVE64 - 0x0
+# CHECK-NEXT: }
+
+!ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_AMDGPU
+Sections:
+ - Name: .rela.text
+ Type: SHT_RELA
+ Relocations:
+ - Type: R_AMDGPU_NONE
+ - Type: R_AMDGPU_ABS32_LO
+ - Type: R_AMDGPU_ABS32_HI
+ - Type: R_AMDGPU_ABS64
+ - Type: R_AMDGPU_REL32
+ - Type: R_AMDGPU_REL64
+ - Type: R_AMDGPU_ABS32
+ - Type: R_AMDGPU_GOTPCREL
+ - Type: R_AMDGPU_GOTPCREL32_LO
+ - Type: R_AMDGPU_GOTPCREL32_HI
+ - Type: R_AMDGPU_REL32_LO
+ - Type: R_AMDGPU_REL32_HI
+ - Type: R_AMDGPU_RELATIVE64
More information about the llvm-commits
mailing list