summaryrefslogtreecommitdiffstats
path: root/llvm/test/Object
diff options
context:
space:
mode:
authorSimon Atanasyan <simon@atanasyan.com>2016-01-16 22:40:09 +0000
committerSimon Atanasyan <simon@atanasyan.com>2016-01-16 22:40:09 +0000
commit72155c33b10e5ec20fef065a05abc7a7e0311fbf (patch)
tree66c3b1c9068ba243b4852c476a9eaceed930b77b /llvm/test/Object
parent20f31fa31a119640dfda40528a25f3b03ae1d818 (diff)
downloadbcm5719-llvm-72155c33b10e5ec20fef065a05abc7a7e0311fbf.tar.gz
bcm5719-llvm-72155c33b10e5ec20fef065a05abc7a7e0311fbf.zip
[llvm-readobj][ELF] Teach llvm-readobj to show dynamic relocation in REL format
MIPS 32-bit ABI uses REL relocation record format to save dynamic relocations. The patch teaches llvm-readobj to show dynamic relocations in this format. Differential Revision: http://reviews.llvm.org/D16114 llvm-svn: 258001
Diffstat (limited to 'llvm/test/Object')
-rwxr-xr-xllvm/test/Object/Inputs/dyn-rel.so.elf-mipsbin0 -> 1946 bytes
-rw-r--r--llvm/test/Object/dyn-rel-relocation.test71
2 files changed, 71 insertions, 0 deletions
diff --git a/llvm/test/Object/Inputs/dyn-rel.so.elf-mips b/llvm/test/Object/Inputs/dyn-rel.so.elf-mips
new file mode 100755
index 00000000000..08fe70eae30
--- /dev/null
+++ b/llvm/test/Object/Inputs/dyn-rel.so.elf-mips
Binary files differ
diff --git a/llvm/test/Object/dyn-rel-relocation.test b/llvm/test/Object/dyn-rel-relocation.test
new file mode 100644
index 00000000000..4b528a7ef91
--- /dev/null
+++ b/llvm/test/Object/dyn-rel-relocation.test
@@ -0,0 +1,71 @@
+// Check that 'llvm-readobj -dyn-relocations' shows dynamic relocations
+// if they have REL record format.
+
+// dyn-rel.so.elf-mips
+// % cat test.s
+// .globl __start
+// __start:
+// nop
+//
+// .data
+// .type v1,@object
+// .size v1,4
+// v1:
+// .word 0
+//
+// .globl v2
+// .type v2,@object
+// .size v2,8
+// v2:
+// .word v2+4 # R_MIPS_32 target v2 addend 4
+// .word v1 # R_MIPS_32 target v1 addend 0
+//
+// % llvm-mc -filetype=obj -triple=mips-unknown-linux -o test.o test.s
+// % ld -m elf32btsmip -shared -o dyn-rel.so.elf-mips test.o
+
+RUN: llvm-readobj -relocations -dyn-relocations -expand-relocs \
+RUN: %p/Inputs/dyn-rel.so.elf-mips | FileCheck %s
+
+// CHECK: Relocations [
+// CHECK-NEXT: Section (6) .rel.dyn {
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset: 0x0
+// CHECK-NEXT: Type: R_MIPS_NONE (0)
+// CHECK-NEXT: Symbol: - (0)
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset: 0x102F8
+// CHECK-NEXT: Type: R_MIPS_REL32 (3)
+// CHECK-NEXT: Symbol: - (0)
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset: 0x102F4
+// CHECK-NEXT: Type: R_MIPS_REL32 (3)
+// CHECK-NEXT: Symbol: v2 (9)
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+// CHECK-NEXT: }
+// CHECK-NEXT: ]
+
+// CHECK: Dynamic Relocations {
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset: 0x0
+// CHECK-NEXT: Type: R_MIPS_NONE (0)
+// CHECK-NEXT: Symbol: -
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset: 0x102F8
+// CHECK-NEXT: Type: R_MIPS_REL32 (3)
+// CHECK-NEXT: Symbol: -
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+// CHECK-NEXT: Relocation {
+// CHECK-NEXT: Offset: 0x102F4
+// CHECK-NEXT: Type: R_MIPS_REL32 (3)
+// CHECK-NEXT: Symbol: v2
+// CHECK-NEXT: Addend: 0x0
+// CHECK-NEXT: }
+// CHECK-NEXT: }
OpenPOWER on IntegriCloud