File: arm-thumb-interwork-ifunc.s

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (63 lines) | stat: -rw-r--r-- 1,816 bytes parent folder | download | duplicates (4)
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
// REQUIRES: arm
// RUN: llvm-mc --triple=armv7a-linux-gnueabihf -arm-add-build-attributes -filetype=obj -o %t.o %s
// RUN: ld.lld %t.o -o %t
// RUN: llvm-objdump --no-print-imm-hex --triple=armv7a-none-linux-gnueabi -d --no-show-raw-insn %t | FileCheck %s

/// A symbol assignment defined alias inherits st_type and gets the same treatment.
// RUN: llvm-mc --triple=armv7a-linux-gnueabihf -arm-add-build-attributes -filetype=obj --defsym ALIAS=1 -o %t1.o %s
// RUN: ld.lld --defsym foo=foo1 %t1.o -o %t1
// RUN: llvm-objdump --no-print-imm-hex --triple=armv7a-none-linux-gnueabi -d --no-show-raw-insn %t | FileCheck %s

/// Non-preemptible ifuncs are called via a PLT entry which is always Arm
/// state, expect the ARM callers to go direct to the PLT entry, Thumb
/// branches are indirected via state change thunks, the bl is changed to blx.

 .syntax unified
 .text
 .balign 0x1000
.ifdef ALIAS
 .type foo1 STT_GNU_IFUNC
 .globl foo1
foo1:
.else
 .type foo STT_GNU_IFUNC
 .globl foo
foo:
.endif
 bx lr

 .section .text.1, "ax", %progbits
 .arm
 .global _start
_start:
 b foo
 bl foo

 .section .text.2, "ax", %progbits
 .thumb
 .global thumb_caller
thumb_caller:
 b foo
 b.w foo
 bl foo

// CHECK:      00021004 <_start>:
// CHECK-NEXT: b       0x21030
// CHECK-NEXT: bl      0x21030

// CHECK:      0002100c <thumb_caller>:
// CHECK-NEXT: b.w     0x21018 <__Thumbv7ABSLongThunk_foo>
// CHECK-NEXT: b.w     0x21018 <__Thumbv7ABSLongThunk_foo>
// CHECK-NEXT: blx     0x21030

// CHECK:      00021018 <__Thumbv7ABSLongThunk_foo>:
// CHECK-NEXT: movw    r12, #4144
// CHECK-NEXT: movt    r12, #2
// CHECK-NEXT: bx      r12

// CHECK: Disassembly of section .iplt:

// CHECK:      00021030 <$a>:
// CHECK-NEXT: add     r12, pc, #0, #12
// CHECK-NEXT: add     r12, r12, #16, #20
// CHECK-NEXT: ldr     pc, [r12, #8]!