File: arm-thunk-edgecase.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 (49 lines) | stat: -rw-r--r-- 2,588 bytes parent folder | download | duplicates (12)
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
// REQUIRES: arm
// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
// RUN: echo "SECTIONS { \
// RUN:           .text_armfunc 0x1000 : { *(.text_armfunc) } \
// RUN:           .text_thumbfunc 0x11010 : { *(.text_thumbfunc) } \
// RUN:       }" > %tarm_to_thumb.script
// RUN: echo "SECTIONS { \
// RUN:           .text_thumbfunc 0x1000 : { *(.text_thumbfunc) } \
// RUN:           .text_armfunc 0x1100c : { *(.text_armfunc) } \
// RUN:       }" > %tthumb_to_arm.script
// RUN: ld.lld -shared -Bsymbolic -script %tarm_to_thumb.script %t.o -o %tarm_to_thumb.so
// RUN: ld.lld -shared -Bsymbolic -script %tthumb_to_arm.script %t.o -o %tthumb_to_arm.so
// RUN: llvm-objdump --no-print-imm-hex --triple=armv7a-none-linux-gnueabi -d %tarm_to_thumb.so | FileCheck --check-prefix=ARM-TO-THUMB %s
// RUN: llvm-objdump --no-print-imm-hex -d %tthumb_to_arm.so | FileCheck --check-prefix=THUMB-TO-ARM %s

// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7aeb-none-linux-gnueabi -mcpu=cortex-a8 %s -o %t.o
// RUN: ld.lld -shared -Bsymbolic -script %tarm_to_thumb.script %t.o -o %tarm_to_thumb.so
// RUN: ld.lld -shared -Bsymbolic -script %tthumb_to_arm.script %t.o -o %tthumb_to_arm.so
// RUN: llvm-objdump --no-print-imm-hex --triple=armv7aeb-none-linux-gnueabi -d %tarm_to_thumb.so | FileCheck --check-prefix=ARM-TO-THUMB %s
// RUN: llvm-objdump --no-print-imm-hex -d %tthumb_to_arm.so | FileCheck --check-prefix=THUMB-TO-ARM %s

// RUN: ld.lld --be8 -shared -Bsymbolic -script %tarm_to_thumb.script %t.o -o %tarm_to_thumb.so
// RUN: ld.lld --be8 -shared -Bsymbolic -script %tthumb_to_arm.script %t.o -o %tthumb_to_arm.so
// RUN: llvm-objdump --no-print-imm-hex --triple=armv7aeb-none-linux-gnueabi -d %tarm_to_thumb.so | FileCheck --check-prefix=ARM-TO-THUMB %s
// RUN: llvm-objdump --no-print-imm-hex -d %tthumb_to_arm.so | FileCheck --check-prefix=THUMB-TO-ARM %s

.syntax unified

.arm
.section .text_armfunc, "ax", %progbits
.globl armfunc
.type armfunc, %function
armfunc:
	b	thumbfunc

.thumb
.section .text_thumbfunc, "ax", %progbits
.globl thumbfunc
.thumb_func
thumbfunc:
	b.w	armfunc

// ARM-TO-THUMB:      <__ARMV7PILongThunk_thumbfunc>:
// ARM-TO-THUMB-NEXT:     1004:        e30fcffd            movw        r12, #65533
// ARM-TO-THUMB-NEXT:     1008:        e340c000            movt        r12, #0

// THUMB-TO-ARM:      <__ThumbV7PILongThunk_armfunc>:
// THUMB-TO-ARM-NEXT:     1004:        f64f 7cfc           movw        r12, #65532
// THUMB-TO-ARM-NEXT:     1008:        f2c0 0c00           movt        r12, #0