}
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) {
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);
}
--- /dev/null
+# 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