Index: COFF/Config.h =================================================================== --- COFF/Config.h +++ COFF/Config.h @@ -197,6 +197,7 @@ bool MinGW = false; bool WarnMissingOrderSymbol = true; bool WarnLocallyDefinedImported = true; + bool WarnDebugInfoUnusable = true; bool Incremental = true; bool IntegrityCheck = false; bool KillAt = false; Index: COFF/Driver.cpp =================================================================== --- COFF/Driver.cpp +++ COFF/Driver.cpp @@ -986,11 +986,18 @@ // Handle /ignore for (auto *Arg : Args.filtered(OPT_ignore)) { - if (StringRef(Arg->getValue()) == "4037") - Config->WarnMissingOrderSymbol = false; - else if (StringRef(Arg->getValue()) == "4217") - Config->WarnLocallyDefinedImported = false; - // Other warning numbers are ignored. + StringRef Curr(Arg->getValue()); + while (!Curr.empty()) { + auto It = Curr.split(','); + if (It.first == "4037") + Config->WarnMissingOrderSymbol = false; + else if (It.first == "4099") + Config->WarnDebugInfoUnusable = false; + else if (It.first == "4217") + Config->WarnLocallyDefinedImported = false; + // Other warning numbers are ignored. + Curr = It.second; + } } // Handle /out Index: COFF/PDB.cpp =================================================================== --- COFF/PDB.cpp +++ COFF/PDB.cpp @@ -1301,10 +1301,12 @@ // If the .debug$T sections fail to merge, assume there is no debug info. if (!IndexMapResult) { - auto FileName = sys::path::filename(Path); - warn("Cannot use debug info for '" + FileName + "'\n" + - ">>> failed to load reference " + - StringRef(toString(IndexMapResult.takeError()))); + if (Config->WarnDebugInfoUnusable) { + auto FileName = sys::path::filename(Path); + warn("Cannot use debug info for '" + FileName + "' [LNK4099]\n" + + ">>> failed to load reference " + + StringRef(toString(IndexMapResult.takeError()))); + } return; } Index: test/COFF/ignore-many.yaml =================================================================== --- test/COFF/ignore-many.yaml +++ test/COFF/ignore-many.yaml @@ -0,0 +1,17 @@ +Tests /ignore with more than one arg. + +RUN: yaml2obj %S/ignore4217.yaml > %t1.obj +RUN: yaml2obj %S/Inputs/pdb-type-server-missing-2.yaml > %t2.obj +RUN: echo foo > %t3.order + +RUN: lld-link /entry:main /out:%t.exe %t1.obj %t2.obj /order:@%t3.order /debug 2>&1 | FileCheck -check-prefix=WARNINGS %s +RUN: lld-link /entry:main /out:%t.exe %t1.obj %t2.obj /order:@%t3.order /debug /ignore:4217,4099,4037 2>&1 | FileCheck -allow-empty -check-prefix=SUPPRESSED %s + +WARNINGS: locally defined symbol imported +WARNINGS: missing symbol: foo +WARNINGS: warning: Cannot use debug info for + +SUPPRESSED-NOT: locally defined symbol imported +SUPPRESSED-NOT: missing symbol: foo +SUPPRESSED-NOT: warning: Cannot use debug info for + Index: test/COFF/pdb-type-server-missing.yaml =================================================================== --- test/COFF/pdb-type-server-missing.yaml +++ test/COFF/pdb-type-server-missing.yaml @@ -5,13 +5,26 @@ # RUN: yaml2obj %s -o %t1.obj # RUN: yaml2obj %p/Inputs/pdb-type-server-missing-2.yaml -o %t2.obj # RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main 2>&1 | FileCheck %s +# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /ignore:4099 2>&1 | FileCheck %s -check-prefix=IGNORE -allow-empty +# RUN: not lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /WX 2>&1 | FileCheck %s -check-prefix=ERR +# RUN: lld-link %t1.obj %t2.obj -out:%t.exe -debug -pdb:%t.pdb -nodefaultlib -entry:main /ignore:4099 /WX 2>&1 | FileCheck %s -check-prefix=IGNORE-ERR -allow-empty # CHECK: warning: Cannot use debug info for {{.*}}.obj # CHECK-NEXT: {{N|n}}o such file or directory - # CHECK: warning: Cannot use debug info for {{.*}}.obj # CHECK-NEXT: {{N|n}}o such file or directory +# IGNORE-NOT: warning: Cannot use debug info for {{.*}}.obj +# IGNORE-NOT: {{N|n}}o such file or directory + +# ERR: error: Cannot use debug info for {{.*}}.obj +# ERR-NEXT: {{N|n}}o such file or directory +# ERR: error: Cannot use debug info for {{.*}}.obj +# ERR-NEXT: {{N|n}}o such file or directory + +# IGNORE-ERR-NOT: error: Cannot use debug info for {{.*}}.obj +# IGNORE-ERR-NOT: {{N|n}}o such file or directory + --- !COFF header: Machine: IMAGE_FILE_MACHINE_AMD64