1// REQUIRES: arm
2// RUN: llvm-mc -arm-add-build-attributes -filetype=obj -triple=armv7a-none-linux-gnueabi %s -o %t.o
3// RUN: echo "SECTIONS { \
4// RUN:           .text_armfunc 0x1000 : { *(.text_armfunc) } \
5// RUN:           .text_thumbfunc 0x11010 : { *(.text_thumbfunc) } \
6// RUN:       }" > %tarm_to_thumb.script
7// RUN: echo "SECTIONS { \
8// RUN:           .text_thumbfunc 0x1000 : { *(.text_thumbfunc) } \
9// RUN:           .text_armfunc 0x1100c : { *(.text_armfunc) } \
10// RUN:       }" > %tthumb_to_arm.script
11// RUN: ld.lld -shared -Bsymbolic -script %tarm_to_thumb.script %t.o -o %tarm_to_thumb.so
12// RUN: ld.lld -shared -Bsymbolic -script %tthumb_to_arm.script %t.o -o %tthumb_to_arm.so
13// RUN: llvm-objdump --triple=armv7a-none-linux-gnueabi -d %tarm_to_thumb.so | FileCheck --check-prefix=ARM-TO-THUMB %s
14// RUN: llvm-objdump --triple=thumbv7a-none-linux-gnueabi -d %tthumb_to_arm.so | FileCheck --check-prefix=THUMB-TO-ARM %s
15
16.syntax unified
17
18.arm
19.section .text_armfunc, "ax", %progbits
20.globl armfunc
21.type armfunc, %function
22armfunc:
23	b	thumbfunc
24
25.thumb
26.section .text_thumbfunc, "ax", %progbits
27.globl thumbfunc
28.thumb_func
29thumbfunc:
30	b.w	armfunc
31
32// ARM-TO-THUMB:      <__ARMV7PILongThunk_thumbfunc>:
33// ARM-TO-THUMB-NEXT:     1004:        fd cf 0f e3         movw        r12, #65533
34// ARM-TO-THUMB-NEXT:     1008:        00 c0 40 e3         movt        r12, #0
35
36// THUMB-TO-ARM:      <__ThumbV7PILongThunk_armfunc>:
37// THUMB-TO-ARM-NEXT:     1004:        4f f6 fc 7c         movw        r12, #65532
38// THUMB-TO-ARM-NEXT:     1008:        c0 f2 00 0c         movt        r12, #0
39