[llvm] b475eca - [llvm-readobj/elf] - Merge mips-got-overlapped.test to mips-got.test and refine testing.
Georgii Rymar via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 18 01:42:00 PDT 2020
Author: Georgii Rymar
Date: 2020-08-18T11:37:34+03:00
New Revision: b475eca1ed8b57bc7457c92b837f93db710c38bc
URL: https://github.com/llvm/llvm-project/commit/b475eca1ed8b57bc7457c92b837f93db710c38bc
DIFF: https://github.com/llvm/llvm-project/commit/b475eca1ed8b57bc7457c92b837f93db710c38bc.diff
LOG: [llvm-readobj/elf] - Merge mips-got-overlapped.test to mips-got.test and refine testing.
The `mips-got-overlapped.test` was introduced in D16968 and its intention is
to check that when there is an empty section at the same address as `.got`,
then we are able to locate `.got` and dump it.
The issue is that this test does not test llvm-readelf and uses a precompiled
object. This path starts using YAML instead and merges
mips-got-overlapped.test to mips-got.test.
Differential revision: https://reviews.llvm.org/D86080
Added:
Modified:
llvm/test/tools/llvm-readobj/ELF/mips-got.test
Removed:
llvm/test/tools/llvm-readobj/ELF/Inputs/got-over.exe.elf-mips
llvm/test/tools/llvm-readobj/ELF/mips-got-overlapped.test
################################################################################
diff --git a/llvm/test/tools/llvm-readobj/ELF/Inputs/got-over.exe.elf-mips b/llvm/test/tools/llvm-readobj/ELF/Inputs/got-over.exe.elf-mips
deleted file mode 100644
index 27644bff3302..000000000000
Binary files a/llvm/test/tools/llvm-readobj/ELF/Inputs/got-over.exe.elf-mips and /dev/null
diff er
diff --git a/llvm/test/tools/llvm-readobj/ELF/mips-got-overlapped.test b/llvm/test/tools/llvm-readobj/ELF/mips-got-overlapped.test
deleted file mode 100644
index c8f81ccf9d28..000000000000
--- a/llvm/test/tools/llvm-readobj/ELF/mips-got-overlapped.test
+++ /dev/null
@@ -1,45 +0,0 @@
-# Check that llvm-readobj -A correctly shows .got section
-# content if there are some other zero-sized sections with the same
-# address as the .got. got-over.exe.elf-mips has zero-sized .data
-# section at the same offset .got section.
-
-# RUN: llvm-readobj -A %p/Inputs/got-over.exe.elf-mips | FileCheck %s
-
-# GOT-OBJ: Cannot find PLTGOT dynamic table tag.
-
-# CHECK: Primary GOT {
-# CHECK-NEXT: Canonical gp value: 0x418270
-# CHECK-NEXT: Reserved entries [
-# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x410280
-# CHECK-NEXT: Access: -32752
-# CHECK-NEXT: Initial: 0x0
-# CHECK-NEXT: Purpose: Lazy resolver
-# CHECK-NEXT: }
-# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x410284
-# CHECK-NEXT: Access: -32748
-# CHECK-NEXT: Initial: 0x80000000
-# CHECK-NEXT: Purpose: Module pointer (GNU extension)
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: Local entries [
-# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x410288
-# CHECK-NEXT: Access: -32744
-# CHECK-NEXT: Initial: 0x4001B8
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: Global entries [
-# CHECK-NEXT: Entry {
-# CHECK-NEXT: Address: 0x41028C
-# CHECK-NEXT: Access: -32740
-# CHECK-NEXT: Initial: 0x0
-# CHECK-NEXT: Value: 0x0
-# CHECK-NEXT: Type: None
-# CHECK-NEXT: Section: Undefined
-# CHECK-NEXT: Name: _foo
-# CHECK-NEXT: }
-# CHECK-NEXT: ]
-# CHECK-NEXT: Number of TLS and multi-GOT entries: 0
-# CHECK-NEXT: }
diff --git a/llvm/test/tools/llvm-readobj/ELF/mips-got.test b/llvm/test/tools/llvm-readobj/ELF/mips-got.test
index 7475a6d57d57..24a06dd2b3bb 100644
--- a/llvm/test/tools/llvm-readobj/ELF/mips-got.test
+++ b/llvm/test/tools/llvm-readobj/ELF/mips-got.test
@@ -579,3 +579,75 @@ Sections:
# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=NAME-ERR-NOTFOUND --implicit-check-not=warning:
# NAME-ERR-NOTFOUND: warning: '[[FILE]]': unable to read the name of SHT_PROGBITS section with index 2: a section [index 2] has an invalid sh_name (0xffff) offset which goes past the end of the section name string table
+
+## Check that we correctly show .got section content when there are some other zero-sized
+## sections with the same address as the .got section.
+## In this test the empty .data section has the same address as the .got section.
+
+# RUN: yaml2obj --docnum=4 %s -o %t.err7.o
+# RUN: llvm-readobj -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=SAME-ADDR-LLVM
+# RUN: llvm-readelf -A %t.err7.o 2>&1 | FileCheck %s -DFILE=%t.err7.o --check-prefix=SAME-ADDR-GNU
+
+# SAME-ADDR-LLVM: Primary GOT {
+# SAME-ADDR-LLVM-NEXT: Canonical gp value: 0x9112
+# SAME-ADDR-LLVM-NEXT: Reserved entries [
+# SAME-ADDR-LLVM-NEXT: Entry {
+# SAME-ADDR-LLVM-NEXT: Address: 0x1122
+# SAME-ADDR-LLVM-NEXT: Access: -32752
+# SAME-ADDR-LLVM-NEXT: Initial: 0x0
+# SAME-ADDR-LLVM-NEXT: Purpose: Lazy resolver
+# SAME-ADDR-LLVM-NEXT: }
+# SAME-ADDR-LLVM-NEXT: ]
+# SAME-ADDR-LLVM-NEXT: Local entries [
+# SAME-ADDR-LLVM-NEXT: ]
+# SAME-ADDR-LLVM-NEXT: Global entries [
+# SAME-ADDR-LLVM-NEXT: Entry {
+# SAME-ADDR-LLVM-NEXT: Address: 0x112A
+# SAME-ADDR-LLVM-NEXT: Access: -32744
+# SAME-ADDR-LLVM-NEXT: Initial: 0x0
+# SAME-ADDR-LLVM-NEXT: Value: 0x0
+# SAME-ADDR-LLVM-NEXT: Type: None (0x0)
+# SAME-ADDR-LLVM-NEXT: Section: Undefined (0x0)
+# SAME-ADDR-LLVM-NEXT: Name: foo (1)
+# SAME-ADDR-LLVM-NEXT: }
+# SAME-ADDR-LLVM-NEXT: ]
+# SAME-ADDR-LLVM-NEXT: Number of TLS and multi-GOT entries: 0
+# SAME-ADDR-LLVM-NEXT: }
+
+# SAME-ADDR-GNU: Primary GOT:
+# SAME-ADDR-GNU-NEXT: Canonical gp value: 0000000000009112
+# SAME-ADDR-GNU-EMPTY:
+# SAME-ADDR-GNU-NEXT: Reserved entries:
+# SAME-ADDR-GNU-NEXT: Address Access Initial Purpose
+# SAME-ADDR-GNU-NEXT: 0000000000001122 -32752(gp) 0000000000000000 Lazy resolver
+# SAME-ADDR-GNU-EMPTY:
+# SAME-ADDR-GNU-NEXT: Global entries:
+# SAME-ADDR-GNU-NEXT: Address Access Initial Sym.Val. Type Ndx Name
+# SAME-ADDR-GNU-NEXT: 000000000000112a -32744(gp) 0000000000000000 0000000000000000 NOTYPE UND foo
+
+--- !ELF
+FileHeader:
+ Class: ELFCLASS64
+ Data: ELFDATA2LSB
+ Type: ET_REL
+ Machine: EM_MIPS
+Sections:
+ - Name: .data
+ Type: SHT_PROGBITS
+ Address: 0x1122
+ Size: 0
+ - Name: .got
+ Type: SHT_PROGBITS
+ Address: 0x1122
+ Size: 16
+ - Name: .dynamic
+ Type: SHT_DYNAMIC
+ Entries:
+ - Tag: DT_MIPS_LOCAL_GOTNO
+ Value: 1
+ - Tag: DT_MIPS_GOTSYM
+ Value: 1
+ - Tag: DT_PLTGOT
+ Value: 0x1122
+DynamicSymbols:
+ - Name: foo
More information about the llvm-commits
mailing list