[lld] r358975 - [PPC][PPC64] Improve some llvm-objdump -d -D tests
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 23 04:47:29 PDT 2019
Author: maskray
Date: Tue Apr 23 04:47:28 2019
New Revision: 358975
URL: http://llvm.org/viewvc/llvm-project?rev=358975&view=rev
Log:
[PPC][PPC64] Improve some llvm-objdump -d -D tests
Various improvement:
Some offsets in disassembly are incorrect after several layout adjustment. Fix them.
llvm-objdump -D should not be used. -D dumps unrelated non-text sections. Replace them with llvm-objdump -d, llvm-readelf -x, etc
Many llvm-objdump -d tests use {{.*}} . Add the option --no-show-raw-insn to avoid check hex bytes.
ppc64-long-branch.s does not need a shared object. Delete it.
Make ppc64-ifunc.s check 2 ifuncs.
Reviewers: ruiu, espindola
Subscribers: emaste, nemanjai, arichardson, kbarton, jsji, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D60998
Modified:
lld/trunk/test/ELF/ppc-relocs.s
lld/trunk/test/ELF/ppc64-call-reach.s
lld/trunk/test/ELF/ppc64-dtprel.s
lld/trunk/test/ELF/ppc64-entry-point.s
lld/trunk/test/ELF/ppc64-ifunc.s
lld/trunk/test/ELF/ppc64-long-branch.s
lld/trunk/test/ELF/ppc64-relocs.s
lld/trunk/test/ELF/ppc64-tls-gd-le-small.s
lld/trunk/test/ELF/ppc64-tls-ie-le.s
lld/trunk/test/ELF/ppc64-tls-ld-le.s
lld/trunk/test/ELF/ppc64-toc-addis-nop-lqsq.s
lld/trunk/test/ELF/ppc64-toc-addis-nop.s
lld/trunk/test/ELF/ppc64-toc-rel.s
lld/trunk/test/ELF/ppc64-toc-restore-recursive-call.s
lld/trunk/test/ELF/ppc64-toc-restore.s
lld/trunk/test/ELF/ppc64-weak-undef-call.s
Modified: lld/trunk/test/ELF/ppc-relocs.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc-relocs.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc-relocs.s (original)
+++ lld/trunk/test/ELF/ppc-relocs.s Tue Apr 23 04:47:28 2019
@@ -1,7 +1,8 @@
# REQUIRES: ppc
-# RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-freebsd %s -o %t
-# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -d %t2 | FileCheck %s
+# RUN: llvm-mc -filetype=obj -triple=powerpc-unknown-freebsd %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
+# RUN: llvm-objdump -s --no-show-raw-insn %t | FileCheck --check-prefix=HEX %s
.section .R_PPC_ADDR16_HA,"ax", at progbits
.globl _start
@@ -13,9 +14,9 @@ msg:
# CHECK: Disassembly of section .R_PPC_ADDR16_HA:
# CHECK: _start:
-# CHECK: 11000: 3c 80 00 01 lis 4, 1
+# CHECK: 11000: lis 4, 1
# CHECK: msg:
-# CHECK: 11004: 66 6f 6f 00 oris 15, 19, 28416
+# CHECK: 11004: oris 15, 19, 28416
.section .R_PPC_ADDR16_HI,"ax", at progbits
.globl _starti
@@ -27,9 +28,9 @@ msgi:
# CHECK: Disassembly of section .R_PPC_ADDR16_HI:
# CHECK: _starti:
-# CHECK: 11008: 3c 80 00 01 lis 4, 1
+# CHECK: 11008: lis 4, 1
# CHECK: msgi:
-# CHECK: 1100c: 66 6f 6f 00 oris 15, 19, 28416
+# CHECK: 1100c: oris 15, 19, 28416
.section .R_PPC_ADDR16_LO,"ax", at progbits
addi 4, 4, msg at l
@@ -39,9 +40,9 @@ mystr:
# CHECK: Disassembly of section .R_PPC_ADDR16_LO:
# CHECK: .R_PPC_ADDR16_LO:
-# CHECK: 11010: 38 84 10 04 addi 4, 4, 4100
+# CHECK: 11010: addi 4, 4, 4100
# CHECK: mystr:
-# CHECK: 11014: 62 6c 61 68 ori 12, 19, 24936
+# CHECK: 11014: ori 12, 19, 24936
.align 2
.section .R_PPC_REL24,"ax", at progbits
@@ -53,7 +54,7 @@ mystr:
# CHECK: Disassembly of section .R_PPC_REL24:
# CHECK: .FR_PPC_REL24:
-# CHECK: 1101c: 48 00 00 04 b .+4
+# CHECK: 1101c: b .+4
.section .R_PPC_REL14,"ax", at progbits
.globl .FR_PPC_REL14
@@ -64,7 +65,7 @@ mystr:
# CHECK: Disassembly of section .R_PPC_REL14:
# CHECK: .FR_PPC_REL14:
-# CHECK: 11020: {{.*}} bt 2, .+4
+# CHECK: 11020: bt 2, .+4
.section .R_PPC_REL32,"ax", at progbits
.globl .FR_PPC_REL32
@@ -73,9 +74,8 @@ mystr:
.section .R_PPC_REL32_2,"ax", at progbits
.Lfoox3:
-# CHECK: Disassembly of section .R_PPC_REL32:
-# CHECK: .FR_PPC_REL32:
-# CHECK: 11024: 00 00 00 04
+# HEX: .R_PPC_REL32:
+# HEX-NEXT: 11024 00000004
.section .R_PPC_ADDR32,"ax", at progbits
.globl .FR_PPC_ADDR32
@@ -84,9 +84,8 @@ mystr:
.section .R_PPC_ADDR32_2,"ax", at progbits
.Lfoox2:
-# CHECK: Disassembly of section .R_PPC_ADDR32:
-# CHECK: .FR_PPC_ADDR32:
-# CHECK: 11028: 00 01 10 2c
+# HEX: .R_PPC_ADDR32:
+# HEX-NEXT: 11028 0001102c
.align 2
.section .R_PPC_PLTREL24,"ax", at progbits
@@ -98,4 +97,4 @@ mystr:
# CHECK: Disassembly of section .R_PPC_PLTREL24:
# CHECK: .R_PPC_PLTREL24:
-# CHECK: 1102c: 48 00 00 04 b .+4
+# CHECK: 1102c: b .+4
Modified: lld/trunk/test/ELF/ppc64-call-reach.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-call-reach.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-call-reach.s (original)
+++ lld/trunk/test/ELF/ppc64-call-reach.s Tue Apr 23 04:47:28 2019
@@ -3,16 +3,16 @@
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
# RUN: ld.lld --defsym callee=0x12010010 --defsym tail_callee=0x12010020 \
# RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# RUN: ld.lld --defsym callee=0x12010010 --defsym tail_callee=0x12010020 \
# RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# RUN: ld.lld --defsym callee=0xE010014 --defsym tail_callee=0xE010024 \
# RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=NEGOFFSET %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=NEGOFFSET %s
# RUN: ld.lld --defsym callee=0x12010018 --defsym tail_callee=0x12010028 \
# RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=THUNK %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=THUNK %s
# RUN: llvm-readelf --sections %t | FileCheck --check-prefix=BRANCHLT %s
# RUN: not ld.lld --defsym callee=0x1001002D --defsym tail_callee=0x1001002F \
# RUN: %t.o -o %t 2>&1 | FileCheck --check-prefix=MISSALIGNED %s
@@ -20,16 +20,16 @@
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
# RUN: ld.lld --defsym callee=0x12010010 --defsym tail_callee=0x12010020 \
# RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# RUN: ld.lld --defsym callee=0x12010010 --defsym tail_callee=0x12010020 \
# RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# RUN: ld.lld --defsym callee=0xE010014 --defsym tail_callee=0xE010024 \
# RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=NEGOFFSET %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=NEGOFFSET %s
# RUN: ld.lld --defsym callee=0x12010018 --defsym tail_callee=0x12010028 \
# RUN: %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=THUNK %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=THUNK %s
# RUN: llvm-readelf --sections %t | FileCheck --check-prefix=BRANCHLT %s
# RUN: not ld.lld --defsym callee=0x1001002D --defsym tail_callee=0x1001002F \
# RUN: %t.o -o %t 2>&1 | FileCheck --check-prefix=MISSALIGNED %s
@@ -58,37 +58,36 @@ test:
# Check that we are branching to the definitions, and not range-extending
# thunks.
# CHECK-LABEL: test
-# CHECK: 10010014: {{.*}} bl .+33554428
-# CHECK: 10010024: {{.*}} b .+33554428
+# CHECK: 10010014: bl .+33554428
+# CHECK: 10010024: b .+33554428
# NEGOFFSET-LABEL: test
-# NEGOFFSET: 10010014: {{.*}} bl .-33554432
-# NEGOFFSET: 10010024: {{.*}} b .+33554432
+# NEGOFFSET: 10010014: bl .-33554432
+# NEGOFFSET: 10010024: b .+33554432
# .branch_lt[0]
# THUNK-LABEL: __long_branch_callee:
-# THUNK-NEXT: 10010000: {{.*}} addis 12, 2, 1
-# THUNK-NEXT: ld 12, -32768(12)
-# THUNK-NEXT: mtctr 12
-# THUNK-NEXT: bctr
+# THUNK-NEXT: 10010000: addis 12, 2, 1
+# THUNK-NEXT: ld 12, -32768(12)
+# THUNK-NEXT: mtctr 12
+# THUNK-NEXT: bctr
# .branch_lt[1]
# THUNK-LABEL: __long_branch_tail_callee:
-# THUNK-NEXT: 10010010: {{.*}} addis 12, 2, 1
-# THUNK-NEXT: ld 12, -32760(12)
-# THUNK-NEXT: mtctr 12
-# THUNK-NEXT: bctr
+# THUNK-NEXT: 10010010: addis 12, 2, 1
+# THUNK-NEXT: ld 12, -32760(12)
+# THUNK-NEXT: mtctr 12
+# THUNK-NEXT: bctr
# Each call now branches to a thunk, and although it is printed as positive
# the offset is interpreted as a signed 26 bit value so 67108812 is actually
# -52.
# THUNK-LABEL: test:
-# THUNK: 10010034: {{.*}} bl .-52
-# THUNK: 10010044: {{.*}} b .+67108812
+# THUNK: 10010034: bl .-52
+# THUNK: 10010044: b .+67108812
# The offset from the TOC to the .branch_lt section is (-1 << 16) - 32768.
# Name Type Address Off Size
# BRANCHLT: .got PROGBITS 0000000010020000 020000 000008
# BRANCHLT: .branch_lt PROGBITS 0000000010030000 030000 000010
# BRANCHLT-NOT: .plt
-
Modified: lld/trunk/test/ELF/ppc64-dtprel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-dtprel.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-dtprel.s (original)
+++ lld/trunk/test/ELF/ppc64-dtprel.s Tue Apr 23 04:47:28 2019
@@ -4,15 +4,15 @@
// RUN: ld.lld -shared %t.o -o %t.so
// RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
// RUN: llvm-readelf -r %t.so | FileCheck --check-prefix=OutputRelocs %s
-// RUN: llvm-objdump -D %t.so | FileCheck --check-prefix=Dis %s
-// RUN: llvm-objdump -D %t.so | FileCheck --check-prefix=GotDisLE %s
+// RUN: llvm-readelf -x .got %t.so | FileCheck --check-prefix=HEX-LE %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=Dis %s
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
// RUN: ld.lld -shared %t.o -o %t.so
// RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
// RUN: llvm-readelf -r %t.so | FileCheck --check-prefix=OutputRelocs %s
-// RUN: llvm-objdump -D %t.so | FileCheck --check-prefix=Dis %s
-// RUN: llvm-objdump -D %t.so | FileCheck --check-prefix=GotDisBE %s
+// RUN: llvm-readelf -x .got %t.so | FileCheck --check-prefix=HEX-BE %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=Dis %s
.text
.abiversion 2
@@ -150,10 +150,19 @@ k:
// OutputRelocs-NEXT: R_PPC64_DTPMOD64
-// i at dtprel --> (1024 - 0x8000) = -31744
-// Dis: test:
-// Dis: addi 4, 3, -31744
-// Dis: lwa 4, -31744(3)
+// The got entry for i is at .got+8*3 = 0x420510
+// i at dtprel = 1024 - 0x8000 = -31744 = 0xffffffffffff8400
+// HEX-LE: section '.got':
+// HEX-LE-NEXT: 4204f8 f8844200 00000000 00000000 00000000
+// HEX-LE-NEXT: 420508 00000000 00000000 0084ffff ffffffff
+
+// HEX-BE: section '.got':
+// HEX-BE-NEXT: 4204f8 00000000 004284f8 00000000 00000000
+// HEX-BE-NEXT: 420508 00000000 00000000 ffffffff ffff8400
+
+// Dis: test:
+// Dis: addi 4, 3, -31744
+// Dis-NEXT: lwa 4, -31744(3)
// #k at dtprel(1024 + 4 + 1024 * 1024 * 4) = 0x400404
@@ -177,26 +186,10 @@ k:
// Dis: oris 4, 4, 63
// Dis: ori 4, 4, 33796
-// Check for GOT entry for i. There should be a got entry which holds the offset
-// of i relative to the dynamic thread pointer.
-// i at dtprel -> (1024 - 0x8000) = 0xffff8400
-// GotDisBE: Disassembly of section .got:
-// GotDisBE: 4204f8: 00 00 00 00
-// GotDisBE: 4204fc: 00 42 84 f8
-// GotDisBE: 420510: ff ff ff ff
-// GotDisBE: 420514: ff ff 84 00
-
-// GotDisLE: Disassembly of section .got:
-// GotDisLE: 4204f8: f8 84 42 00
-// GotDisLE: 420510: 00 84 ff ff
-// GotDisLE: 420514: ff ff ff ff
-
-// Check that we have the correct offset to the got entry for i at got@dtprel
-// The got entry for i is 0x420510, and the TOC pointer is 0x4284f8.
-// #ha(i at got@dtprel) --> ((0x420510 - 0x4284f8 + 0x8000) >> 16) & 0xffff = 0
-// #lo(i at got@dtprel) --> (0x420510 - 0x4284f8) & 0xffff = -32744
-// #hi(i at got@dtprel) --> ((0x420510 - 0x4284f8) >> 16) & 0xffff = -1
-// i at got@dtprel --> 0x420510 - 0x4284f8 = -32744
+// #ha(i at got@dtprel) = ((0x420510 - (.got+0x8000) + 0x8000) >> 16) & 0xffff = 0
+// #lo(i at got@dtprel) = (0x420510 - (.got+0x8000)) & 0xffff = -32744
+// #hi(i at got@dtprel) = ((0x420510 - (.got+0x8000)) >> 16) & 0xffff = -1
+// i at got@dtprel --> 0x420510 - (.got+0x8000) = -32744
// Dis: test_got_dtprel:
// Dis: addis 3, 2, 0
// Dis: ld 3, -32744(3)
Modified: lld/trunk/test/ELF/ppc64-entry-point.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-entry-point.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-entry-point.s (original)
+++ lld/trunk/test/ELF/ppc64-entry-point.s Tue Apr 23 04:47:28 2019
@@ -1,14 +1,14 @@
# REQUIRES: ppc
-# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -D %t2 | FileCheck %s
-# RUN: llvm-objdump -D %t2 | FileCheck -check-prefix=CHECK-LE %s
-
-# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t
-# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -D %t2 | FileCheck %s
-# RUN: llvm-objdump -D %t2 | FileCheck -check-prefix=CHECK-BE %s
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
.text
.abiversion 2
@@ -23,8 +23,8 @@ _start:
addi 4, 4, .Lfunc_gep0 at l
# now r4 should contain the address of _start
- lis 5, .TOC.-.Lfunc_gep0 at ha
- addi 5, 5, .TOC.-.Lfunc_gep0 at l
+ lis 5, .TOC.-.Lfunc_gep0 at ha # R_PPC64_REL16_HA
+ addi 5, 5, .TOC.-.Lfunc_gep0 at l # R_PPC64_REL16_LO
# now r5 should contain the offset s.t. r4 + r5 = TOC base
# exit 55
@@ -34,16 +34,12 @@ _start:
.Lfunc_end0:
.size _start, .Lfunc_end0-.Lfunc_begin0
-// CHECK: 10010000: {{.*}} lis 4, 4097
-// CHECK-NEXT: 10010004: {{.*}} addi 4, 4, 0
-// CHECK-NEXT: 10010008: {{.*}} lis 5, 2
-// CHECK-NEXT: 1001000c: {{.*}} addi 5, 5, -32768
-
-// CHECK-LE: Disassembly of section .got:
-// CHECK-LE-NEXT: .got:
-// CHECK-LE-NEXT: 10020000: 00 80 02 10
-
-// CHECK-BE: Disassembly of section .got:
-// CHECK-BE-NEXT: .got:
-// CHECK-BE-NEXT: 10020000: 00 00 00 00 {{.*}}
-// CHECK-BE-NEXT: 10020004: 10 02 80 00 {{.*}}
+# NM-DAG: 0000000010028000 d .TOC.
+# NM-DAG: 0000000010010000 T _start
+
+# 0x10010000 = (4097<<16) + 0
+# CHECK: 10010000: lis 4, 4097
+# CHECK-NEXT: 10010004: addi 4, 4, 0
+# .TOC. - _start = (2<<16) - 32768
+# CHECK-NEXT: 10010008: lis 5, 2
+# CHECK-NEXT: 1001000c: addi 5, 5, -32768
Modified: lld/trunk/test/ELF/ppc64-ifunc.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-ifunc.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-ifunc.s (original)
+++ lld/trunk/test/ELF/ppc64-ifunc.s Tue Apr 23 04:47:28 2019
@@ -1,79 +1,67 @@
# REQUIRES: ppc
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t2.so
-# RUN: ld.lld %t.o %t2.so -o %t
-# RUN: llvm-objdump -D %t | FileCheck %s
-# RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
-# RUN: llvm-readelf -dyn-relocations %t | FileCheck --check-prefix=DYNREL %s
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SECTIONS %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
+# RUN: llvm-readelf -r %t | FileCheck --check-prefix=DYNREL %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
-# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t2.so
-# RUN: ld.lld %t.o %t2.so -o %t
-# RUN: llvm-objdump -D %t | FileCheck %s
-# RUN: llvm-readelf -dynamic-table %t | FileCheck --check-prefix=DT %s
-# RUN: llvm-readelf -dyn-relocations %t | FileCheck --check-prefix=DYNREL %s
-
-# CHECK: Disassembly of section .text:
-
-# Tocbase + (0 << 16) + 32560
-# 0x100280e0 + 0 + 32560 = 0x10030010 (.plt[2])
-# CHECK: __plt_foo:
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-readelf -S %t | FileCheck --check-prefix=SECTIONS %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
+# RUN: llvm-readelf -r %t | FileCheck --check-prefix=DYNREL %s
+
+# NM-DAG: 0000000010028000 d .TOC.
+# NM-DAG: 0000000010010028 T ifunc
+# NM-DAG: 000000001001002c T ifunc2
+
+# SECTIONS: .plt NOBITS 0000000010030000
+
+# .plt[0] - .TOC. = 0x10030000 - 0x10028000 = (1<<16) - 32768
+# CHECK: __plt_ifunc:
# CHECK-NEXT: std 2, 24(1)
-# CHECK-NEXT: addis 12, 2, 0
-# CHECK-NEXT: ld 12, 32560(12)
+# CHECK-NEXT: addis 12, 2, 1
+# CHECK-NEXT: ld 12, -32768(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
-# Tocbase + (0 << 16) + 32568
-# 0x100280e0 + 0 + 32568 = 0x1003018 (.plt[3])
-# CHECK: __plt_ifunc:
+# .plt[1] - .TOC. = 0x10030000+8 - 0x10028000 = (1<<16) - 32760
+# CHECK: __plt_ifunc2:
# CHECK-NEXT: std 2, 24(1)
-# CHECK-NEXT: addis 12, 2, 0
-# CHECK-NEXT: ld 12, 32568(12)
+# CHECK-NEXT: addis 12, 2, 1
+# CHECK-NEXT: ld 12, -32760(12)
# CHECK-NEXT: mtctr 12
# CHECK-NEXT: bctr
-# CHECK: ifunc:
-# CHECK-NEXT: 10010028: {{.*}} nop
-
+# __plt_ifunc - . = 0x10010000 - 0x10010038 = -56
+# __plt_ifunc2 - . = 0x10010014 - 0x10010040 = -44
# CHECK: _start:
-# CHECK-NEXT: addis 2, 12, 2
-# CHECK-NEXT: addi 2, 2, -32588
-# CHECK-NEXT: bl .-52
-# CHECK-NEXT: ld 2, 24(1)
-# CHECK-NEXT: bl .-40
-# CHECK-NEXT: ld 2, 24(1)
-
-# Check tocbase
-# CHECK: Disassembly of section .got:
-# CHECK-NEXT: .got:
-# CHECK-NEXT: 100200e0
-
-# Check .plt address
-# DT_PLTGOT should point to the start of the .plt section.
-# DT: 0x0000000000000003 PLTGOT 0x10030000
-
-# Check that we emit the correct dynamic relocation type for an ifunc
-# DYNREL: 'PLT' relocation section at offset 0x{{[0-9a-f]+}} contains 48 bytes:
-# 48 bytes --> 2 Elf64_Rela relocations
-# DYNREL-NEXT: Offset Info Type Symbol's Value Symbol's Name + Addend
-# DYNREL-NEXT: {{[0-9a-f]+}} {{[0-9a-f]+}} R_PPC64_JMP_SLOT {{0+}} foo + 0
-# DYNREL-NEXT: {{[0-9a-f]+}} {{[0-9a-f]+}} R_PPC64_IRELATIVE 10010028
-
-
- .text
- .abiversion 2
+# CHECK-NEXT: addis 2, 12, 1
+# CHECK-NEXT: addi 2, 2, 32720
+# CHECK-NEXT: 10010038: bl .-56
+# CHECK-NEXT: ld 2, 24(1)
+# CHECK-NEXT: 10010040: bl .-44
+# CHECK-NEXT: ld 2, 24(1)
+
+# Check that we emit 2 R_PPC64_IRELATIVE.
+# DYNREL: R_PPC64_IRELATIVE 10010028
+# DYNREL: R_PPC64_IRELATIVE 1001002c
.type ifunc STT_GNU_IFUNC
.globl ifunc
ifunc:
- nop
+ nop
+
+.type ifunc2 STT_GNU_IFUNC
+.globl ifunc2
+ifunc2:
+ nop
- .global _start
- .type _start, at function
+.global _start
+.type _start, at function
_start:
.Lfunc_gep0:
@@ -81,7 +69,7 @@ _start:
addi 2, 2, .TOC.-.Lfunc_gep0 at l
.Lfunc_lep0:
.localentry _start, .Lfunc_lep0-.Lfunc_gep0
- bl foo
- nop
bl ifunc
nop
+ bl ifunc2
+ nop
Modified: lld/trunk/test/ELF/ppc64-long-branch.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-long-branch.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-long-branch.s (original)
+++ lld/trunk/test/ELF/ppc64-long-branch.s Tue Apr 23 04:47:28 2019
@@ -1,22 +1,16 @@
# REQUIRES: ppc
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-func-global-entry.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t3.so
-# RUN: ld.lld --no-toc-optimize %t.o %t3.so -o %t
-# RUN: llvm-objdump -d -start-address=0x10010000 -stop-address=0x10010018 %t | FileCheck %s -check-prefix=CALLEE_DUMP
-# RUN: llvm-objdump -d -start-address=0x12010020 -stop-address=0x12010084 %t | FileCheck %s -check-prefix=CALLER_DUMP
-# RUN: llvm-objdump -D -start-address=0x12030008 -stop-address=0x12030010 %t | FileCheck %s -check-prefix=BRANCH_LT_LE
-# RUN: llvm-readelf --sections %t | FileCheck %s -check-prefix=SECTIONS
+# RUN: ld.lld --no-toc-optimize %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-readelf -x .branch_lt %t | FileCheck %s -check-prefix=BRANCH-LE
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
-# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-func-global-entry.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t3.so
-# RUN: ld.lld --no-toc-optimize %t.o %t3.so -o %t
-# RUN: llvm-objdump -d -start-address=0x10010000 -stop-address=0x10010018 %t | FileCheck %s -check-prefix=CALLEE_DUMP
-# RUN: llvm-objdump -d -start-address=0x12010020 -stop-address=0x12010084 %t | FileCheck %s -check-prefix=CALLER_DUMP
-# RUN: llvm-objdump -D -start-address=0x12030008 -stop-address=0x12030010 %t | FileCheck %s -check-prefix=BRANCH_LT_BE
-# RUN: llvm-readelf --sections %t | FileCheck %s -check-prefix=SECTIONS
+# RUN: ld.lld --no-toc-optimize %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-readelf -x .branch_lt %t | FileCheck %s -check-prefix=BRANCH-BE
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
.text
.abiversion 2
@@ -52,24 +46,14 @@ _start:
std 0, 16(1)
stdu 1, -32(1)
bl callee
- bl foo_external_diff
- nop
+ bl callee
addi 1, 1, 32
ld 0, 16(1)
mtlr 0
- addis 4, 2, .LC1 at toc@ha
- ld 4, .LC1 at toc@l(4)
- lwz 4, 0(4)
- add 3, 3, 4
- blr
-
-
.section .toc,"aw", at progbits
.LC0:
.tc a[TC],a
-.LC1:
- .tc b[TC],b
.data
@@ -80,42 +64,31 @@ a:
.long 11
.size a, 4
- .type b, at object
- .global b
- .p2align 2
-b:
- .long 33
- .size b, 4
-
-# Verify address of the callee
-# CALLEE_DUMP: callee:
-# CALLEE_DUMP: 10010000: {{.*}} addis 2, 12, 514
-# CALLEE_DUMP: 10010004: {{.*}} addi 2, 2, -32544
-# CALLEE_DUMP: 10010008: {{.*}} addis 4, 2, 0
-
-# Verify the address of _start, and the call to the long-branch thunk.
-# CALLER_DUMP: _start:
-# CALLER_DUMP: 12010020: {{.*}} addis 2, 12, 2
-# CALLER_DUMP: 12010038: {{.*}} bl .+56
-
-# Verify the thunks contents: TOC-pointer + offset = .branch_lt[0]
-# 0x120380e8 + (-2 << 16 + 32552) = 0x12020008
-# CALLER_DUMP: __long_branch_callee:
-# CALLER_DUMP: 12010060: {{.*}} addis 12, 2, 0
-# CALLER_DUMP: 12010064: {{.*}} ld 12, 32552(12)
-# CALLER_DUMP: 12010068: {{.*}} mtctr 12
-# CALLER_DUMP: 1201006c: {{.*}} bctr
-
-# BRANCH_LT_LE: Disassembly of section .branch_lt:
-# BRANCH_LT_LE-NEXT: .branch_lt:
-# BRANCH_LT_LE-NEXT: 12030008: 08 00 01 10
-# BRANCH_LT_LE-NEXT: 1203000c: 00 00 00 00
-
-# BRANCH_LT_BE: Disassembly of section .branch_lt:
-# BRANCH_LT_BE-NEXT: .branch_lt:
-# BRANCH_LT_BE-NEXT: 12030008: 00 00 00 00
-# BRANCH_LT_BE-NEXT: 1203000c: 10 01 00 08
-
-# [Nr] Name Type Address Off Size
-# SECTIONS: [ 9] .got PROGBITS 00000000120200e0 20200e0 000008
-# SECTIONS: [12] .branch_lt PROGBITS 0000000012030008 2030008 000008
+# NM: 0000000012028000 d .TOC.
+
+# Without --toc-optimize, compute the address of .toc[0] first. .toc[0] stores
+# the address of a.
+# .TOC. - callee = 0x12030000 - 0x10010000 = (514<<16) - 32768
+# CHECK: callee:
+# CHECK: 10010000: addis 2, 12, 514
+# CHECK: 10010004: addi 2, 2, -32768
+# CHECK: 10010008: addis 4, 2, 0
+
+# __long_branch_callee - . = 0x12010050 - 0x12010034 = 20
+# __long_branch_callee is not a PLT call stub. Calling it does not need TOC
+# restore, so it doesn't have to be followed by a nop.
+# CHECK: _start:
+# CHECK: 12010034: bl .+20
+# CHECK: 12010038: bl .+16
+
+# BRANCH-LE: section '.branch_lt':
+# BRANCH-LE-NEXT: 0x12030008 08000110 00000000
+# BRANCH-BE: section '.branch_lt':
+# BRANCH-BE-NEXT: 0x12030008 00000000 10010008
+
+# .branch_lt - .TOC. = 0x12030008 - 0x12028000 = (1<<16) - 32760
+# CHECK: __long_branch_callee:
+# CHECK-NEXT: 12010048: addis 12, 2, 1
+# CHECK-NEXT: ld 12, -32760(12)
+# CHECK-NEXT: mtctr 12
+# CHECK-NEXT: bctr
Modified: lld/trunk/test/ELF/ppc64-relocs.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-relocs.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-relocs.s (original)
+++ lld/trunk/test/ELF/ppc64-relocs.s Tue Apr 23 04:47:28 2019
@@ -2,13 +2,13 @@
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -D %t2 | FileCheck %s --check-prefix=DATALE
-# RUN: llvm-objdump -D %t2 | FileCheck %s
+# RUN: llvm-readelf -x .rodata -x .eh_frame %t2 | FileCheck %s --check-prefix=DATALE
+# RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -D %t2 | FileCheck %s --check-prefix=DATABE
-# RUN: llvm-objdump -D %t2 | FileCheck %s
+# RUN: llvm-readelf -x .rodata -x .eh_frame %t2 | FileCheck %s --check-prefix=DATABE
+# RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck %s
.text
.global _start
@@ -36,7 +36,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_TOC16_LO_DS:
# CHECK: .FR_PPC64_TOC16_LO_DS:
-# CHECK: 1001000c: {{.*}} ld 1, -32768(2)
+# CHECK: 1001000c: ld 1, -32768(2)
.section .R_PPC64_TOC16_LO,"ax", at progbits
.globl .FR_PPC64_TOC16_LO
@@ -45,7 +45,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_TOC16_LO:
# CHECK: .FR_PPC64_TOC16_LO:
-# CHECK: 10010010: {{.*}} addi 1, 2, -32768
+# CHECK: 10010010: addi 1, 2, -32768
.section .R_PPC64_TOC16_HI,"ax", at progbits
.globl .FR_PPC64_TOC16_HI
@@ -54,7 +54,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_TOC16_HI:
# CHECK: .FR_PPC64_TOC16_HI:
-# CHECK: 10010014: {{.*}} addis 1, 2, -1
+# CHECK: 10010014: addis 1, 2, -1
.section .R_PPC64_TOC16_HA,"ax", at progbits
.globl .FR_PPC64_TOC16_HA
@@ -63,7 +63,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_TOC16_HA:
# CHECK: .FR_PPC64_TOC16_HA:
-# CHECK: 10010018: {{.*}} nop
+# CHECK: 10010018: nop
.section .R_PPC64_REL24,"ax", at progbits
.globl .FR_PPC64_REL24
@@ -74,7 +74,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_REL24:
# CHECK: .FR_PPC64_REL24:
-# CHECK: 1001001c: {{.*}} b .+4
+# CHECK: 1001001c: b .+4
.section .R_PPC64_REL14,"ax", at progbits
.globl .FR_PPC64_REL14
@@ -85,7 +85,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_REL14:
# CHECK: .FR_PPC64_REL14:
-# CHECK: 10010020: {{.*}} bt 2, .+4
+# CHECK: 10010020: bt 2, .+4
.section .R_PPC64_ADDR16_LO,"ax", at progbits
.globl .FR_PPC64_ADDR16_LO
@@ -94,7 +94,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_ADDR16_LO:
# CHECK: .FR_PPC64_ADDR16_LO:
-# CHECK: 10010024: {{.*}} li 1, 0
+# CHECK: 10010024: li 1, 0
.section .R_PPC64_ADDR16_HI,"ax", at progbits
.globl .FR_PPC64_ADDR16_HI
@@ -103,7 +103,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_ADDR16_HI:
# CHECK: .FR_PPC64_ADDR16_HI:
-# CHECK: 10010028: {{.*}} li 1, 4097
+# CHECK: 10010028: li 1, 4097
.section .R_PPC64_ADDR16_HA,"ax", at progbits
.globl .FR_PPC64_ADDR16_HA
@@ -112,7 +112,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_ADDR16_HA:
# CHECK: .FR_PPC64_ADDR16_HA:
-# CHECK: 1001002c: {{.*}} li 1, 4097
+# CHECK: 1001002c: li 1, 4097
.section .R_PPC64_ADDR16_HIGHER,"ax", at progbits
.globl .FR_PPC64_ADDR16_HIGHER
@@ -121,7 +121,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_ADDR16_HIGHER:
# CHECK: .FR_PPC64_ADDR16_HIGHER:
-# CHECK: 10010030: {{.*}} li 1, 0
+# CHECK: 10010030: li 1, 0
.section .R_PPC64_ADDR16_HIGHERA,"ax", at progbits
.globl .FR_PPC64_ADDR16_HIGHERA
@@ -130,7 +130,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_ADDR16_HIGHERA:
# CHECK: .FR_PPC64_ADDR16_HIGHERA:
-# CHECK: 10010034: {{.*}} li 1, 0
+# CHECK: 10010034: li 1, 0
.section .R_PPC64_ADDR16_HIGHEST,"ax", at progbits
.globl .FR_PPC64_ADDR16_HIGHEST
@@ -139,7 +139,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_ADDR16_HIGHEST:
# CHECK: .FR_PPC64_ADDR16_HIGHEST:
-# CHECK: 10010038: {{.*}} li 1, 0
+# CHECK: 10010038: li 1, 0
.section .R_PPC64_ADDR16_HIGHESTA,"ax", at progbits
.globl .FR_PPC64_ADDR16_HIGHESTA
@@ -148,7 +148,7 @@ _start:
# CHECK: Disassembly of section .R_PPC64_ADDR16_HIGHESTA:
# CHECK: .FR_PPC64_ADDR16_HIGHESTA:
-# CHECK: 1001003c: {{.*}} li 1, 0
+# CHECK: 1001003c: li 1, 0
.section .R_PPC64_REL32, "ax", at progbits
.globl .FR_PPC64_REL32
@@ -158,22 +158,20 @@ _start:
.LBB0_2:
add 3, 3, 4
-# DATALE: Disassembly of section .rodata:
-# DATALE: .rodata:
-# DATALE: 100001c8: 80 fe 00 00
-
-# DATABE: Disassembly of section .rodata:
-# DATABE: .rodata:
-# DATABE: 100001c8: 00 00 fe 80
+# DATALE: '.rodata':
+# DATALE: 0x100001c8 80fe0000
+
+# DATABE: '.rodata':
+# DATABE: 0x100001c8 0000fe80
# Address of rodata + value stored at rodata entry
# should equal address of LBB0_2.
# 0x10000190 + 0xfeb4 = 0x10010044
# CHECK: Disassembly of section .R_PPC64_REL32:
# CHECK: .FR_PPC64_REL32:
-# CHECK: 10010040: {{.*}} nop
-# CHECK: 10010044: {{.*}} ld 5, -32736(2)
-# CHECK: 10010048: {{.*}} add 3, 3, 4
+# CHECK: 10010040: nop
+# CHECK: 10010044: ld 5, -32736(2)
+# CHECK: 10010048: add 3, 3, 4
.section .R_PPC64_REL64, "ax", at progbits
.globl .FR_PPC64_REL64
@@ -187,18 +185,14 @@ _start:
__foo:
li 3,0
-# Check that address of eh_frame entry + value stored
-# should equal the address of foo. Since it is not aligned,
-# the entry is not stored exactly at 10000198. It starts at
-# address 0x1000019a and has the value 0xfeaa.
-# 0x100001aa + 0xfeae = 0x10010058
-# DATALE: Disassembly of section .eh_frame:
-# DATALE: .eh_frame:
-# DATALE: 100001d0: {{.*}} 00 00
-
-# DATABE: Disassembly of section .eh_frame:
-# DATABE: .eh_frame:
-# DATABE: 100001e8: fe 76 {{.*}}
+# Check that the personality (relocated by R_PPC64_REL64) in the .eh_frame
+# equals the address of __foo.
+# 0x100001e2 + 0x76fe = 0x10010058
+# DATALE: section '.eh_frame':
+# DATALE: 0x100001e0 {{....}}76fe
+
+# DATABE: section '.eh_frame':
+# DATABE: 0x100001e0 {{[0-9a-f]+ [0-9a-f]+}} fe76{{....}}
# CHECK: __foo
-# CHECK-NEXT: 10010058: {{.*}} li 3, 0
+# CHECK-NEXT: 10010058: li 3, 0
Modified: lld/trunk/test/ELF/ppc64-tls-gd-le-small.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-tls-gd-le-small.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-tls-gd-le-small.s (original)
+++ lld/trunk/test/ELF/ppc64-tls-gd-le-small.s Tue Apr 23 04:47:28 2019
@@ -1,15 +1,15 @@
# REQUIRES: ppc
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# RUN: llvm-objdump -d -r %t.o | FileCheck --check-prefix=CHECK-INPUT %s
+# RUN: llvm-objdump -d --no-show-raw-insn -r %t.o | FileCheck --check-prefix=CHECK-INPUT %s
# RUN: ld.lld --defsym __tls_get_addr=0x10001000 %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=CHECK-DIS %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=CHECK-DIS %s
# RUN: llvm-readelf -relocations %t | FileCheck --check-prefix=DYN-RELOCS %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
-# RUN: llvm-objdump -d -r %t.o | FileCheck --check-prefix=CHECK-INPUT %s
+# RUN: llvm-objdump -d --no-show-raw-insn -r %t.o | FileCheck --check-prefix=CHECK-INPUT %s
# RUN: ld.lld --defsym __tls_get_addr=0x10001000 %t.o -o %t
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=CHECK-DIS %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=CHECK-DIS %s
# RUN: llvm-readelf -relocations %t | FileCheck --check-prefix=DYN-RELOCS %s
# Test checks the relaxation of a 'small' general-dynamic tls access into a
Modified: lld/trunk/test/ELF/ppc64-tls-ie-le.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-tls-ie-le.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-tls-ie-le.s (original)
+++ lld/trunk/test/ELF/ppc64-tls-ie-le.s Tue Apr 23 04:47:28 2019
@@ -5,14 +5,14 @@
// RUN: ld.lld -dynamic-linker /lib64/ld64.so.2 %t.o %t2.o -o %t
// RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
// RUN: llvm-readelf -r %t | FileCheck --check-prefix=OutputRelocs %s
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=Dis %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-tls-ie-le.s -o %t2.o
// RUN: ld.lld -dynamic-linker /lib64/ld64.so.2 %t.o %t2.o -o %t
// RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
// RUN: llvm-readelf -r %t | FileCheck --check-prefix=OutputRelocs %s
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=Dis %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s
.text
.abiversion 2
Modified: lld/trunk/test/ELF/ppc64-tls-ld-le.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-tls-ld-le.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-tls-ld-le.s (original)
+++ lld/trunk/test/ELF/ppc64-tls-ld-le.s Tue Apr 23 04:47:28 2019
@@ -3,13 +3,13 @@
// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
// RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
// RUN: ld.lld %t.o -o %t
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=Dis %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s
// RUN: llvm-readelf -r %t | FileCheck --check-prefix=OutputRelocs %s
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
// RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
// RUN: ld.lld %t.o -o %t
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=Dis %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s
// RUN: llvm-readelf -r %t | FileCheck --check-prefix=OutputRelocs %s
.text
Modified: lld/trunk/test/ELF/ppc64-toc-addis-nop-lqsq.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-toc-addis-nop-lqsq.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-toc-addis-nop-lqsq.s (original)
+++ lld/trunk/test/ELF/ppc64-toc-addis-nop-lqsq.s Tue Apr 23 04:47:28 2019
@@ -6,10 +6,10 @@
# RUN: ld.lld -shared %t2.o -o %t2.so
# RUN: ld.lld %t2.so %p/Inputs/ppc64le-quadword-ldst.o -o %t
-# RUN: llvm-objdump -D %t | FileCheck --check-prefix=Dis %s
+# RUN: llvm-objdump -d %t | FileCheck --check-prefix=Dis %s
# RUN: ld.lld --no-toc-optimize %t2.so %p/Inputs/ppc64le-quadword-ldst.o -o %t
-# RUN: llvm-objdump -D %t | FileCheck --check-prefix=NoOpt %s
+# RUN: llvm-objdump -d %t | FileCheck --check-prefix=NoOpt %s
# QuadInputRelocs: Relocation section '.rela.text'
# QuadInputRelocs: R_PPC64_TOC16_LO_DS 0000000000000000 quadLd
@@ -70,4 +70,3 @@
# NoOpt-NEXT: addis 3, 2, 0
# NoOpt-NEXT: 82 7f 83 f8 <unknown>
# NoOpt-NEXT: blr
-
Modified: lld/trunk/test/ELF/ppc64-toc-addis-nop.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-toc-addis-nop.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-toc-addis-nop.s (original)
+++ lld/trunk/test/ELF/ppc64-toc-addis-nop.s Tue Apr 23 04:47:28 2019
@@ -1,16 +1,16 @@
# REQUIRES: ppc
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# RUN: llvm-readelf -relocations --wide %t.o | FileCheck --check-prefix=InputRelocs %s
+# RUN: llvm-readelf -r %t.o | FileCheck --check-prefix=InputRelocs %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
# RUN: ld.lld -shared %t2.o -o %t2.so
#
# RUN: ld.lld %t2.so %t.o -o %t
-# RUN: llvm-objdump -D %t | FileCheck --check-prefix=Dis %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s
#
# RUN: ld.lld --no-toc-optimize %t2.so %t.o -o %t
-# RUN: llvm-objdump -D %t | FileCheck --check-prefix=NoOpt %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=NoOpt %s
# InputRelocs: Relocation section '.rela.text'
# InputRelocs: R_PPC64_TOC16_HA
@@ -35,7 +35,7 @@ bytes:
addis 4, 2, byteSt at toc@ha
stb 3, byteSt at toc@l(4)
blr
-# Dis-LABEL: bytes
+# Dis-LABEL: bytes:
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
@@ -44,7 +44,7 @@ bytes:
# Dis-NEXT: stb 3, 32625(2)
# Dis-NEXT: blr
-# NoOpt-LABEL: bytes
+# NoOpt-LABEL: bytes:
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
@@ -69,7 +69,7 @@ halfs:
addis 5, 2, halfSt at toc@ha
sth 4, halfSt at toc@l(5)
blr
-# Dis-LABEL: halfs
+# Dis-LABEL: halfs:
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
@@ -80,7 +80,7 @@ halfs:
# Dis-NEXT: sth 4, 32628(2)
# Dis-NEXT: blr
-# NoOpt-LABEL: halfs
+# NoOpt-LABEL: halfs:
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
@@ -178,7 +178,7 @@ vec_dq:
stxv 3, vecSt at toc@l(3)
blr
-# Dis-LABEL: vec_dq
+# Dis-LABEL: vec_dq:
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
@@ -187,7 +187,7 @@ vec_dq:
# Dis-NEXT: stxv 3, 32672(2)
# Dis-NEXT: blr
-# NoOpt-LABEL: vec_dq
+# NoOpt-LABEL: vec_dq:
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
@@ -214,7 +214,7 @@ vec_ds:
addis 3, 2, vecSt at toc@ha
stxssp 3, vecSt at toc@l(3)
blr
-# Dis-LABEL: vec_ds
+# Dis-LABEL: vec_ds:
# Dis-NEXT: addis
# Dis-NEXT: addi
# Dis-NEXT: nop
@@ -227,7 +227,7 @@ vec_ds:
# Dis-NEXT: stxssp 3, 32672(2)
# Dis-NEXT: blr
-# NoOpt-LABEL: vec_ds
+# NoOpt-LABEL: vec_ds:
# NoOpt-NEXT: addis
# NoOpt-NEXT: addi
# NoOpt-NEXT: addis 3, 2, 0
Modified: lld/trunk/test/ELF/ppc64-toc-rel.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-toc-rel.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-toc-rel.s (original)
+++ lld/trunk/test/ELF/ppc64-toc-rel.s Tue Apr 23 04:47:28 2019
@@ -2,15 +2,17 @@
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
# RUN: llvm-readobj -relocations %t.o | FileCheck -check-prefix=RELOCS-LE %s
-# RUN: ld.lld %t.o -o %t2
-# RUN: llvm-objdump -D %t2 | FileCheck %s
-# RUN: llvm-objdump -D %t2 | FileCheck -check-prefix=CHECK-LE %s
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-readelf -x .got %t | FileCheck --check-prefix=HEX-LE %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=CHECK %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
# RUN: llvm-readobj -relocations %t.o | FileCheck -check-prefix=RELOCS-BE %s
-# RUN: ld.lld %t.o -o %t2
-# RUN: llvm-objdump -D %t2 | FileCheck %s
-# RUN: llvm-objdump -D %t2 | FileCheck -check-prefix=CHECK-BE %s
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-nm %t | FileCheck --check-prefix=NM %s
+# RUN: llvm-readelf -x .got %t | FileCheck --check-prefix=HEX-BE %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=CHECK %s
# Make sure we calculate the offset correctly for a toc-relative access to a
# global variable as described by the PPC64 Elf V2 abi.
@@ -57,26 +59,19 @@ _start:
# RELOCS-BE: 0xA R_PPC64_TOC16_HA global_a 0x0
# RELOCS-BE: 0xE R_PPC64_TOC16_LO global_a 0x0
-# Want to check _start for the values used to build the offset from the TOC base
-# to global_a. The .TOC. symbol is expected at address 0x10030000, and the
-# TOC base is address-of(.TOC.) + 0x8000. The expected offset is:
-# 0x10020000(global_a) - 0x10038000(Toc base) = -0x18000(Offset)
-# which gets materialized into r3 as ((-1 << 16) - 32768).
-
-# CHECK: Disassembly of section .text:
-# CHECK-NEXT: _start:
-# CHECK: 10010008: {{.*}} addis 3, 2, 1
-# CHECK-NEXT: 1001000c: {{.*}} addi 3, 3, -32768
-
-# CHECK: Disassembly of section .data:
-# CHECK-NEXT: global_a:
-# CHECK-NEXT: 10030000: {{.*}}
-
-# CHECK-LE: Disassembly of section .got:
-# CHECK-LE-NEXT: .got:
-# CHECK-LE-NEXT: 10020000: 00 80 02 10
-
-# CHECK-BE: Disassembly of section .got:
-# CHECK-BE-NEXT: .got:
-# CHECK-BE-NEXT: 10020000: 00 00 00 00
-# CHECK-BE-NEXT: 10020004: 10 02 80 00
+# The .TOC. symbol represents the TOC base address: .got + 0x8000 = 0x10028000,
+# which is stored in the first entry of .got
+# NM: 0000000010028000 d .TOC.
+# NM: 0000000010030000 D global_a
+# HEX-LE: section '.got':
+# HEX-LE-NEXT: 0x10020000 00800210 00000000
+# HEX-BE: section '.got':
+# HEX-BE-NEXT: 0x10020000 00000000 10028000
+
+# r2 stores the TOC base address. To access global_a with r3, it
+# computes the address with TOC plus an offset.
+# The offset global_a - .TOC. = 0x10030000 - 0x10028000 = 0x8000
+# gets materialized as (1 << 16) - 32768.
+# CHECK: _start:
+# CHECK: 10010008: addis 3, 2, 1
+# CHECK-NEXT: 1001000c: addi 3, 3, -32768
Modified: lld/trunk/test/ELF/ppc64-toc-restore-recursive-call.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-toc-restore-recursive-call.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-toc-restore-recursive-call.s (original)
+++ lld/trunk/test/ELF/ppc64-toc-restore-recursive-call.s Tue Apr 23 04:47:28 2019
@@ -1,8 +1,8 @@
# REQUIRES: ppc
-# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t1.o
-# RUN: ld.lld -shared %t1.o -o %t
-# RUN: llvm-objdump -d -r %t | FileCheck %s
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
+# RUN: ld.lld -shared %t.o -o %t.so
+# RUN: llvm-objdump -d --no-show-raw-insn -r %t.so | FileCheck %s
# For a recursive call that is interposable the linker calls the plt-stub rather
# then calling the function directly. Since the call is through a plt stub and
@@ -18,8 +18,8 @@
# CHECK-NEXT: 10000:
# CHECK-LABEL: recursive_func
# CHECK-NEXT: 10014:
-# CHECK: 1003c: {{.*}} bl .-60
-# CHECK-NEXT: ld 2, 24(1)
+# CHECK: 1003c: bl .-60
+# CHECK-NEXT: 10040: ld 2, 24(1)
.abiversion 2
.section ".text"
Modified: lld/trunk/test/ELF/ppc64-toc-restore.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-toc-restore.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-toc-restore.s (original)
+++ lld/trunk/test/ELF/ppc64-toc-restore.s Tue Apr 23 04:47:28 2019
@@ -5,14 +5,14 @@
// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/ppc64-func.s -o %t3.o
// RUN: ld.lld -shared %t2.o -o %t2.so
// RUN: ld.lld %t.o %t2.so %t3.o -o %t
-// RUN: llvm-objdump -d %t | FileCheck %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-func.s -o %t3.o
// RUN: ld.lld -shared %t2.o -o %t2.so
// RUN: ld.lld %t.o %t2.so %t3.o -o %t
-// RUN: llvm-objdump -d %t | FileCheck %s
+// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
.text
.abiversion 2
@@ -32,12 +32,12 @@ _start:
// CHECK: Disassembly of section .text:
// CHECK: _start:
-// CHECK: 1001001c: {{.*}} bl .-28
-// CHECK-NOT: 10010020: {{.*}} nop
-// CHECK: 10010020: {{.*}} ld 2, 24(1)
-// CHECK: 10010024: {{.*}} bl .-16
-// CHECK-NOT: 10010028: {{.*}} nop
-// CHECK-NOT: 10010028: {{.*}} ld 2, 24(1)
+// CHECK: 1001001c: bl .-28
+// CHECK-NOT: 10010020: nop
+// CHECK: 10010020: ld 2, 24(1)
+// CHECK: 10010024: bl .-16
+// CHECK-NOT: 10010028: nop
+// CHECK-NOT: 10010028: ld 2, 24(1)
# Calling a function in another object file which will have same
# TOC base does not need a nop. If nop present, do not rewrite to
@@ -49,18 +49,18 @@ _diff_object:
nop
// CHECK: _diff_object:
-// CHECK-NEXT: 10010028: {{.*}} bl .+24
-// CHECK-NEXT: 1001002c: {{.*}} bl .+20
-// CHECK-NEXT: 10010030: {{.*}} nop
+// CHECK-NEXT: 10010028: bl .+24
+// CHECK-NEXT: 1001002c: bl .+20
+// CHECK-NEXT: 10010030: nop
# Branching to a local function does not need a nop
.global noretbranch
noretbranch:
b bar_local
// CHECK: noretbranch:
-// CHECK: 10010034: {{.*}} b .+67108832
-// CHECK-NOT: 10010038: {{.*}} nop
-// CHECK-NOT: 1001003c: {{.*}} ld 2, 24(1)
+// CHECK: 10010034: b .+67108832
+// CHECK-NOT: 10010038: nop
+// CHECK-NOT: 1001003c: ld 2, 24(1)
// This should come last to check the end-of-buffer condition.
.global last
@@ -68,5 +68,5 @@ last:
bl foo
nop
// CHECK: last:
-// CHECK: 10010038: {{.*}} bl .-56
-// CHECK-NEXT: 1001003c: {{.*}} ld 2, 24(1)
+// CHECK: 10010038: bl .-56
+// CHECK-NEXT: 1001003c: ld 2, 24(1)
Modified: lld/trunk/test/ELF/ppc64-weak-undef-call.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-weak-undef-call.s?rev=358975&r1=358974&r2=358975&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-weak-undef-call.s (original)
+++ lld/trunk/test/ELF/ppc64-weak-undef-call.s Tue Apr 23 04:47:28 2019
@@ -2,11 +2,11 @@
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -d %t2 | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck %s
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t
# RUN: ld.lld %t -o %t2
-# RUN: llvm-objdump -d %t2 | FileCheck %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t2 | FileCheck %s
# CHECK: Disassembly of section .text:
@@ -23,6 +23,6 @@ _start:
# be unreachable. But, we should link successfully. We should not, however,
# generate a .plt entry (this would be wasted space). For now, we do nothing
# (leaving the zero relative offset present in the input).
-# CHECK: 10010000: {{.*}} bl .+0
-# CHECK: 10010004: {{.*}} nop
-# CHECK: 10010008: {{.*}} blr
+# CHECK: 10010000: bl .+0
+# CHECK: 10010004: nop
+# CHECK: 10010008: blr
More information about the llvm-commits
mailing list