Index: lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp =================================================================== --- lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp +++ lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp @@ -4738,9 +4738,12 @@ parseDirectiveInst(Loc); else return true; - } else if (IDVal == MCLOHDirectiveName()) - parseDirectiveLOH(IDVal, Loc); - else + } else if (IsMachO) { + if (IDVal == MCLOHDirectiveName()) + parseDirectiveLOH(IDVal, Loc); + else + return true; + } else return true; return false; } Index: test/MC/AArch64/arm64-directive_loh.s =================================================================== --- test/MC/AArch64/arm64-directive_loh.s +++ test/MC/AArch64/arm64-directive_loh.s @@ -1,5 +1,7 @@ # RUN: not llvm-mc -triple arm64-apple-darwin < %s 2> %t | FileCheck %s # RUN: FileCheck --check-prefix=CHECK-ERRORS < %t %s +# RUN: not llvm-mc -triple aarch64-linux-gnu < %s 2>&1 | FileCheck --check-prefix=UNKNOWN %s +# RUN: not llvm-mc -triple aarch64-win32-gnu < %s 2>&1 | FileCheck --check-prefix=UNKNOWN %s .globl _fct1 _fct1: @@ -15,6 +17,8 @@ # CHECK: .loh AdrpAdrp L1, L2 # CHECK: .loh AdrpAdrp L1, L2 +# UNKNOWN: error: unknown directive +# UNKNOWN-NEXT: .loh AdrpAdrp L1, L2 .loh AdrpAdrp L1, L2 .loh 1 L1, L2