mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-18 05:57:10 +00:00
[ELF][test] Reorganize some AArch64 tests
Delete aarch64-got.s because it is covered by aarch64-tls-iele.s Merge got-aarch64.s into aarch64-fpic-got.s by adding disassembly to the latter Create aarch64-gnu-ifunc-nonpreemptable to unify aarch64-gnu-ifunc3.s (position-dependent executable) and aarch64-gnu-ifunc-address-pie.s (PIE) Rename aarch64-got-reloc.s to aarch64-got-weak-undef.s Add --no-show-raw-insn to llvm-objdump -d RUN lines Add -pie test to arch64-tls-iele.s Delete aarch64-tls-pie.s: it is covered by arch64-tls-iele.s and aarch64-tls-le.s Rename aarch64-copy2.s to aarch64-nopic-plt.s: "copy2" gives false impression that the test is related to copy relocation llvm-svn: 362294
This commit is contained in:
parent
73f0584199
commit
bcc0bd7e2a
@ -3,14 +3,22 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %s -o %t.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux %p/Inputs/shared.s -o %t-lib.o
|
||||
# RUN: ld.lld -shared %t-lib.o -o %t-lib.so
|
||||
|
||||
# RUN: ld.lld %t-lib.so %t.o -o %t.exe
|
||||
# RUN: llvm-readobj --dyn-relocations %t.exe | FileCheck %s
|
||||
# RUN: llvm-readobj -r %t.exe | FileCheck --check-prefix=RELOC %s
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %t.exe | FileCheck --check-prefix=DIS %s
|
||||
|
||||
## Checks if got access to dynamic objects is done through a got relative
|
||||
## dynamic relocation and not using plt relative (R_AARCH64_JUMP_SLOT).
|
||||
# CHECK: Dynamic Relocations {
|
||||
# CHECK-NEXT: 0x{{[0-9A-F]+}} R_AARCH64_GLOB_DAT bar 0x0
|
||||
# CHECK-NEXT: }
|
||||
# RELOC: .rela.dyn {
|
||||
# RELOC-NEXT: 0x2200C0 R_AARCH64_GLOB_DAT bar 0x0
|
||||
# RELOC-NEXT: }
|
||||
|
||||
## page(0x2200C0) - page(0x210000) = 65536
|
||||
## page(0x2200C0) & 0xff8 = 192
|
||||
# DIS: _start:
|
||||
# DIS-NEXT: 210000: adrp x0, #65536
|
||||
# DIS-NEXT: 210004: ldr x0, [x0, #192]
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
|
@ -1,49 +0,0 @@
|
||||
# REQUIRES: aarch64
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
|
||||
# RUN: ld.lld -pie %t.o -o %tout
|
||||
# RUN: llvm-objdump -D %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -r %tout | FileCheck %s -check-prefix=CHECK-RELOCS
|
||||
|
||||
# Test that when we take the address of a preemptible ifunc using -fpie, we can
|
||||
# handle the case when the ifunc is in the same translation unit as the address
|
||||
# taker. In this case the compiler knows that ifunc is not defined in a shared
|
||||
# library so it can use a non got generating relative reference.
|
||||
.text
|
||||
.globl myfunc
|
||||
.type myfunc,@gnu_indirect_function
|
||||
myfunc:
|
||||
.globl myfunc_resolver
|
||||
.type myfunc_resolver,@function
|
||||
myfunc_resolver:
|
||||
ret
|
||||
|
||||
.text
|
||||
.globl main
|
||||
.type main,@function
|
||||
main:
|
||||
adrp x8, myfunc
|
||||
add x8, x8, :lo12: myfunc
|
||||
ret
|
||||
|
||||
# CHECK: 0000000000010000 myfunc_resolver:
|
||||
# CHECK-NEXT: 10000: c0 03 5f d6 ret
|
||||
# CHECK: 0000000000010004 main:
|
||||
# CHECK-NEXT: 10004: 08 00 00 90 adrp x8, #0
|
||||
# x8 = 0x10000
|
||||
# CHECK-NEXT: 10008: 08 41 00 91 add x8, x8, #16
|
||||
# x8 = 0x10010 = .plt for myfunc
|
||||
# CHECK-NEXT: 1000c: c0 03 5f d6 ret
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: Disassembly of section .plt:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: 0000000000010010 myfunc:
|
||||
# CHECK-NEXT: 10010: 10 01 00 90 adrp x16, #131072
|
||||
# CHECK-NEXT: 10014: 11 02 40 f9 ldr x17, [x16]
|
||||
# CHECK-NEXT: 10018: 10 02 00 91 add x16, x16, #0
|
||||
# CHECK-NEXT: 1001c: 20 02 1f d6 br x17
|
||||
|
||||
# CHECK-RELOCS: Relocations [
|
||||
# CHECK-RELOCS-NEXT: Section {{.*}} .rela.plt {
|
||||
# CHECK-RELOCS-NEXT: 0x30000 R_AARCH64_IRELATIVE - 0x10000
|
||||
# CHECK-RELOCS-NEXT: }
|
||||
# CHECK-RELOCS-NEXT: ]
|
@ -1,7 +1,7 @@
|
||||
# REQUIRES: aarch64
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
|
||||
# RUN: ld.lld -shared %t.o -o %tout
|
||||
# RUN: llvm-objdump -D %tout | FileCheck %s
|
||||
# RUN: llvm-objdump -D --no-show-raw-insn %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -r %tout | FileCheck %s --check-prefix=CHECK-RELOCS
|
||||
|
||||
# Test that when we take the address of a preemptible ifunc in a shared object
|
||||
@ -22,10 +22,10 @@ main:
|
||||
ret
|
||||
# CHECK: 0000000000010004 main:
|
||||
# x8 = 0x20000
|
||||
# CHECK-NEXT: 10004: 88 00 00 90 adrp x8, #65536
|
||||
# CHECK-NEXT: 10004: adrp x8, #65536
|
||||
# x8 = 0x200a0 = .got entry for myfunc with R_AARCH64_GLOB_DAT
|
||||
# CHECK-NEXT: 10008: 08 51 40 f9 ldr x8, [x8, #160]
|
||||
# CHECK-NEXT: 1000c: c0 03 5f d6 ret
|
||||
# CHECK-NEXT: 10008: ldr x8, [x8, #160]
|
||||
# CHECK-NEXT: 1000c: ret
|
||||
|
||||
# CHECK: Disassembly of section .got:
|
||||
# CHECK-EMPTY:
|
||||
|
72
lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
Normal file
72
lld/test/ELF/aarch64-gnu-ifunc-nonpreemptable.s
Normal file
@ -0,0 +1,72 @@
|
||||
# REQUIRES: aarch64
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
|
||||
|
||||
# RUN: ld.lld %t.o -o %t
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefix=PDE
|
||||
# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=PDE-RELOC
|
||||
|
||||
# RUN: ld.lld -pie %t.o -o %t
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s --check-prefix=PIE
|
||||
# RUN: llvm-readobj -r %t | FileCheck %s --check-prefix=PIE-RELOC
|
||||
|
||||
## When compiling with -fno-PIE or -fPIE, if the ifunc is in the same
|
||||
## translation unit as the address taker, the compiler knows that ifunc is not
|
||||
## defined in a shared library so it can use a non GOT generating relative reference.
|
||||
.text
|
||||
.globl myfunc
|
||||
.type myfunc,@gnu_indirect_function
|
||||
myfunc:
|
||||
.globl myfunc_resolver
|
||||
.type myfunc_resolver,@function
|
||||
myfunc_resolver:
|
||||
ret
|
||||
|
||||
.text
|
||||
.globl main
|
||||
.type main,@function
|
||||
main:
|
||||
adrp x8, myfunc
|
||||
add x8, x8, :lo12: myfunc
|
||||
ret
|
||||
|
||||
## The address of myfunc is the address of the PLT entry for myfunc.
|
||||
# PDE: myfunc_resolver:
|
||||
# PDE-NEXT: 210000: ret
|
||||
# PDE: main:
|
||||
# PDE-NEXT: 210004: adrp x8, #0
|
||||
# PDE-NEXT: 210008: add x8, x8, #16
|
||||
# PDE-NEXT: 21000c: ret
|
||||
# PDE-EMPTY:
|
||||
# PDE-NEXT: Disassembly of section .plt:
|
||||
# PDE-EMPTY:
|
||||
# PDE-NEXT: myfunc:
|
||||
## page(.got.plt) - page(0x210010) = 65536
|
||||
# PDE-NEXT: 210010: adrp x16, #65536
|
||||
# PDE-NEXT: 210014: ldr x17, [x16]
|
||||
# PDE-NEXT: 210018: add x16, x16, #0
|
||||
# PDE-NEXT: 21001c: br x17
|
||||
|
||||
## The adrp to myfunc should generate a PLT entry and a GOT entry with an
|
||||
## irelative relocation.
|
||||
# PDE-RELOC: .rela.plt {
|
||||
# PDE-RELOC-NEXT: 0x220000 R_AARCH64_IRELATIVE - 0x210000
|
||||
# PDE-RELOC-NEXT: }
|
||||
|
||||
# PIE: myfunc_resolver:
|
||||
# PIE-NEXT: 10000: ret
|
||||
# PIE: main:
|
||||
# PIE-NEXT: 10004: adrp x8, #0
|
||||
# PIE-NEXT: 10008: add x8, x8, #16
|
||||
# PIE-NEXT: 1000c: ret
|
||||
# PIE-EMPTY:
|
||||
# PIE-NEXT: Disassembly of section .plt:
|
||||
# PIE-EMPTY:
|
||||
# PIE-NEXT: myfunc:
|
||||
# PIE-NEXT: 10010: adrp x16, #131072
|
||||
# PIE-NEXT: 10014: ldr x17, [x16]
|
||||
# PIE-NEXT: 10018: add x16, x16, #0
|
||||
# PIE-NEXT: 1001c: br x17
|
||||
|
||||
# PIE-RELOC: .rela.plt {
|
||||
# PIE-RELOC-NEXT: 0x30000 R_AARCH64_IRELATIVE - 0x10000
|
||||
# PIE-RELOC-NEXT: }
|
@ -1,57 +0,0 @@
|
||||
# REQUIRES: aarch64
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
|
||||
# RUN: ld.lld -static %t.o -o %tout
|
||||
# RUN: llvm-objdump -D %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -r %tout | FileCheck %s --check-prefix=RELOC
|
||||
|
||||
# The address of myfunc is the address of the PLT entry for myfunc.
|
||||
# The adrp to myfunc should generate a PLT entry and a got entry with an
|
||||
# irelative relocation.
|
||||
.text
|
||||
.globl myfunc
|
||||
.type myfunc,@gnu_indirect_function
|
||||
myfunc:
|
||||
.globl myfunc_resolver
|
||||
.type myfunc_resolver,@function
|
||||
myfunc_resolver:
|
||||
ret
|
||||
|
||||
.text
|
||||
.globl _start
|
||||
.type _start,@function
|
||||
_start:
|
||||
adrp x8, myfunc
|
||||
add x8, x8, :lo12:myfunc
|
||||
ret
|
||||
|
||||
# CHECK: Disassembly of section .text:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: myfunc_resolver:
|
||||
# CHECK-NEXT: 210000: c0 03 5f d6 ret
|
||||
# CHECK: _start:
|
||||
# adrp x8, 0x210000 + 0x10 from add == .plt entry
|
||||
# CHECK-NEXT: 210004: 08 00 00 90 adrp x8, #0
|
||||
# CHECK-NEXT: 210008: 08 41 00 91 add x8, x8, #16
|
||||
# CHECK-NEXT: 21000c: c0 03 5f d6 ret
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: Disassembly of section .plt:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: myfunc:
|
||||
# adrp x16, 0x220000, 0x220000 == address in .got.plt
|
||||
# CHECK-NEXT: 210010: 90 00 00 90 adrp x16, #65536
|
||||
# CHECK-NEXT: 210014: 11 02 40 f9 ldr x17, [x16]
|
||||
# CHECK-NEXT: 210018: 10 02 00 91 add x16, x16, #0
|
||||
# CHECK-NEXT: 21001c: 20 02 1f d6 br x17
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: Disassembly of section .got.plt:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK-NEXT: .got.plt:
|
||||
# 0x210010 == address in .plt
|
||||
# CHECK-NEXT: 220000: 10 00 21 00
|
||||
# CHECK-NEXT: 220004: 00 00 00 00
|
||||
|
||||
# RELOC: Relocations [
|
||||
# RELOC-NEXT: Section (1) .rela.plt {
|
||||
# RELOC-NEXT: 0x220000 R_AARCH64_IRELATIVE - 0x210000
|
||||
# RELOC-NEXT: }
|
||||
# RELOC-NEXT: ]
|
@ -1,30 +0,0 @@
|
||||
// REQUIRES: aarch64
|
||||
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
|
||||
// RUN: ld.lld %t.o -o %t
|
||||
// RUN: llvm-readobj -S --section-data %t | FileCheck %s
|
||||
|
||||
// CHECK: Name: .got
|
||||
// CHECK-NEXT: Type: SHT_PROGBITS
|
||||
// CHECK-NEXT: Flags [
|
||||
// CHECK-NEXT: SHF_ALLOC
|
||||
// CHECK-NEXT: SHF_WRITE
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Address:
|
||||
// CHECK-NEXT: Offset:
|
||||
// CHECK-NEXT: Size: 8
|
||||
// CHECK-NEXT: Link: 0
|
||||
// CHECK-NEXT: Info: 0
|
||||
// CHECK-NEXT: AddressAlignment: 8
|
||||
// CHECK-NEXT: EntrySize: 0
|
||||
// CHECK-NEXT: SectionData (
|
||||
// CHECK-NEXT: 0000: 00000000 00000000 |........|
|
||||
// CHECK-NEXT: )
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
adrp x8, :got:foo
|
||||
ldr x8, [x8, :got_lo12:foo]
|
||||
ldr w0, [x8]
|
||||
ret
|
||||
|
||||
.weak foo
|
18
lld/test/ELF/aarch64-got-weak-undef.s
Normal file
18
lld/test/ELF/aarch64-got-weak-undef.s
Normal file
@ -0,0 +1,18 @@
|
||||
// REQUIRES: aarch64
|
||||
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-freebsd %s -o %t.o
|
||||
// RUN: ld.lld %t.o -o %t
|
||||
// RUN: llvm-readelf -r %t | FileCheck --check-prefix=RELOC %s
|
||||
// RUN: llvm-readelf -x .got %t | FileCheck %s
|
||||
|
||||
// RELOC: no relocations
|
||||
|
||||
// CHECK: 0x00220000 00000000 00000000
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
adrp x8, :got:foo
|
||||
ldr x8, [x8, :got_lo12:foo]
|
||||
ldr w0, [x8]
|
||||
ret
|
||||
|
||||
.weak foo
|
@ -1,18 +0,0 @@
|
||||
# REQUIRES: aarch64
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %t.o
|
||||
# RUN: ld.lld %t.o -o %t
|
||||
# RUN: llvm-readobj -S %t | FileCheck %s
|
||||
|
||||
# CHECK-NOT: Name: .got
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
adrp x0, :gottprel:foo
|
||||
|
||||
.global foo
|
||||
.section .tdata,"awT",%progbits
|
||||
.align 2
|
||||
.type foo, %object
|
||||
.size foo, 4
|
||||
foo:
|
||||
.word 5
|
@ -4,7 +4,7 @@
|
||||
// RUN: ld.lld %t2.o -o %t2.so -shared
|
||||
// RUN: ld.lld --hash-style=sysv %t.o %t2.so -o %t
|
||||
// RUN: llvm-readobj -S %t | FileCheck --check-prefix=SEC %s
|
||||
// RUN: llvm-objdump -d %t | FileCheck %s
|
||||
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
@ -27,8 +27,8 @@ _start:
|
||||
// 0x0B0 = 176
|
||||
|
||||
// CHECK: _start:
|
||||
// CHECK-NEXT: 210000: {{.*}} nop
|
||||
// CHECK-NEXT: 210004: {{.*}} adrp x0, #65536
|
||||
// CHECK-NEXT: 210008: {{.*}} ldr x0, [x0, #176]
|
||||
// CHECK-NEXT: 21000c: {{.*}} nop
|
||||
// CHECK-NEXT: 210010: {{.*}} nop
|
||||
// CHECK-NEXT: 210000: nop
|
||||
// CHECK-NEXT: 210004: adrp x0, #65536
|
||||
// CHECK-NEXT: 210008: ldr x0, [x0, #176]
|
||||
// CHECK-NEXT: 21000c: nop
|
||||
// CHECK-NEXT: 210010: nop
|
||||
|
@ -2,21 +2,21 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %p/Inputs/aarch64-tls-ie.s -o %ttlsie.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %tmain.o
|
||||
# RUN: ld.lld %tmain.o %ttlsie.o -o %tout
|
||||
# RUN: llvm-objdump -d %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -S -r %tout | FileCheck -check-prefix=RELOC %s
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -r %tout | FileCheck -check-prefix=RELOC %s
|
||||
|
||||
#Local-Dynamic to Local-Exec relax creates no
|
||||
#RELOC: Relocations [
|
||||
#RELOC-NEXT: ]
|
||||
## Local-Dynamic to Local-Exec relax creates no dynamic relocations.
|
||||
# RELOC: Relocations [
|
||||
# RELOC-NEXT: ]
|
||||
|
||||
# TCB size = 0x16 and foo is first element from TLS register.
|
||||
# CHECK: Disassembly of section .text:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK: _start:
|
||||
# CHECK: 210000: 00 00 a0 d2 movz x0, #0, lsl #16
|
||||
# CHECK: 210004: 00 02 80 f2 movk x0, #16
|
||||
# CHECK: 210008: 1f 20 03 d5 nop
|
||||
# CHECK: 21000c: 1f 20 03 d5 nop
|
||||
# CHECK: 210000: movz x0, #0, lsl #16
|
||||
# CHECK: 210004: movk x0, #16
|
||||
# CHECK: 210008: nop
|
||||
# CHECK: 21000c: nop
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
|
@ -1,45 +1,43 @@
|
||||
// REQUIRES: aarch64
|
||||
# REQUIRES: aarch64
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %p/Inputs/aarch64-tls-ie.s -o %tdso.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-freebsd %s -o %tmain.o
|
||||
# RUN: ld.lld -shared %tdso.o -o %tdso.so
|
||||
# RUN: ld.lld --hash-style=sysv %tmain.o %tdso.so -o %tout
|
||||
# RUN: llvm-objdump -d %tout | FileCheck %s
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -S -r %tout | FileCheck -check-prefix=RELOC %s
|
||||
|
||||
#RELOC: Section {
|
||||
#RELOC: Index:
|
||||
#RELOC: Name: .got
|
||||
#RELOC-NEXT: Type: SHT_PROGBITS
|
||||
#RELOC-NEXT: Flags [
|
||||
#RELOC-NEXT: SHF_ALLOC
|
||||
#RELOC-NEXT: SHF_WRITE
|
||||
#RELOC-NEXT: ]
|
||||
#RELOC-NEXT: Address: 0x2200B0
|
||||
#RELOC-NEXT: Offset: 0x200B0
|
||||
#RELOC-NEXT: Size: 16
|
||||
#RELOC-NEXT: Link: 0
|
||||
#RELOC-NEXT: Info: 0
|
||||
#RELOC-NEXT: AddressAlignment: 8
|
||||
#RELOC-NEXT: EntrySize: 0
|
||||
#RELOC-NEXT: }
|
||||
#RELOC: Relocations [
|
||||
#RELOC-NEXT: Section ({{.*}}) .rela.dyn {
|
||||
#RELOC-NEXT: 0x2200B8 R_AARCH64_TLS_TPREL64 bar 0x0
|
||||
#RELOC-NEXT: 0x2200B0 R_AARCH64_TLS_TPREL64 foo 0x0
|
||||
#RELOC-NEXT: }
|
||||
#RELOC-NEXT:]
|
||||
# RELOC: Section {
|
||||
# RELOC: Index:
|
||||
# RELOC: Name: .got
|
||||
# RELOC-NEXT: Type: SHT_PROGBITS
|
||||
# RELOC-NEXT: Flags [
|
||||
# RELOC-NEXT: SHF_ALLOC
|
||||
# RELOC-NEXT: SHF_WRITE
|
||||
# RELOC-NEXT: ]
|
||||
# RELOC-NEXT: Address: 0x2200B0
|
||||
# RELOC-NEXT: Offset: 0x200B0
|
||||
# RELOC-NEXT: Size: 16
|
||||
# RELOC-NEXT: Link: 0
|
||||
# RELOC-NEXT: Info: 0
|
||||
# RELOC-NEXT: AddressAlignment: 8
|
||||
# RELOC-NEXT: EntrySize: 0
|
||||
# RELOC-NEXT: }
|
||||
# RELOC: Relocations [
|
||||
# RELOC-NEXT: Section ({{.*}}) .rela.dyn {
|
||||
# RELOC-NEXT: 0x2200B8 R_AARCH64_TLS_TPREL64 bar 0x0
|
||||
# RELOC-NEXT: 0x2200B0 R_AARCH64_TLS_TPREL64 foo 0x0
|
||||
# RELOC-NEXT: }
|
||||
# RELOC-NEXT:]
|
||||
|
||||
# Page(0x2200B0) - Page(0x210000) = 0x10000 = 65536
|
||||
# 0x2200B0 & 0xff8 = 0xB0 = 176
|
||||
# Page(0x2200B8) - Page(0x210000) = 0x10000 = 65536
|
||||
# 0x2200B8 & 0xff8 = 0xB8 = 184
|
||||
#CHECK: Disassembly of section .text:
|
||||
#CHECK: _start:
|
||||
#CHECK: 210000: 80 00 00 90 adrp x0, #65536
|
||||
#CHECK: 210004: 00 58 40 f9 ldr x0, [x0, #176]
|
||||
#CHECK: 210008: 80 00 00 90 adrp x0, #65536
|
||||
#CHECK: 21000c: 00 5c 40 f9 ldr x0, [x0, #184]
|
||||
## Page(0x2200B0) - Page(0x210000) = 0x10000 = 65536
|
||||
## 0x2200B0 & 0xff8 = 0xB0 = 176
|
||||
## Page(0x2200B8) - Page(0x210000) = 0x10000 = 65536
|
||||
## 0x2200B8 & 0xff8 = 0xB8 = 184
|
||||
# CHECK: _start:
|
||||
# CHECK-NEXT: 210000: adrp x0, #65536
|
||||
# CHECK-NEXT: 210004: ldr x0, [x0, #176]
|
||||
# CHECK-NEXT: 210008: adrp x0, #65536
|
||||
# CHECK-NEXT: 21000c: ldr x0, [x0, #184]
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
|
@ -2,8 +2,12 @@
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %p/Inputs/aarch64-tls-ie.s -o %ttlsie.o
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %tmain.o
|
||||
# RUN: ld.lld %tmain.o %ttlsie.o -o %tout
|
||||
# RUN: llvm-objdump -d %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -S -r %tout | FileCheck -check-prefix=RELOC %s
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -r %tout | FileCheck -check-prefix=RELOC %s
|
||||
|
||||
# RUN: ld.lld -pie %tmain.o %ttlsie.o -o %tout
|
||||
# RUN: llvm-objdump -d --no-show-raw-insn %tout | FileCheck %s
|
||||
# RUN: llvm-readobj -r %tout | FileCheck -check-prefix=RELOC %s
|
||||
|
||||
# Initial-Exec to Local-Exec relax creates no dynamic relocations.
|
||||
# RELOC: Relocations [
|
||||
@ -13,10 +17,10 @@
|
||||
# CHECK: Disassembly of section .text:
|
||||
# CHECK-EMPTY:
|
||||
# CHECK: _start:
|
||||
# CHECK-NEXT: 210000: 00 00 a0 d2 movz x0, #0, lsl #16
|
||||
# CHECK-NEXT: 210004: 80 02 80 f2 movk x0, #20
|
||||
# CHECK-NEXT: 210008: 00 00 a0 d2 movz x0, #0, lsl #16
|
||||
# CHECK-NEXT: 21000c: 00 02 80 f2 movk x0, #16
|
||||
# CHECK-NEXT: movz x0, #0, lsl #16
|
||||
# CHECK-NEXT: movk x0, #20
|
||||
# CHECK-NEXT: movz x0, #0, lsl #16
|
||||
# CHECK-NEXT: movk x0, #16
|
||||
|
||||
.section .tdata
|
||||
.align 2
|
||||
|
@ -1,28 +0,0 @@
|
||||
# REQUIRES: aarch64
|
||||
# RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-cloudabi %s -o %t1.o
|
||||
# RUN: ld.lld -pie %t1.o -o %t
|
||||
# RUN: llvm-readobj -r %t | FileCheck %s
|
||||
|
||||
# Similar to bug 27174: R_AARCH64_TLSLE_*TPREL* relocations should be
|
||||
# eliminated when building a PIE executable, as the static TLS layout is
|
||||
# fixed.
|
||||
#
|
||||
# CHECK: Relocations [
|
||||
# CHECK-NEXT: ]
|
||||
|
||||
.globl _start
|
||||
_start:
|
||||
# Accessing the variable directly.
|
||||
add x11, x8, :tprel_hi12:i
|
||||
add x11, x11, :tprel_lo12_nc:i
|
||||
|
||||
# Accessing the variable through the GOT.
|
||||
adrp x10, :gottprel:i
|
||||
mrs x8, TPIDR_EL0
|
||||
ldr x10, [x10, :gottprel_lo12:i]
|
||||
|
||||
.section .tbss.i,"awT",@nobits
|
||||
.globl i
|
||||
i:
|
||||
.word 0
|
||||
.size i, 4
|
@ -1,7 +1,7 @@
|
||||
// REQUIRES: aarch64
|
||||
// RUN: llvm-mc -triple=aarch64-linux-gnu -filetype=obj %s -o %t.o
|
||||
// RUN: ld.lld %t.o -o %t
|
||||
// RUN: llvm-objdump -d %t | FileCheck %s
|
||||
// RUN: llvm-objdump -d --no-show-raw-insn %t | FileCheck %s
|
||||
// RUN: llvm-readelf --symbols %t | FileCheck -check-prefix CHECK-SYMS %s
|
||||
|
||||
.text
|
||||
@ -25,22 +25,22 @@ _start: mrs x8, TPIDR_EL0
|
||||
ldrb w0, [x8, :tprel_lo12_nc:var4]
|
||||
|
||||
// CHECK: _start:
|
||||
// CHECK-NEXT: 210000: 48 d0 3b d5 mrs x8, TPIDR_EL0
|
||||
// CHECK-NEXT: 210000: mrs x8, TPIDR_EL0
|
||||
// 0x0 + c10 = 0xc10 = tcb (16-bytes) + var0
|
||||
// CHECK-NEXT: 210004: 08 01 40 91 add x8, x8, #0, lsl #12
|
||||
// CHECK-NEXT: 210008: 14 05 c3 3d ldr q20, [x8, #3088]
|
||||
// CHECK-NEXT: 210004: add x8, x8, #0, lsl #12
|
||||
// CHECK-NEXT: 210008: ldr q20, [x8, #3088]
|
||||
// 0x1000 + 0x820 = 0x1820 = tcb + var1
|
||||
// CHECK-NEXT: 21000c: 08 05 40 91 add x8, x8, #1, lsl #12
|
||||
// CHECK-NEXT: 210010: 00 11 44 f9 ldr x0, [x8, #2080]
|
||||
// CHECK-NEXT: 21000c: add x8, x8, #1, lsl #12
|
||||
// CHECK-NEXT: 210010: ldr x0, [x8, #2080]
|
||||
// 0x2000 + 0x428 = 0x2428 = tcb + var2
|
||||
// CHECK-NEXT: 210014: 08 09 40 91 add x8, x8, #2, lsl #12
|
||||
// CHECK-NEXT: 210018: 00 29 44 b9 ldr w0, [x8, #1064]
|
||||
// CHECK-NEXT: 210014: add x8, x8, #2, lsl #12
|
||||
// CHECK-NEXT: 210018: ldr w0, [x8, #1064]
|
||||
// 0x3000 + 0x2c = 0x302c = tcb + var3
|
||||
// CHECK-NEXT: 21001c: 08 0d 40 91 add x8, x8, #3, lsl #12
|
||||
// CHECK-NEXT: 210020: 00 59 40 79 ldrh w0, [x8, #44]
|
||||
// CHECK-NEXT: 21001c: add x8, x8, #3, lsl #12
|
||||
// CHECK-NEXT: 210020: ldrh w0, [x8, #44]
|
||||
// 0x3000 + 0xc2e = 0x32ce = tcb + var4
|
||||
// CHECK-NEXT: 210024: 08 0d 40 91 add x8, x8, #3, lsl #12
|
||||
// CHECK-NEXT: 210028: 00 b9 70 39 ldrb w0, [x8, #3118]
|
||||
// CHECK-NEXT: 210024: add x8, x8, #3, lsl #12
|
||||
// CHECK-NEXT: 210028: ldrb w0, [x8, #3118]
|
||||
|
||||
// CHECK-SYMS: 0000000000000c00 0 TLS GLOBAL DEFAULT 2 var0
|
||||
// CHECK-SYMS-NEXT: 0000000000001810 4 TLS GLOBAL DEFAULT 2 var1
|
||||
|
@ -1,40 +0,0 @@
|
||||
// REQUIRES: aarch64
|
||||
// RUN: llvm-mc -filetype=obj -triple=aarch64-unknown-linux %s -o %t.o
|
||||
// RUN: ld.lld --hash-style=sysv -shared %t.o -o %t.so
|
||||
// RUN: llvm-readobj -S -r %t.so | FileCheck %s
|
||||
// RUN: llvm-objdump -d %t.so | FileCheck --check-prefix=DISASM %s
|
||||
|
||||
// CHECK: Name: .got
|
||||
// CHECK-NEXT: Type: SHT_PROGBITS
|
||||
// CHECK-NEXT: Flags [
|
||||
// CHECK-NEXT: SHF_ALLOC
|
||||
// CHECK-NEXT: SHF_WRITE
|
||||
// CHECK-NEXT: ]
|
||||
// CHECK-NEXT: Address: 0x20090
|
||||
// CHECK-NEXT: Offset:
|
||||
// CHECK-NEXT: Size: 8
|
||||
// CHECK-NEXT: Link: 0
|
||||
// CHECK-NEXT: Info: 0
|
||||
// CHECK-NEXT: AddressAlignment: 8
|
||||
|
||||
// CHECK: Relocations [
|
||||
// CHECK-NEXT: Section ({{.*}}) .rela.dyn {
|
||||
// CHECK-NEXT: 0x20090 R_AARCH64_GLOB_DAT dat 0x0
|
||||
// CHECK-NEXT: }
|
||||
// CHECK-NEXT: ]
|
||||
|
||||
// Page(0x20098) - Page(0x10000) = 0x10000 = 65536
|
||||
// 0x20098 & 0xff8 = 0x98 = 152
|
||||
|
||||
// DISASM: main:
|
||||
// DISASM-NEXT: 10000: 80 00 00 90 adrp x0, #65536
|
||||
// DISASM-NEXT: 10004: 00 48 40 f9 ldr x0, [x0, #144]
|
||||
|
||||
.global main,foo,dat
|
||||
.text
|
||||
main:
|
||||
adrp x0, :got:dat
|
||||
ldr x0, [x0, :got_lo12:dat]
|
||||
.data
|
||||
dat:
|
||||
.word 42
|
Loading…
x
Reference in New Issue
Block a user