[lld] r366424 - [ELF][PPC] Refactor some ppc64 tests

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 18 03:43:07 PDT 2019


Author: maskray
Date: Thu Jul 18 03:43:07 2019
New Revision: 366424

URL: http://llvm.org/viewvc/llvm-project?rev=366424&view=rev
Log:
[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

Added:
    lld/trunk/test/ELF/ppc64-tls-gd.s
    lld/trunk/test/ELF/ppc64-tls-ie.s
Removed:
    lld/trunk/test/ELF/ppc64-gd-to-ie.s
    lld/trunk/test/ELF/ppc64-general-dynamic-tls.s
    lld/trunk/test/ELF/ppc64-initial-exec-tls.s
    lld/trunk/test/ELF/ppc64-tls-gd-le-small.s
    lld/trunk/test/ELF/ppc64-tls-gd-le.s
    lld/trunk/test/ELF/ppc64-tls-ie-le.s
Modified:
    lld/trunk/ELF/Arch/PPC64.cpp
    lld/trunk/test/ELF/ppc64-plt-stub.s

Modified: lld/trunk/ELF/Arch/PPC64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC64.cpp?rev=366424&r1=366423&r2=366424&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC64.cpp (original)
+++ lld/trunk/ELF/Arch/PPC64.cpp Thu Jul 18 03:43:07 2019
@@ -946,6 +946,7 @@ void PPC64::relaxTlsGdToIe(uint8_t *loc,
     //                      addis rT, r2, sym at got@tprel at ha.
     relocateOne(loc, R_PPC64_GOT_TPREL16_HA, val);
     return;
+  case R_PPC64_GOT_TLSGD16:
   case R_PPC64_GOT_TLSGD16_LO: {
     // Relax from addi  r3, rA, sym at got@tlsgd at l to
     //            ld r3, sym at got@tprel at l(rA)

Removed: lld/trunk/test/ELF/ppc64-gd-to-ie.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-gd-to-ie.s?rev=366423&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-gd-to-ie.s (original)
+++ lld/trunk/test/ELF/ppc64-gd-to-ie.s (removed)
@@ -1,100 +0,0 @@
-# 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-tls.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t3.so
-# RUN: ld.lld  %t.o %t3.so -o %t
-# RUN: llvm-objdump --section-headers %t | FileCheck --check-prefix=CheckGot %s
-# RUN: llvm-objdump -d %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-mc -filetype=obj -triple=powerpc64-unknown-linux %p/Inputs/ppc64-tls.s -o %t2.o
-# RUN: ld.lld -shared %t2.o -o %t3.so
-# RUN: ld.lld  %t.o %t3.so -o %t
-# RUN: llvm-objdump --section-headers %t | FileCheck --check-prefix=CheckGot %s
-# RUN: llvm-objdump -d %t | FileCheck --check-prefix=Dis %s
-# RUN: llvm-readelf -r %t | FileCheck --check-prefix=OutputRelocs %s
-
-        .text
-        .abiversion 2
-        .globl _start
-        .p2align        4
-        .type   _start, at function
-_start:
-.Lfunc_gep0:
-        addis 2, 12, .TOC.-.Lfunc_gep0 at ha
-        addi 2, 2, .TOC.-.Lfunc_gep0 at l
-.Lfunc_lep0:
-        .localentry     _start, .Lfunc_lep0-.Lfunc_gep0
-        mflr 0
-        std 0, 16(1)
-        stdu 1, -32(1)
-        addis 3, 2, a at got@tlsgd at ha
-        addi 3, 3, a at got@tlsgd at l
-        bl __tls_get_addr(a at tlsgd)
-        nop
-        lwa 3, 0(3)
-        addi 1, 1, 32
-        ld 0, 16(1)
-        mtlr 0
-        blr
-
-
-        .globl other_reg
-        .p2align        4
-        .type   other_reg, at function
-other_reg:
-.Lfunc_gep1:
-        addis 2, 12, .TOC.-.Lfunc_gep1 at ha
-        addi 2, 2, .TOC.-.Lfunc_gep1 at l
-.Lfunc_lep1:
-        .localentry     other_reg, .Lfunc_lep1-.Lfunc_gep1
-        mflr 0
-        std 0, 16(1)
-        stdu 1, -32(1)
-        addis 5, 2, a at got@tlsgd at ha
-        addi 3, 5, a at got@tlsgd at l
-        bl __tls_get_addr(a at tlsgd)
-        nop
-        lwa 4, 0(3)
-        addis 30, 2, b at got@tlsgd at ha
-        addi 3, 30, b at got@tlsgd at l
-        bl __tls_get_addr(b at tlsgd)
-        nop
-        lwa 3, 0(3)
-        add 3, 4, 3
-        addi 1, 1, 32
-        ld 0, 16(1)
-        mtlr 0
-        blr
-
-
-# CheckGot: .got          00000018 00000000100200c0 DATA
-# .got is at 0x100200c0 so the toc-base is 100280c0.
-# `a` is at .got[1], we expect the offsets to be:
-# Ha(a) = ((0x100200c8  - 0x100280c0) + 0x8000) >> 16 = 0
-# Lo(a) = (0x100200c8  - 0x100280c0) = -32760
-
-# Dis-LABEL: _start
-# Dis:         addis 3, 2, 0
-# Dis-NEXT:    ld 3, -32760(3)
-# Dis-NEXT:    nop
-# Dis-NEXT:    add 3, 3, 13
-
-# Dis-LABEL: other_reg
-# Dis:         addis 5, 2, 0
-# Dis-NEXT:    ld 3, -32760(5)
-# Dis-NEXT:    nop
-# Dis-NEXT:    add 3, 3, 13
-# Dis:         addis 30, 2, 0
-# Dis:         ld 3, -32752(30)
-# Dis-NEXT:    nop
-# Dis-NEXT:    add 3, 3, 13
-
-# Verify that the only dynamic relocations we emit are TPREL ones rather then
-# the DTPMOD64/DTPREL64 pair for general-dynamic.
-# OutputRelocs: Relocation section '.rela.dyn' at offset 0x{{[0-9a-f]+}} contains 2 entries:
-# OutputRelocs-NEXT:    Offset             Info             Type               Symbol's Value  Symbol's Name + Addend
-# OutputRelocs-NEXT:  {{[0-9a-f]+}}    {{[0-9a-f]+}}   R_PPC64_TPREL64        {{[0-9a-f]+}} a + 0
-# OutputRelocs-NEXT:  {{[0-9a-f]+}}    {{[0-9a-f]+}}   R_PPC64_TPREL64        {{[0-9a-f]+}} b + 0

Removed: lld/trunk/test/ELF/ppc64-general-dynamic-tls.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-general-dynamic-tls.s?rev=366423&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-general-dynamic-tls.s (original)
+++ lld/trunk/test/ELF/ppc64-general-dynamic-tls.s (removed)
@@ -1,112 +0,0 @@
-// REQUIRES: ppc
-
-// RUN: llvm-mc -filetype=obj -triple=powerpc64le-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 --section-headers %t.so | FileCheck --check-prefix=CheckGot %s
-// RUN: llvm-objdump -d %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 --section-headers %t.so | FileCheck --check-prefix=CheckGot %s
-// RUN: llvm-objdump -d %t.so | FileCheck --check-prefix=Dis %s
-
-	.text
-	.abiversion 2
-	.globl	test
-	.p2align	4
-	.type	test, at function
-test:
-.Lfunc_gep0:
-	addis 2, 12, .TOC.-.Lfunc_gep0 at ha
-	addi 2, 2, .TOC.-.Lfunc_gep0 at l
-.Lfunc_lep0:
-	.localentry	test, .Lfunc_lep0-.Lfunc_gep0
-	mflr 0
-	std 31, -8(1)
-	std 0, 16(1)
-	stdu 1, -48(1)
-	mr 31, 1
-	std 30, 32(31)
-	addis 3, 2, i at got@tlsgd at ha
-	addi 3, 3, i at got@tlsgd at l
-	bl __tls_get_addr(i at tlsgd)
-	nop
-	lwz 30, 0(3)
-	extsw 3, 30
-	ld 30, 32(31)
-	addi 1, 1, 48
-	ld 0, 16(1)
-	ld 31, -8(1)
-	mtlr 0
-	blr
-
-
-test_hi:
-.Lfunc_gep1:
-  addis 2, 12, .TOC.-.Lfunc_gep1 at ha
-  addi  2, 2,  .TOC.-.Lfunc_gep1 at l
-.Lfunc_lep1:
-  .localentry test2, .Lfunc_lep1-.Lfunc_gep1
-  addis 3, 0, j at got@tlsgd at h
-  blr
-
-test_16:
-.Lfunc_gep2:
-  addis 2, 12, .TOC.-.Lfunc_gep2 at ha
-  addi 2, 2, .TOC.-.Lfunc_gep2 at l
-.Lfunc_lep2:
-  .localentry test16, .Lfunc_lep2-.Lfunc_gep2
-  addi 3, 0, k at got@tlsgd
-  blr
-
-// Verify that the input has every general-dynamic tls relocation type.
-// InputRelocs:  Relocation section '.rela.text'
-// InputRelocs: R_PPC64_GOT_TLSGD16_HA  {{0+}}  i + 0
-// InputRelocs: R_PPC64_GOT_TLSGD16_LO  {{0+}}  i + 0
-// InputRelocs: R_PPC64_TLSGD           {{0+}}  i + 0
-// InputRelocs: R_PPC64_GOT_TLSGD16_HI  {{0+}}  j + 0
-// InputRelocs: R_PPC64_GOT_TLSGD16     {{0+}}  k + 0
-
-// There is 2 got entries for each tls variable that is accessed with the
-// general-dynamic model.  The entries can be though of as a structure to be
-// filled in by the dynamic linker:
-// typedef struct {
-//  unsigned long int ti_module; --> R_PPC64_DTPMOD64
-//  unsigned long int ti_offset; --> R_PPC64_DTPREL64
-//} tls_index;
-// OutputRelocs: Relocation section '.rela.dyn' at offset 0x{{[0-9a-f]+}} contains 6 entries:
-// OutputRelocs: R_PPC64_DTPMOD64  {{0+}}  i + 0
-// OutputRelocs: R_PPC64_DTPREL64  {{0+}}  i + 0
-// OutputRelocs: R_PPC64_DTPMOD64  {{0+}}  j + 0
-// OutputRelocs: R_PPC64_DTPREL64  {{0+}}  j + 0
-// OutputRelocs: R_PPC64_DTPMOD64  {{0+}}  k + 0
-// OutputRelocs: R_PPC64_DTPREL64  {{0+}}  k + 0
-
-// Check that the got has 7 entires. (1 for the TOC and 3 structures of
-// 2 entries for the tls variables). Also verify the address so we can check
-// the offsets we calculated for each relocation type.
-// CheckGot: got          00000038 00000000000200f0
-
-// got starts at 0x200f0, so .TOC. will be 0x280f0.
-
-// We are building the address of the first tls_index in the got which starts at
-// 0x200f8 (got[1]).
-// #ha(i at got@tlsgd) --> (0x200f8 - 0x280f0 + 0x8000) >> 16 = 0
-// #lo(i at got@tlsgd) --> (0x200f8 - 0x280f0) & 0xFFFF =  -7ff8 = -32760
-// Dis:  test:
-// Dis:    addis 3, 2, 0
-// Dis:    addi 3, 3, -32760
-
-// Second tls_index starts at got[3].
-// #hi(j at got@tlsgd) --> (0x20108 - 0x280f0) >> 16 = -1
-// Dis: test_hi:
-// Dis:   lis 3, -1
-
-// Third tls index is at got[5].
-// k at got@tlsgd --> (0x20118 -  0x280f0) = -0x7fd8 = -32728
-// Dis: test_16:
-// Dis:   li 3, -32728

Removed: lld/trunk/test/ELF/ppc64-initial-exec-tls.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-initial-exec-tls.s?rev=366423&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-initial-exec-tls.s (original)
+++ lld/trunk/test/ELF/ppc64-initial-exec-tls.s (removed)
@@ -1,102 +0,0 @@
-// 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-tls.s -o %t2.o
-// RUN: ld.lld -shared %t2.o -o %t2.so
-// RUN: ld.lld -dynamic-linker /lib64/ld64.so.2 %t.o %t2.so -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 --section-headers %t | FileCheck --check-prefix=CheckGot %s
-// RUN: llvm-objdump -d %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.s -o %t2.o
-// RUN: ld.lld -shared %t2.o -o %t2.so
-// RUN: ld.lld -dynamic-linker /lib64/ld64.so.2 %t.o %t2.so -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 --section-headers %t | FileCheck --check-prefix=CheckGot %s
-// RUN: llvm-objdump -d %t | FileCheck --check-prefix=Dis %s
-
-	.text
-	.abiversion 2
-	.file	"intial_exec.c"
-	.globl	test_initial_exec                    # -- Begin function test_initial_exec
-	.p2align	4
-	.type	test_initial_exec, at function
-test_initial_exec:                                   # @test_initial_exec
-.Lfunc_begin0:
-.Lfunc_gep0:
-	addis 2, 12, .TOC.-.Lfunc_gep0 at ha
-	addi 2, 2, .TOC.-.Lfunc_gep0 at l
-.Lfunc_lep0:
-	.localentry	test_initial_exec, .Lfunc_lep0-.Lfunc_gep0
-# %bb.0:                                # %entry
-	li 3, 0
-	stw 3, -12(1)
-	addis 3, 2, a at got@tprel at ha
-	ld 3, a at got@tprel at l(3)
-	lwzx 4, 3, a at tls
-	extsw 3, 4
-	blr
-
-
-test_hi:
-.Lfunc_gep1:
-  addis 2, 12, .TOC.-.Lfunc_gep1 at ha
-  addi  2, 2,  .TOC.-.Lfunc_gep1 at l
-.Lfunc_lep1:
-  .localentry test2, .Lfunc_lep1-.Lfunc_gep1
-  addis 3, 0, b at got@tprel at h
-  blr
-
-test_ds:
-.Lfunc_gep2:
-  addis 2, 12, .TOC.-.Lfunc_gep2 at ha
-  addi 2, 2, .TOC.-.Lfunc_gep2 at l
-.Lfunc_lep2:
-  .localentry test16, .Lfunc_lep2-.Lfunc_gep2
-  addi 3, 0, c at got@tprel
-  blr
-
-// Verify that the input has every initial-exec tls relocation type.
-// InputRelocs: Relocation section '.rela.text'
-// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} a + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} a + 0
-// InputRelocs: R_PPC64_TLS {{0+}} a + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_HI {{0+}} b + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_DS {{0+}} c + 0
-
-// There is a got entry for each tls variable that is accessed with the
-// initial-exec model to be filled in by the dynamic linker.
-// OutputRelocs: Relocation section '.rela.dyn' at offset 0x{{[0-9a-f]+}} contains 3 entries:
-// OutputRelocs: R_PPC64_TPREL64  {{0+}}  a + 0
-// OutputRelocs: R_PPC64_TPREL64  {{0+}}  b + 0
-// OutputRelocs: R_PPC64_TPREL64  {{0+}}  c + 0
-
-// Check that the got has 4 entires. (1 for the TOC and 3 entries for TLS
-// variables). Also verify the address so we can check
-// the offsets we calculated for each relocation type.
-// CheckGot: got          00000020 00000000100200c0
-
-// GOT stats at 0x100200c0, so TOC will be 0x100280c0
-
-// We are building the address of the first TLS got entry which contains the
-// offset of the tls variable relative to the thread pointer.
-// 0x100200c8 (got[1]).
-// #ha(a at got@tprel) --> (0x100200c8 - 0x100280c0 + 0x8000) >> 16 = 0
-// #lo(a at got@tprel)) --> (0x100200c8 - 0x100280c0) & 0xFFFF =  -7ff8 = -32760
-// Dis:  test_initial_exec:
-// Dis:    addis 3, 2, 0
-// Dis:    ld 3, -32760(3)
-// Dis:    lwzx 4, 3, 13
-
-// Second TLS got entry starts at got[2] 0x100200d0
-// #hi(b at got@tprel) --> (0x100200d0 - 0x100280c0) >> 16 = -1
-// Dis: test_hi:
-// Dis:   lis 3, -1
-
-// Third TLS got entry starts at got[3] 0x100200d8.
-// c at got@tprel--> (0x100200d8. -  0x100280c0) = -0x7fe8 = 32744
-// Dis: test_ds:
-// Dis:   li 3, -32744

Modified: lld/trunk/test/ELF/ppc64-plt-stub.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-plt-stub.s?rev=366424&r1=366423&r2=366424&view=diff
==============================================================================
--- lld/trunk/test/ELF/ppc64-plt-stub.s (original)
+++ lld/trunk/test/ELF/ppc64-plt-stub.s Thu Jul 18 03:43:07 2019
@@ -1,28 +1,37 @@
-// REQUIRES: ppc
+# 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 --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: ld.lld -shared %t2.o -o %t2.so
-// RUN: ld.lld %t.o %t2.so -o %t
-// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
-
-// CHECK:      Disassembly of section .text:
-// CHECK-EMPTY:
-// CHECK-NEXT: _start:
-// CHECK:      10010008: bl .+16
-
-// CHECK-LABEL: 0000000010010018 __plt_foo:
-// CHECK-NEXT:      std 2, 24(1)
-// CHECK-NEXT:      addis 12, 2, 0
-// CHECK-NEXT:      ld 12, 32560(12)
-// CHECK-NEXT:      mtctr 12
-// CHECK-NEXT:      bctr
+# 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 -soname=t2.so -o %t2.so
+# RUN: ld.lld %t.o %t2.so -o %t
+# RUN: llvm-readelf -S -d %t | FileCheck --check-prefix=SEC %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: ld.lld -shared %t2.o -soname=t2.so -o %t2.so
+# RUN: ld.lld %t.o %t2.so -o %t
+# RUN: llvm-readelf -S -d %t | FileCheck --check-prefix=SEC %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
+
+## DT_PLTGOT points to .plt
+# SEC: .plt NOBITS 0000000010030000 030000 000018
+# SEC: 0x0000000000000003 (PLTGOT) 0x10030000
+
+## .plt[0] holds the address of _dl_runtime_resolve.
+## .plt[1] holds the link map.
+## The JMP_SLOT relocation is stored at .plt[2]
+# RELOC: 0x10030010 R_PPC64_JMP_SLOT foo 0x0
+
+# CHECK:      _start:
+# CHECK:      10010008: bl .+16
+
+# CHECK-LABEL: 0000000010010018 __plt_foo:
+# CHECK-NEXT:      std 2, 24(1)
+# CHECK-NEXT:      addis 12, 2, 0
+# CHECK-NEXT:      ld 12, 32560(12)
+# CHECK-NEXT:      mtctr 12
+# CHECK-NEXT:      bctr
 
 
         .text

Removed: 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=366423&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-tls-gd-le-small.s (original)
+++ lld/trunk/test/ELF/ppc64-tls-gd-le-small.s (removed)
@@ -1,61 +0,0 @@
-# REQUIRES: ppc
-
-# RUN: llvm-mc -filetype=obj -triple=powerpc64le-unknown-linux %s -o %t.o
-# 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 --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 --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 --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
-# local-exec tls access.
-
-        .text
-        .abiversion 2
-
-        .global test
-        .p2align    4
-        .type test, @function
-
-test:
-.Lgep:
-    addis 2, 12, .TOC.-.Lgep at ha
-    addi  2, 2,  .TOC.-.Lgep at l
-    .localentry test, .-test
-    mflr 0
-    std 0, 16(1)
-    stdu 1, -32(1)
-    addi 3, 2, a at got@tlsgd
-    bl __tls_get_addr(a at tlsgd)
-    nop
-    lwz 3, 0(3)
-    addi 1, 1, 32
-    ld 0, 16(1)
-    mtlr 0
-    blr
-
-        .type a, @object
-        .section .tdata,"awT", at progbits
-        .global a
-        .p2align 2
-a:
-        .long 55
-        .size a, 4
-
-# CHECK-INPUT:       addi 3, 2, 0
-# CHECK-INPUT-NEXT:  R_PPC64_GOT_TLSGD16  a
-# CHECK-INPUT-NEXT:  bl .+0
-# CHECK-INPUT-NEXT:  R_PPC64_TLSGD        a
-# CHECK-INPUT-NEXT:  R_PPC64_REL24        __tls_get_addr
-
-# CHECK-DIS:      addis 3, 13, 0
-# CHECK-DIS-NEXT: nop
-# CHECK-DIS-NEXT: addi  3, 3, -28672
-# CHECK-DIS-NEXT: lwz 3, 0(3)
-
-# DYN-RELOCS: There are no relocations in this file

Removed: lld/trunk/test/ELF/ppc64-tls-gd-le.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-tls-gd-le.s?rev=366423&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-tls-gd-le.s (original)
+++ lld/trunk/test/ELF/ppc64-tls-gd-le.s (removed)
@@ -1,79 +0,0 @@
-// REQUIRES: ppc
-
-// 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-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-readelf -r %t | FileCheck --check-prefix=OutputRelocs %s
-
-	.text
-	.abiversion 2
-	.globl	_start                    # -- Begin function _start
-	.p2align	4
-	.type	_start, at function
-_start:                                   # @_start
-.Lfunc_begin0:
-.Lfunc_gep0:
-	addis 2, 12, .TOC.-.Lfunc_gep0 at ha
-	addi 2, 2, .TOC.-.Lfunc_gep0 at l
-.Lfunc_lep0:
-	.localentry	_start, .Lfunc_lep0-.Lfunc_gep0
-# %bb.0:                                # %entry
-	mflr 0
-	std 31, -8(1)
-	std 0, 16(1)
-	stdu 1, -64(1)
-	mr 31, 1
-	std 30, 48(31)                  # 8-byte Folded Spill
-	li 3, 0
-	stw 3, 44(31)
-	addis 3, 2, a at got@tlsgd at ha
-	addi 3, 3, a at got@tlsgd at l
-	bl __tls_get_addr(a at tlsgd)
-	nop
-	lwz 30, 0(3)
-	extsw 3, 30
-	ld 30, 48(31)                   # 8-byte Folded Reload
-	addi 1, 1, 64
-	ld 0, 16(1)
-	ld 31, -8(1)
-	mtlr 0
-	blr
-	.long	0
-	.quad	0
-.Lfunc_end0:
-	.size	_start, .Lfunc_end0-.Lfunc_begin0
-
-                                        # -- End function
-	.type	a, at object               # @a
-	.section	.tdata,"awT", at progbits
-	.globl	a
-	.p2align	2
-a:
-	.long	55                      # 0x37
-	.size	a, 4
-
-// Verify that the input has general-dynamic tls relocation types
-// InputRelocs:  Relocation section '.rela.text'
-// InputRelocs: R_PPC64_GOT_TLSGD16_HA  {{0+}}  a + 0
-// InputRelocs: R_PPC64_GOT_TLSGD16_LO  {{0+}}  a + 0
-// InputRelocs: R_PPC64_TLSGD           {{0+}}  a + 0
-
-// Verify that the general-dynamic sequence is  relaxed to local exec.
-// #ha(a at tprel) --> (0 - 0x7000 + 0x8000) >> 16 = 0
-// #lo(a at tprel)) --> (0 - 0x7000) &  0xFFFF =  -0x7000 = -28672
-// Dis: _start:
-// Dis: nop
-// Dis: addis 3, 13, 0
-// Dis: nop
-// Dis: addi 3, 3, -28672
-
-// Verify that no general-dynamic relocations exist for the dynamic linker.
-// OutputRelocs-NOT: R_PPC64_DTPMOD64
-// OutputRelocs-NOT: R_PPC64_DTPREL64

Added: lld/trunk/test/ELF/ppc64-tls-gd.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-tls-gd.s?rev=366424&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-tls-gd.s (added)
+++ lld/trunk/test/ELF/ppc64-tls-gd.s Thu Jul 18 03:43:07 2019
@@ -0,0 +1,102 @@
+# REQUIRES: ppc
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
+# RUN: echo '.tbss; .globl b, c; b: .zero 4; c:' | llvm-mc -filetype=obj -triple=powerpc64le - -o %t1.o
+# RUN: ld.lld -shared -soname=t1.so %t1.o -o %t1.so
+
+# RUN: ld.lld -shared %t.o %t1.o -o %t.so
+# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=GD-REL %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=GD %s
+
+# RUN: ld.lld %t.o %t1.o -o %t
+# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
+
+# RUN: ld.lld %t.o %t1.so -o %t
+# RUN: llvm-readobj -r %t | FileCheck --check-prefix=IE-REL %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=IE %s
+
+# GD-REL:      .rela.dyn {
+# GD-REL-NEXT:   0x200F0 R_PPC64_DTPMOD64 a 0x0
+# GD-REL-NEXT:   0x200F8 R_PPC64_DTPREL64 a 0x0
+# GD-REL-NEXT:   0x20100 R_PPC64_DTPMOD64 b 0x0
+# GD-REL-NEXT:   0x20108 R_PPC64_DTPREL64 b 0x0
+# GD-REL-NEXT:   0x20110 R_PPC64_DTPMOD64 c 0x0
+# GD-REL-NEXT:   0x20118 R_PPC64_DTPREL64 c 0x0
+# GD-REL-NEXT: }
+
+## &DTPMOD(a) - .TOC. = &.got[0] - (.got+0x8000) = -32768
+# GD:      addis 3, 2, 0
+# GD-NEXT: addi 3, 3, -32768
+# GD-NEXT: bl .+40
+# GD-NEXT: ld 2, 24(1)
+
+## &DTPMOD(b) - .TOC. = &.got[2] - (.got+0x8000) = -32752
+# GD-NEXT: addis 3, 2, 0
+# GD-NEXT: addi 3, 3, -32752
+# GD-NEXT: bl .+24
+# GD-NEXT: ld 2, 24(1)
+
+## &DTPMOD(b) - .TOC. = &.got[4] - (.got+0x8000) = -32736
+# GD-NEXT: li 3, -32736
+# GD-NEXT: bl .+12
+# GD-NEXT: ld 2, 24(1)
+
+# NOREL: no relocations
+
+## a at tprel = st_value(a)-0x7000 = -28664
+# LE:      nop
+# LE-NEXT: addis 3, 13, 0
+# LE-NEXT: nop
+# LE-NEXT: addi 3, 3, -28664
+## b at tprel = st_value(b)-0x7000 = -28660
+# LE:      nop
+# LE-NEXT: addis 3, 13, 0
+# LE-NEXT: nop
+# LE-NEXT: addi 3, 3, -28660
+## c at tprel = st_value(c)-0x7000 = -28656
+# LE-NEXT: addis 3, 13, 0
+# LE-NEXT: nop
+# LE-NEXT: addi 3, 3, -28656
+
+# IE-REL:      .rela.dyn {
+# IE-REL-NEXT:   0x100200C0 R_PPC64_TPREL64 b 0x0
+# IE-REL-NEXT:   0x100200C8 R_PPC64_TPREL64 c 0x0
+# IE-REL-NEXT: }
+
+## a is relaxed to use LE.
+## a at tprel = st_value(a)-0x7000 = -28664
+# IE:      nop
+# IE-NEXT: addis 3, 13, 0
+# IE-NEXT: nop
+# IE-NEXT: addi 3, 3, -28664
+## &DTPMOD(b) - .TOC. = &.got[0] - (.got+0x8000) = -32768
+# IE-NEXT: addis 3, 2, 0
+# IE-NEXT: ld 3, -32768(3)
+# IE-NEXT: nop
+# IE-NEXT: add 3, 3, 13
+## &DTPMOD(c) - .TOC. = &.got[1] - (.got+0x8000) = -32760
+## r0 is wrong. R_PPC64_GOT_TLS16 cannot be relaxed to IE but the behavior is
+## consistent with ld.bfd
+# IE-NEXT: ld 3, -32760(0)
+# IE-NEXT: nop
+# IE-NEXT: add 3, 3, 13
+
+addis 3, 2, a at got@tlsgd at ha
+addi 3, 3, a at got@tlsgd at l
+bl __tls_get_addr(a at tlsgd)
+nop
+
+addis 3, 2, b at got@tlsgd at ha
+addi 3, 3, b at got@tlsgd at l
+bl __tls_get_addr(b at tlsgd)
+nop
+
+addi 3, 0, c at got@tlsgd
+bl __tls_get_addr(c at tlsgd)
+nop
+
+.section .tbss
+.globl a
+.zero 8
+a:
+.zero 4

Removed: 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=366423&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-tls-ie-le.s (original)
+++ lld/trunk/test/ELF/ppc64-tls-ie-le.s (removed)
@@ -1,140 +0,0 @@
-// 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-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 --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 --no-show-raw-insn %t | FileCheck --check-prefix=Dis %s
-
-	.text
-	.abiversion 2
-test1:                                  # @test1
-	addis 3, 2, c at got@tprel at ha
-	ld 3, c at got@tprel at l(3)
-	lbzx 3, 3, c at tls
-	blr
-test2:                                  # @test2
-	addis 3, 2, s at got@tprel at ha
-	ld 3, s at got@tprel at l(3)
-	lhzx 3, 3, s at tls
-	blr
-test3:                                  # @test3
-	addis 3, 2, i at got@tprel at ha
-	ld 3, i at got@tprel at l(3)
-	lwzx 3, 3, i at tls
-	blr
-test4:                                  # @test4
-	addis 3, 2, l at got@tprel at ha
-	ld 3, l at got@tprel at l(3)
-	ldx 3, 3, l at tls
-	blr
-test5:                                  # @test5
-	addis 4, 2, c at got@tprel at ha
-	ld 4, c at got@tprel at l(4)
-	stbx 3, 4, c at tls
-	blr
-test6:                                  # @test6
-	addis 4, 2, s at got@tprel at ha
-	ld 4, s at got@tprel at l(4)
-	sthx 3, 4, s at tls
-	blr
-test7:                                  # @test7
-	addis 4, 2, i at got@tprel at ha
-	ld 4, i at got@tprel at l(4)
-	stwx 3, 4, i at tls
-	blr
-test8:                                  # @test8
-	addis 4, 2, l at got@tprel at ha
-	ld 4, l at got@tprel at l(4)
-	stdx 3, 4, l at tls
-	blr
-test9:                                  # @test9
-	addis 3, 2, i at got@tprel at ha
-	ld 3, i at got@tprel at l(3)
-	add 3, 3, i at tls
-	blr
-test_ds:                                  # @test_ds
-	ld 4, l at got@tprel(2)
-	stdx 3, 4, l at tls
-	blr
-
-
-// Verify that the input has initial-exec tls relocation types.
-// InputRelocs: Relocation section '.rela.text'
-// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} c + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} c + 0
-// InputRelocs: R_PPC64_TLS {{0+}} c + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} s + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} s + 0
-// InputRelocs: R_PPC64_TLS {{0+}} s + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} i + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} i + 0
-// InputRelocs: R_PPC64_TLS {{0+}} i + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_HA {{0+}} l + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_LO_DS {{0+}} l + 0
-// InputRelocs: R_PPC64_TLS {{0+}} l + 0
-// InputRelocs: R_PPC64_GOT_TPREL16_DS {{0+}} l + 0
-// InputRelocs: R_PPC64_TLS {{0+}} l + 0
-
-// Verify that no initial-exec relocations exist for the dynamic linker.
-// OutputRelocs-NOT: R_PPC64_TPREL64  {{0+}}  c + 0
-// OutputRelocs-NPT: R_PPC64_TPREL64  {{0+}}  s + 0
-// OutputRelocs-NOT: R_PPC64_TPREL64  {{0+}}  i + 0
-// OutputRelocs-NOT: R_PPC64_TPREL64  {{0+}}  l + 0
-
-// Dis: test1:
-// Dis: nop
-// Dis: addis 3, 13, 0
-// Dis: lbz 3, -28672(3)
-
-// Dis: test2:
-// Dis: nop
-// Dis: addis 3, 13, 0
-// Dis: lhz 3, -28670(3)
-
-// Dis: test3:
-// Dis: nop
-// Dis: addis 3, 13, 0
-// Dis: lwz 3, -28668(3)
-
-// Dis: test4:
-// Dis: nop
-// Dis: addis 3, 13, 0
-// Dis: ld 3, -28664(3)
-
-// Dis: test5:
-// Dis: nop
-// Dis: addis 4, 13, 0
-// Dis: stb 3, -28672(4)
-
-// Dis: test6:
-// Dis: nop
-// Dis: addis 4, 13, 0
-// Dis: sth 3, -28670(4)
-
-// Dis: test7:
-// Dis: nop
-// Dis: addis 4, 13, 0
-// Dis: stw 3, -28668(4)
-
-// Dis: test8:
-// Dis: nop
-// Dis: addis 4, 13, 0
-// Dis: std 3, -28664(4)
-
-// Dis: test9:
-// Dis: nop
-// Dis: addis 3, 13, 0
-// Dis: addi 3, 3, -28668
-
-// Dis: test_ds:
-// Dis: addis 4, 13, 0
-// Dis: std 3, -28664(4)

Added: lld/trunk/test/ELF/ppc64-tls-ie.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/ppc64-tls-ie.s?rev=366424&view=auto
==============================================================================
--- lld/trunk/test/ELF/ppc64-tls-ie.s (added)
+++ lld/trunk/test/ELF/ppc64-tls-ie.s Thu Jul 18 03:43:07 2019
@@ -0,0 +1,171 @@
+# REQUIRES: ppc
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64le %s -o %t.o
+# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s
+## IE
+# RUN: ld.lld -shared %t.o -o %t.so
+# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=IE-REL %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s
+## IE -> LE
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
+
+# RUN: llvm-mc -filetype=obj -triple=powerpc64 %s -o %t.o
+# RUN: llvm-readobj -r %t.o | FileCheck --check-prefix=INPUT-REL %s
+## IE
+# RUN: ld.lld -shared %t.o -o %t.so
+# RUN: llvm-readobj -r %t.so | FileCheck --check-prefix=IE-REL %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t.so | FileCheck --check-prefix=IE %s
+## IE -> LE
+# RUN: ld.lld %t.o -o %t
+# RUN: llvm-readelf -r %t | FileCheck --check-prefix=NOREL %s
+# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck --check-prefix=LE %s
+
+# IE-REL:      .rela.dyn {
+# IE-REL-NEXT:   0x200B0 R_PPC64_TPREL64 c 0x0
+# IE-REL-NEXT:   0x200C0 R_PPC64_TPREL64 i 0x0
+# IE-REL-NEXT:   0x200C8 R_PPC64_TPREL64 l 0x0
+# IE-REL-NEXT:   0x200B8 R_PPC64_TPREL64 s 0x0
+# IE-REL-NEXT: }
+
+# INPUT-REL: R_PPC64_GOT_TPREL16_HA c 0x0
+# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS c 0x0
+# INPUT-REL: R_PPC64_TLS c 0x0
+## &.got[0] - .TOC. = -32768
+# IE-LABEL: test1:
+# IE-NEXT:  addis 3, 2, 0
+# IE-NEXT:  ld 3, -32768(3)
+# IE-NEXT:  lbzx 3, 3, 13
+# LE-LABEL: test1:
+# LE-NEXT:   nop
+# LE-NEXT:   addis 3, 13, 0
+# LE-NEXT:   lbz 3, -28672(3)
+test1:
+  addis 3, 2, c at got@tprel at ha
+  ld 3, c at got@tprel at l(3)
+  lbzx 3, 3, c at tls
+
+# INPUT-REL: R_PPC64_GOT_TPREL16_HA s 0x0
+# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS s 0x0
+# INPUT-REL: R_PPC64_TLS s 0x0
+## &.got[1] - .TOC. = -32760
+# IE-LABEL: test2:
+# IE-NEXT:  addis 3, 2, 0
+# IE-NEXT:  ld 3, -32760(3)
+# IE-NEXT:  lhzx 3, 3, 13
+# LE-LABEL: test2:
+# LE-NEXT:  nop
+# LE-NEXT:  addis 3, 13, 0
+# LE-NEXT:  lhz 3, -28670(3)
+test2:
+  addis 3, 2, s at got@tprel at ha
+  ld 3, s at got@tprel at l(3)
+  lhzx 3, 3, s at tls
+
+# INPUT-REL: R_PPC64_GOT_TPREL16_HA i 0x0
+# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS i 0x0
+# INPUT-REL: R_PPC64_TLS i 0x0
+## &.got[2] - .TOC. = -32752
+# IE-LABEL: test3:
+# IE-NEXT:  addis 3, 2, 0
+# IE-NEXT:  ld 3, -32752(3)
+# IE-NEXT:  lwzx 3, 3, 13
+# LE-LABEL: test3:
+# LE-NEXT:  nop
+# LE-NEXT:  addis 3, 13, 0
+# LE-NEXT:  lwz 3, -28668(3)
+test3:
+  addis 3, 2, i at got@tprel at ha
+  ld 3, i at got@tprel at l(3)
+  lwzx 3, 3, i at tls
+
+# INPUT-REL: R_PPC64_GOT_TPREL16_HA l 0x0
+# INPUT-REL: R_PPC64_GOT_TPREL16_LO_DS l 0x0
+# INPUT-REL: R_PPC64_TLS l 0x0
+## &.got[3] - .TOC. = -32744
+# IE-LABEL: test4:
+# IE-NEXT:  addis 3, 2, 0
+# IE-NEXT:  ld 3, -32744(3)
+# IE-NEXT:  ldx 3, 3, 13
+# LE-LABEL: test4:
+# LE-NEXT:  nop
+# LE-NEXT:  addis 3, 13, 0
+# LE-NEXT:  ld 3, -28664(3)
+test4:
+  addis 3, 2, l at got@tprel at ha
+  ld 3, l at got@tprel at l(3)
+  ldx 3, 3, l at tls
+
+# LE-LABEL: test5:
+# LE-NEXT:  nop
+# LE-NEXT:  addis 4, 13, 0
+# LE-NEXT: stb 3, -28672(4)
+test5:
+  addis 4, 2, c at got@tprel at ha
+  ld 4, c at got@tprel at l(4)
+  stbx 3, 4, c at tls
+
+
+# LE-LABEL: test6:
+# LE-NEXT:  nop
+# LE-NEXT:  addis 4, 13, 0
+# LE-NEXT: sth 3, -28670(4)
+test6:
+  addis 4, 2, s at got@tprel at ha
+  ld 4, s at got@tprel at l(4)
+  sthx 3, 4, s at tls
+
+
+# LE-LABEL: test7:
+# LE-NEXT:  nop
+# LE-NEXT:  addis 4, 13, 0
+# LE-NEXT: stw 3, -28668(4)
+test7:
+  addis 4, 2, i at got@tprel at ha
+  ld 4, i at got@tprel at l(4)
+  stwx 3, 4, i at tls
+
+# LE-LABEL: test8:
+# LE-NEXT:  nop
+# LE-NEXT:  addis 4, 13, 0
+# LE-NEXT: std 3, -28664(4)
+test8:
+  addis 4, 2, l at got@tprel at ha
+  ld 4, l at got@tprel at l(4)
+  stdx 3, 4, l at tls
+
+# LE-LABEL: test9:
+# LE-NEXT:  nop
+# LE-NEXT:  addis 3, 13, 0
+# LE-NEXT:  addi 3, 3, -28668
+test9:
+  addis 3, 2, i at got@tprel at ha
+  ld 3, i at got@tprel at l(3)
+  add 3, 3, i at tls
+
+# LE-LABEL: test_ds:
+# LE-NEXT:  addis 4, 13, 0
+# LE-NEXT: std 3, -28664(4)
+test_ds:
+  ld 4, l at got@tprel(2)
+  stdx 3, 4, l at tls
+
+# NOREL: There are no relocations in this file.
+
+.section .tdata,"awT", at progbits
+.globl c, s, i, l
+c:
+.byte 97
+
+.p2align 1
+s:
+.short 55
+
+.p2align 2
+i:
+.long 55
+
+.p2align 3
+l:
+.quad 55




More information about the llvm-commits mailing list