[Linker] Add directives to support mixing ARM/Thumb module-level inline asm.
Summary:
By prepending `.text .thumb .balign 2` to the module-level inline
assembly from a Thumb module, the assembler will generate the assembly
from that module as Thumb, even if the destination module uses an ARM
triple. Similar directives are used for module-level inline assembly in
ARM modules.
The alignment and instruction set are reset based on the target triple
before emitting the first function label.
Reviewers: olista01, tejohnson, echristo, t.p.northover, rafael
Reviewed By: echristo
Subscribers: aemerson, javed.absar, eraman, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D34622
llvm-svn: 307772
2017-07-12 19:52:28 +08:00
|
|
|
; This test checks that proper directives to switch between ARM and Thumb mode
|
|
|
|
; are added when linking ARM and Thumb modules.
|
|
|
|
|
|
|
|
; RUN: llvm-as %s -o %t1.bc
|
|
|
|
; RUN: llvm-as %p/Inputs/thumb-module-inline-asm.ll -o %t2.bc
|
|
|
|
; RUN: llvm-link %t1.bc %t2.bc -S 2> %t3.out | FileCheck %s
|
|
|
|
|
|
|
|
target triple = "armv7-linux-gnueabihf"
|
|
|
|
|
|
|
|
module asm "add r1, r2, r2"
|
|
|
|
|
2020-12-02 21:45:49 +08:00
|
|
|
; CHECK: module asm ".text"
|
|
|
|
; CHECK-NEXT: module asm ".balign 4"
|
|
|
|
; CHECK-NEXT: module asm ".arm"
|
|
|
|
; CHECK-NEXT: module asm "add r1, r2, r2"
|
|
|
|
; CHECK-NEXT: module asm ".text"
|
|
|
|
; CHECK-NEXT: module asm ".balign 2"
|
|
|
|
; CHECK-NEXT: module asm ".thumb"
|
|
|
|
; CHECK-NEXT: module asm "orn r1, r2, r2"
|