[llvm] r181453 - [PowerPC] Add ELF relocation tests
Ulrich Weigand
ulrich.weigand at de.ibm.com
Wed May 8 10:51:44 PDT 2013
Author: uweigand
Date: Wed May 8 12:51:44 2013
New Revision: 181453
URL: http://llvm.org/viewvc/llvm-project?rev=181453&view=rev
Log:
[PowerPC] Add ELF relocation tests
This patch extends test/MC/PowerPC/ppc64-fixups.s to not only check for
the correct fixup type in the --show-encoding output, but also runs the
generated object file through llvm-readobj -r and verifies that the
correct ELF relocation records were generated.
Modified:
llvm/trunk/test/MC/PowerPC/ppc64-fixups.s
Modified: llvm/trunk/test/MC/PowerPC/ppc64-fixups.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/PowerPC/ppc64-fixups.s?rev=181453&r1=181452&r2=181453&view=diff
==============================================================================
--- llvm/trunk/test/MC/PowerPC/ppc64-fixups.s (original)
+++ llvm/trunk/test/MC/PowerPC/ppc64-fixups.s Wed May 8 12:51:44 2013
@@ -1,50 +1,65 @@
# RUN: llvm-mc -triple powerpc64-unknown-unknown --show-encoding %s | FileCheck %s
+# RUN: llvm-mc -triple powerpc64-unknown-unknown -filetype=obj %s | \
+# RUN: llvm-readobj -r | FileCheck %s -check-prefix=REL
+
+
# FIXME: .TOC. at tocbase
# CHECK: li 3, target at l # encoding: [0x38,0x60,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_ADDR16_LO target 0x0
li 3, target at l
# CHECK: addis 3, 3, target at ha # encoding: [0x3c,0x63,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at ha, kind: fixup_ppc_ha16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_ADDR16_HA target 0x0
addis 3, 3, target at ha
# CHECK: lis 3, target at ha # encoding: [0x3c,0x60,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at ha, kind: fixup_ppc_ha16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_ADDR16_HA target 0x0
lis 3, target at ha
# CHECK: addi 4, 3, target at l # encoding: [0x38,0x83,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_ADDR16_LO target 0x0
addi 4, 3, target at l
# CHECK: lwz 1, target at l(3) # encoding: [0x80,0x23,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_ADDR16_LO target 0x0
lwz 1, target at l(3)
# CHECK: ld 1, target at l(3) # encoding: [0xe8,0x23,A,0bAAAAAA00]
# CHECK-NEXT: # fixup A - offset: 0, value: target at l, kind: fixup_ppc_lo16_ds
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_ADDR16_LO_DS target 0x0
ld 1, target at l(3)
# CHECK: ld 1, target at toc(2) # encoding: [0xe8,0x22,A,0bAAAAAA00]
# CHECK-NEXT: # fixup A - offset: 0, value: target at toc, kind: fixup_ppc_lo16_ds
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_DS target 0x0
ld 1, target at toc(2)
# CHECK: addis 3, 2, target at toc@ha # encoding: [0x3c,0x62,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at toc@ha, kind: fixup_ppc_ha16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_HA target 0x0
addis 3, 2, target at toc@ha
# CHECK: addi 4, 3, target at toc@l # encoding: [0x38,0x83,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at toc@l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO target 0x0
addi 4, 3, target at toc@l
# CHECK: lwz 1, target at toc@l(3) # encoding: [0x80,0x23,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at toc@l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO target 0x0
lwz 1, target at toc@l(3)
# CHECK: ld 1, target at toc@l(3) # encoding: [0xe8,0x23,A,0bAAAAAA00]
# CHECK-NEXT: # fixup A - offset: 0, value: target at toc@l, kind: fixup_ppc_lo16_ds
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_TOC16_LO_DS target 0x0
ld 1, target at toc@l(3)
# FIXME: @tls
@@ -52,44 +67,54 @@
# CHECK: addis 3, 2, target at tprel@ha # encoding: [0x3c,0x62,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at tprel@ha, kind: fixup_ppc_ha16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_TPREL16_HA target 0x0
addis 3, 2, target at tprel@ha
# CHECK: addi 3, 3, target at tprel@l # encoding: [0x38,0x63,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at tprel@l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_TPREL16_LO target 0x0
addi 3, 3, target at tprel@l
# CHECK: addis 3, 2, target at dtprel@ha # encoding: [0x3c,0x62,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at dtprel@ha, kind: fixup_ppc_ha16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_DTPREL16_HA target 0x0
addis 3, 2, target at dtprel@ha
# CHECK: addi 3, 3, target at dtprel@l # encoding: [0x38,0x63,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at dtprel@l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_DTPREL16_LO target 0x0
addi 3, 3, target at dtprel@l
# CHECK: addis 3, 2, target at got@tprel at ha # encoding: [0x3c,0x62,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at got@tprel at ha, kind: fixup_ppc_ha16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_GOT_TPREL16_HA target 0x0
addis 3, 2, target at got@tprel at ha
# CHECK: ld 1, target at got@tprel at l(3) # encoding: [0xe8,0x23,A,0bAAAAAA00]
# CHECK-NEXT: # fixup A - offset: 0, value: target at got@tprel at l, kind: fixup_ppc_lo16_ds
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_GOT_TPREL16_LO_DS target 0x0
ld 1, target at got@tprel at l(3)
# CHECK: addis 3, 2, target at got@tlsgd at ha # encoding: [0x3c,0x62,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at got@tlsgd at ha, kind: fixup_ppc_ha16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSGD16_HA target 0x0
addis 3, 2, target at got@tlsgd at ha
# CHECK: addi 3, 3, target at got@tlsgd at l # encoding: [0x38,0x63,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at got@tlsgd at l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSGD16_LO target 0x0
addi 3, 3, target at got@tlsgd at l
# CHECK: addis 3, 2, target at got@tlsld at ha # encoding: [0x3c,0x62,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at got@tlsld at ha, kind: fixup_ppc_ha16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSLD16_HA target 0x0
addis 3, 2, target at got@tlsld at ha
# CHECK: addi 3, 3, target at got@tlsld at l # encoding: [0x38,0x63,A,A]
# CHECK-NEXT: # fixup A - offset: 0, value: target at got@tlsld at l, kind: fixup_ppc_lo16
+# CHECK-REL: 0x{{[0-9,A-F]+}} R_PPC64_GOT_TLSLD16_LO target 0x0
addi 3, 3, target at got@tlsld at l
More information about the llvm-commits
mailing list