diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -447,7 +447,8 @@ case OPT_throwingnew: break; default: - error(arg->getSpelling() + " is not allowed in .drectve"); + error(arg->getSpelling() + " is not allowed in .drectve (" + + toString(file) + ")"); } } } diff --git a/lld/test/COFF/directives-unsupported.s b/lld/test/COFF/directives-unsupported.s new file mode 100644 --- /dev/null +++ b/lld/test/COFF/directives-unsupported.s @@ -0,0 +1,15 @@ +# REQUIRES: x86 + +# RUN: llvm-mc -triple=x86_64-windows %s -filetype=obj -o %t.obj + +# RUN: not lld-link -dll -out:%t.dll -entry:entry %t.obj -subsystem:console 2>&1 | FileCheck --ignore-case %s + +# CHECK: warning: ignoring unknown argument: -unknowndirectivename +# CHECK: error: -unknowndirectivename is not allowed in .drectve ({{.*}}.obj) + + .global entry + .text +entry: + ret + .section .drectve + .ascii " -unknowndirectivename "