Skip to content

Commit 7823902

Browse files
committed
[ELF][PPC] Refactor some ppc64 tests
Merge ppc64-dynamic-relocations.s into ppc64-plt-stub.s Add ppc64-tls-ie.s: covers ppc64-initial-exec-tls.s and ppc64-tls-ie-le.s Add ppc64-tls-gd.s: covers ppc64-general-dynamic-tls.s, ppc64-gd-to-ie.s, ppc64-tls-gd-le.s, and ppc64-tls-gd-le-small.s llvm-svn: 366424
1 parent 11512e7 commit 7823902

10 files changed

+308
-619
lines changed

lld/ELF/Arch/PPC64.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,7 @@ void PPC64::relaxTlsGdToIe(uint8_t *loc, RelType type, uint64_t val) const {
946946
// addis rT, r2, sym@got@tprel@ha.
947947
relocateOne(loc, R_PPC64_GOT_TPREL16_HA, val);
948948
return;
949+
case R_PPC64_GOT_TLSGD16:
949950
case R_PPC64_GOT_TLSGD16_LO: {
950951
// Relax from addi r3, rA, sym@got@tlsgd@l to
951952
// ld r3, sym@got@tprel@l(rA)

lld/test/ELF/ppc64-gd-to-ie.s

-100
This file was deleted.

lld/test/ELF/ppc64-general-dynamic-tls.s

-112
This file was deleted.

lld/test/ELF/ppc64-initial-exec-tls.s

-102
This file was deleted.

lld/test/ELF/ppc64-plt-stub.s

+34-25
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,37 @@
1-
// REQUIRES: ppc
2-
3-
// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
4-
// RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
5-
// RUN: ld.lld -shared %t2.o -o %t2.so
6-
// RUN: ld.lld %t.o %t2.so -o %t
7-
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
8-
9-
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
10-
// RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
11-
// RUN: ld.lld -shared %t2.o -o %t2.so
12-
// RUN: ld.lld %t.o %t2.so -o %t
13-
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
14-
15-
// CHECK: Disassembly of section .text:
16-
// CHECK-EMPTY:
17-
// CHECK-NEXT: _start:
18-
// CHECK: 10010008: bl .+16
19-
20-
// CHECK-LABEL: 0000000010010018 __plt_foo:
21-
// CHECK-NEXT: std 2, 24(1)
22-
// CHECK-NEXT: addis 12, 2, 0
23-
// CHECK-NEXT: ld 12, 32560(12)
24-
// CHECK-NEXT: mtctr 12
25-
// CHECK-NEXT: bctr
1+
# REQUIRES: ppc
2+
3+
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
4+
# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
5+
# RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
6+
# RUN: ld.lld %t.o %t2.so -o %t
7+
# RUN: llvm-readelf -S -d %t | FileCheck --check-prefix=SEC %s
8+
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
9+
10+
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %s -o %t.o
11+
# RUN: llvm-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/shared-ppc64.s -o %t2.o
12+
# RUN: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
13+
# RUN: ld.lld %t.o %t2.so -o %t
14+
# RUN: llvm-readelf -S -d %t | FileCheck --check-prefix=SEC %s
15+
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
16+
17+
## DT_PLTGOT points to .plt
18+
# SEC: .plt NOBITS 0000000010030000 030000 000018
19+
# SEC: 0x0000000000000003 (PLTGOT) 0x10030000
20+
21+
## .plt[0] holds the address of _dl_runtime_resolve.
22+
## .plt[1] holds the link map.
23+
## The JMP_SLOT relocation is stored at .plt[2]
24+
# RELOC: 0x10030010 R_PPC64_JMP_SLOT foo 0x0
25+
26+
# CHECK: _start:
27+
# CHECK: 10010008: bl .+16
28+
29+
# CHECK-LABEL: 0000000010010018 __plt_foo:
30+
# CHECK-NEXT: std 2, 24(1)
31+
# CHECK-NEXT: addis 12, 2, 0
32+
# CHECK-NEXT: ld 12, 32560(12)
33+
# CHECK-NEXT: mtctr 12
34+
# CHECK-NEXT: bctr
2635

2736

2837
.text

0 commit comments

Comments
 (0)