forked from OSchip/llvm-project
[MC] Pass through .code16/32/64 and .syntax unified for COFF
These flags should simply be passed through to the target, which will do the right thing. Add an MC/X86 test that uses these directives with the three primary object file formats and shows that they disassemble the same everywhere. There is a missing test for .code32 on Windows ARM, since I'm not sure exactly how to construct one. Fixes PR43203 llvm-svn: 370805
This commit is contained in:
parent
d6f097eeb8
commit
b2d10cf22e
|
@ -88,7 +88,19 @@ void MCWinCOFFStreamer::EmitLabel(MCSymbol *S, SMLoc Loc) {
|
|||
}
|
||||
|
||||
void MCWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
|
||||
llvm_unreachable("not implemented");
|
||||
// Let the target do whatever target specific stuff it needs to do.
|
||||
getAssembler().getBackend().handleAssemblerFlag(Flag);
|
||||
|
||||
switch (Flag) {
|
||||
// None of these require COFF specific handling.
|
||||
case MCAF_SyntaxUnified:
|
||||
case MCAF_Code16:
|
||||
case MCAF_Code32:
|
||||
case MCAF_Code64:
|
||||
break;
|
||||
case MCAF_SubsectionsViaSymbols:
|
||||
llvm_unreachable("COFF doesn't support .subsections_via_symbols");
|
||||
}
|
||||
}
|
||||
|
||||
void MCWinCOFFStreamer::EmitThumbFunc(MCSymbol *Func) {
|
||||
|
|
|
@ -22,20 +22,10 @@ public:
|
|||
std::unique_ptr<MCObjectWriter> OW)
|
||||
: MCWinCOFFStreamer(C, std::move(AB), std::move(CE), std::move(OW)) {}
|
||||
|
||||
void EmitAssemblerFlag(MCAssemblerFlag Flag) override;
|
||||
void EmitThumbFunc(MCSymbol *Symbol) override;
|
||||
void FinishImpl() override;
|
||||
};
|
||||
|
||||
void ARMWinCOFFStreamer::EmitAssemblerFlag(MCAssemblerFlag Flag) {
|
||||
switch (Flag) {
|
||||
default: llvm_unreachable("not implemented");
|
||||
case MCAF_SyntaxUnified:
|
||||
case MCAF_Code16:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ARMWinCOFFStreamer::EmitThumbFunc(MCSymbol *Symbol) {
|
||||
getAssembler().setIsThumbFunc(Symbol);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
# RUN: llvm-mc %s -triple x86_64-linux-gnu -filetype=obj -o - | llvm-objdump -d - | FileCheck %s
|
||||
# RUN: llvm-mc %s -triple x86_64-windows-msvc -filetype=obj -o - | llvm-objdump -d - | FileCheck %s
|
||||
# RUN: llvm-mc %s -triple x86_64-apple-macos -filetype=obj -o - | llvm-objdump -d - | FileCheck %s
|
||||
|
||||
.text
|
||||
.global foo
|
||||
foo:
|
||||
.code64
|
||||
movl (%eax), %eax
|
||||
.code32
|
||||
movl (%eax), %eax
|
||||
.code16
|
||||
movl (%eax), %eax
|
||||
.code64
|
||||
retq
|
||||
|
||||
# CHECK: foo:
|
||||
# CHECK-NEXT: 67 8b 00 movl (%eax), %eax
|
||||
# CHECK-NEXT: 8b 00 movl (%rax), %eax
|
||||
# CHECK-NEXT: 67 66 8b 00 movw (%eax), %ax
|
||||
# CHECK-NEXT: c3 retq
|
Loading…
Reference in New Issue