Skip to content

Commit 4676274

Browse files
alvinhochuntstellar
authored andcommitted
[LLD][COFF] Print object file name for unsupported directives
This is a small QoL improvement suggested by FrancescElies in #56300 (comment). Differential Revision: https://reviews.llvm.org/D149022 (cherry picked from commit 9b15e98)
1 parent e861196 commit 4676274

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

lld/COFF/Driver.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ void LinkerDriver::parseDirectives(InputFile *file) {
438438
case OPT_throwingnew:
439439
break;
440440
default:
441-
error(arg->getSpelling() + " is not allowed in .drectve");
441+
error(arg->getSpelling() + " is not allowed in .drectve (" +
442+
toString(file) + ")");
442443
}
443444
}
444445
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# REQUIRES: x86
2+
3+
# RUN: llvm-mc -triple=x86_64-windows %s -filetype=obj -o %t.obj
4+
5+
# RUN: not lld-link -dll -out:%t.dll -entry:entry %t.obj -subsystem:console 2>&1 | FileCheck %s
6+
7+
# CHECK: warning: ignoring unknown argument: -unknowndirectivename
8+
# CHECK: error: -unknowndirectivename is not allowed in .drectve ({{.*}}.obj)
9+
10+
.global entry
11+
.text
12+
entry:
13+
ret
14+
.section .drectve
15+
.ascii " -unknowndirectivename "

0 commit comments

Comments
 (0)