File: aarch64-gnu-ifunc-plt.s

package info (click to toggle)
llvm-toolchain-7 1%3A7.0.1-8
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 733,456 kB
  • sloc: cpp: 3,776,651; ansic: 633,271; asm: 350,301; python: 142,716; objc: 107,612; sh: 22,626; lisp: 11,056; perl: 7,999; pascal: 6,742; ml: 5,537; awk: 3,536; makefile: 2,557; cs: 2,027; xml: 841; ruby: 156
file content (85 lines) | stat: -rw-r--r-- 3,221 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
// REQUIRES: aarch64
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %S/Inputs/shared2.s -o %t1.o
// RUN: ld.lld %t1.o --shared -o %t.so
// RUN: llvm-mc -filetype=obj -triple=aarch64-none-linux-gnu %s -o %t.o
// RUN: ld.lld --hash-style=sysv %t.so %t.o -o %tout
// RUN: llvm-objdump -d %tout | FileCheck %s --check-prefix=DISASM
// RUN: llvm-objdump -s %tout | FileCheck %s --check-prefix=GOTPLT
// RUN: llvm-readobj -r -dynamic-table %tout | FileCheck %s

// Check that the IRELATIVE relocations are after the JUMP_SLOT in the plt
// CHECK: Relocations [
// CHECK-NEXT:   Section (4) .rela.plt {
// CHECK:     0x30018 R_AARCH64_JUMP_SLOT bar2 0x0
// CHECK-NEXT:     0x30020 R_AARCH64_JUMP_SLOT zed2 0x0
// CHECK-NEXT:     0x30028 R_AARCH64_IRELATIVE - 0x20000
// CHECK-NEXT:     0x30030 R_AARCH64_IRELATIVE - 0x20004
// CHECK-NEXT:   }
// CHECK-NEXT: ]

// Check that .got.plt entries point back to PLT header
// GOTPLT: Contents of section .got.plt:
// GOTPLT-NEXT:  30000 00000000 00000000 00000000 00000000
// GOTPLT-NEXT:  30010 00000000 00000000 20000200 00000000
// GOTPLT-NEXT:  30020 20000200 00000000 20000200 00000000
// GOTPLT-NEXT:  30030 20000200 00000000

// Check that the PLTRELSZ tag includes the IRELATIVE relocations
// CHECK: DynamicSection [
// CHECK:   0x0000000000000002 PLTRELSZ             96 (bytes)

// Check that a PLT header is written and the ifunc entries appear last
// DISASM: Disassembly of section .text:
// DISASM-NEXT: foo:
// DISASM-NEXT:    20000: {{.*}} ret
// DISASM:      bar:
// DISASM-NEXT:    20004: {{.*}} ret
// DISASM:      _start:
// DISASM-NEXT:    20008: {{.*}} bl      #88
// DISASM-NEXT:    2000c: {{.*}} bl      #100
// DISASM-NEXT:    20010: {{.*}} bl      #48
// DISASM-NEXT:    20014: {{.*}} bl      #60
// DISASM-NEXT: Disassembly of section .plt:
// DISASM-NEXT: .plt:
// DISASM-NEXT:    20020: {{.*}} stp     x16, x30, [sp, #-16]!
// DISASM-NEXT:    20024: {{.*}} adrp    x16, #65536
// DISASM-NEXT:    20028: {{.*}} ldr     x17, [x16, #16]
// DISASM-NEXT:    2002c: {{.*}} add     x16, x16, #16
// DISASM-NEXT:    20030: {{.*}} br      x17
// DISASM-NEXT:    20034: {{.*}} nop
// DISASM-NEXT:    20038: {{.*}} nop
// DISASM-NEXT:    2003c: {{.*}} nop
// DISASM-NEXT:    20040: {{.*}} adrp    x16, #65536
// DISASM-NEXT:    20044: {{.*}} ldr     x17, [x16, #24]
// DISASM-NEXT:    20048: {{.*}} add     x16, x16, #24
// DISASM-NEXT:    2004c: {{.*}} br      x17
// DISASM-NEXT:    20050: {{.*}} adrp    x16, #65536
// DISASM-NEXT:    20054: {{.*}} ldr     x17, [x16, #32]
// DISASM-NEXT:    20058: {{.*}} add     x16, x16, #32
// DISASM-NEXT:    2005c: {{.*}} br      x17
// DISASM-NEXT:    20060: {{.*}} adrp    x16, #65536
// DISASM-NEXT:    20064: {{.*}} ldr     x17, [x16, #40]
// DISASM-NEXT:    20068: {{.*}} add     x16, x16, #40
// DISASM-NEXT:    2006c: {{.*}} br      x17
// DISASM-NEXT:    20070: {{.*}} adrp    x16, #65536
// DISASM-NEXT:    20074: {{.*}} ldr     x17, [x16, #48]
// DISASM-NEXT:    20078: {{.*}} add     x16, x16, #48
// DISASM-NEXT:    2007c: {{.*}} br      x17

.text
.type foo STT_GNU_IFUNC
.globl foo
foo:
 ret

.type bar STT_GNU_IFUNC
.globl bar
bar:
 ret

.globl _start
_start:
 bl foo
 bl bar
 bl bar2
 bl zed2