forked from OSchip/llvm-project
COFF: /OPT should accept comma-separated multiple arguments.
/OPT:foo,bar is equivalent to /OPT:foo /OPT:bar. Reported by alexchandel. https://llvm.org/bugs/show_bug.cgi?id=25228 llvm-svn: 250728
This commit is contained in:
parent
45ca5dada1
commit
75656eebb8
|
@ -361,7 +361,10 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
|
|||
|
||||
// Handle /opt
|
||||
for (auto *Arg : Args.filtered(OPT_opt)) {
|
||||
std::string S = StringRef(Arg->getValue()).lower();
|
||||
std::string Str = StringRef(Arg->getValue()).lower();
|
||||
SmallVector<StringRef, 1> Vec;
|
||||
StringRef(Str).split(Vec, ',');
|
||||
for (StringRef S : Vec) {
|
||||
if (S == "noref") {
|
||||
Config->DoGC = false;
|
||||
Config->DoICF = false;
|
||||
|
@ -391,6 +394,7 @@ void LinkerDriver::link(llvm::ArrayRef<const char *> ArgsArr) {
|
|||
if (S != "ref" && S != "lbr" && S != "nolbr")
|
||||
error(Twine("/opt: unknown option: ") + S);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle /failifmismatch
|
||||
for (auto *Arg : Args.filtered(OPT_failifmismatch))
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
|
||||
# RUN: /verbose /opt:noicf %t.obj > %t.log 2>&1
|
||||
# RUN: FileCheck -check-prefix=NOICF %s < %t.log
|
||||
# RUN: lld-link /entry:foo /out:%t.exe /subsystem:console /include:bar \
|
||||
# RUN: /verbose /opt:noref,noicf %t.obj > %t.log 2>&1
|
||||
# RUN: FileCheck -check-prefix=NOICF %s < %t.log
|
||||
|
||||
# NOICF-NOT: Removed foo
|
||||
# NOICF-NOT: Removed bar
|
||||
|
|
Loading…
Reference in New Issue