mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[AsmParser][ARM] Make .thumb_func imply .thumb
GNU as documentation states that a `.thumb_func` directive implies `.thumb`, teach the asm parser to switch mode whenever it's encountered. On the other hand the labeled form, exclusive to Apple's toolchain, doesn't switch mode at all. Reviewed By: nickdesaulniers, peter.smith Differential Revision: https://reviews.llvm.org/D101975
This commit is contained in:
parent
45d120b829
commit
8144a0e6eb
@ -11165,6 +11165,12 @@ bool ARMAsmParser::parseDirectiveThumbFunc(SMLoc L) {
|
||||
"unexpected token in '.thumb_func' directive"))
|
||||
return true;
|
||||
|
||||
// .thumb_func implies .thumb
|
||||
if (!isThumb())
|
||||
SwitchMode();
|
||||
|
||||
getParser().getStreamer().emitAssemblerFlag(MCAF_Code16);
|
||||
|
||||
NextSymbolIsThumb = true;
|
||||
return false;
|
||||
}
|
||||
|
31
test/MC/ARM/thumb_func-implies-thumb.s
Normal file
31
test/MC/ARM/thumb_func-implies-thumb.s
Normal file
@ -0,0 +1,31 @@
|
||||
@ RUN: llvm-mc -triple=armv7-darwin- -show-encoding < %s | FileCheck %s
|
||||
.syntax unified
|
||||
|
||||
.text
|
||||
|
||||
.arm
|
||||
@ Ensure the plain form switches mode.
|
||||
.thumb_func
|
||||
@ CHECK: .code 16
|
||||
@ CHECK-LABEL: foo
|
||||
foo:
|
||||
bx lr
|
||||
|
||||
.arm
|
||||
@ Ensure the labeled form doesn't switch mode.
|
||||
.thumb_func bar
|
||||
@ CHECK-NOT: .code 16
|
||||
@ CHECK-LABEL: bar
|
||||
bar:
|
||||
bx lr
|
||||
|
||||
.arm
|
||||
@ Ensure the nop is assembled in thumb mode, even though the baz symbol is
|
||||
@ defined later.
|
||||
.thumb_func
|
||||
nop
|
||||
@ CHECK: .code 16
|
||||
@ CHECK-NEXT: nop
|
||||
@ CHECK-LABEL: baz
|
||||
baz:
|
||||
bx lr
|
Loading…
Reference in New Issue
Block a user