[lld] r350956 - [LLD][COFF] Support /ignore:4099. Support /ignore with comma-separated arguments.

Alexandre Ganea via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 11 11:10:01 PST 2019


Author: aganea
Date: Fri Jan 11 11:10:01 2019
New Revision: 350956

URL: http://llvm.org/viewvc/llvm-project?rev=350956&view=rev
Log:
[LLD][COFF] Support /ignore:4099. Support /ignore with comma-separated arguments.

Differential Revision: https://reviews.llvm.org/D56392

Added:
    lld/trunk/test/COFF/ignore-many.test
Modified:
    lld/trunk/COFF/Config.h
    lld/trunk/COFF/Driver.cpp
    lld/trunk/COFF/PDB.cpp
    lld/trunk/test/COFF/pdb-type-server-missing.yaml
    lld/trunk/test/COFF/precomp-link.test

Modified: lld/trunk/COFF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Config.h?rev=350956&r1=350955&r2=350956&view=diff
==============================================================================
--- lld/trunk/COFF/Config.h (original)
+++ lld/trunk/COFF/Config.h Fri Jan 11 11:10:01 2019
@@ -197,6 +197,7 @@ struct Configuration {
   bool MinGW = false;
   bool WarnMissingOrderSymbol = true;
   bool WarnLocallyDefinedImported = true;
+  bool WarnDebugInfoUnusable = true;
   bool Incremental = true;
   bool IntegrityCheck = false;
   bool KillAt = false;

Modified: lld/trunk/COFF/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/Driver.cpp?rev=350956&r1=350955&r2=350956&view=diff
==============================================================================
--- lld/trunk/COFF/Driver.cpp (original)
+++ lld/trunk/COFF/Driver.cpp Fri Jan 11 11:10:01 2019
@@ -986,11 +986,17 @@ void LinkerDriver::link(ArrayRef<const c
 
   // 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.
+    SmallVector<StringRef, 8> Vec;
+    StringRef(Arg->getValue()).split(Vec, ',');
+    for (StringRef S : Vec) {
+      if (S == "4037")
+        Config->WarnMissingOrderSymbol = false;
+      else if (S == "4099")
+        Config->WarnDebugInfoUnusable = false;
+      else if (S == "4217")
+        Config->WarnLocallyDefinedImported = false;
+      // Other warning numbers are ignored.
+    }
   }
 
   // Handle /out

Modified: lld/trunk/COFF/PDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/PDB.cpp?rev=350956&r1=350955&r2=350956&view=diff
==============================================================================
--- lld/trunk/COFF/PDB.cpp (original)
+++ lld/trunk/COFF/PDB.cpp Fri Jan 11 11:10:01 2019
@@ -1301,8 +1301,10 @@ void PDBLinker::addObjFile(ObjFile *File
 
   // 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" +
+    if (!Config->WarnDebugInfoUnusable)
+      return;
+    StringRef FileName = sys::path::filename(Path);
+    warn("Cannot use debug info for '" + FileName + "' [LNK4099]\n" +
          ">>> failed to load reference " +
          StringRef(toString(IndexMapResult.takeError())));
     return;

Added: lld/trunk/test/COFF/ignore-many.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/ignore-many.test?rev=350956&view=auto
==============================================================================
--- lld/trunk/test/COFF/ignore-many.test (added)
+++ lld/trunk/test/COFF/ignore-many.test Fri Jan 11 11:10:01 2019
@@ -0,0 +1,16 @@
+Tests /ignore with more than one argument.
+
+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

Modified: lld/trunk/test/COFF/pdb-type-server-missing.yaml
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/pdb-type-server-missing.yaml?rev=350956&r1=350955&r2=350956&view=diff
==============================================================================
--- lld/trunk/test/COFF/pdb-type-server-missing.yaml (original)
+++ lld/trunk/test/COFF/pdb-type-server-missing.yaml Fri Jan 11 11:10:01 2019
@@ -4,13 +4,22 @@
 
 # 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 2>&1 | FileCheck %s -check-prefix=WARN
+# 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
+# WARN: warning: Cannot use debug info for '{{.*}}.obj' [LNK4099]
+# WARN-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' [LNK4099]
+# IGNORE-NOT: {{N|n}}o such file or directory
+
+# ERR: error: Cannot use debug info for '{{.*}}.obj' [LNK4099]
+# ERR-NEXT: {{N|n}}o such file or directory
+
+# IGNORE-ERR-NOT: error: Cannot use debug info for '{{.*}}.obj' [LNK4099]
+# IGNORE-ERR-NOT: {{N|n}}o such file or directory
 
 --- !COFF
 header:

Modified: lld/trunk/test/COFF/precomp-link.test
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/precomp-link.test?rev=350956&r1=350955&r2=350956&view=diff
==============================================================================
--- lld/trunk/test/COFF/precomp-link.test (original)
+++ lld/trunk/test/COFF/precomp-link.test Fri Jan 11 11:10:01 2019
@@ -8,11 +8,11 @@ RUN: lld-link %S/Inputs/precomp-a.obj %S
 
 RUN: not lld-link %S/Inputs/precomp-a.obj %S/Inputs/precomp-b.obj /nodefaultlib /entry:main /debug /pdb:%t.pdb /out:%t.exe /opt:ref /opt:icf 2>&1 | FileCheck %s -check-prefix FAILURE-MISSING-PRECOMPOBJ
 
-FAILURE: warning: Cannot use debug info for 'precomp-invalid.obj'
+FAILURE: warning: Cannot use debug info for 'precomp-invalid.obj' [LNK4099]
 FAILURE-NEXT: failed to load reference '{{.*}}precomp.obj': The signature does not match; the file(s) might be out of date.
 
-FAILURE-MISSING-PRECOMPOBJ: warning: Cannot use debug info for 'precomp-a.obj'
-FAILURE-MISSING-PRECOMPOBJ-NEXT: failed to load reference 'precomp.obj': The path to this file must be provided on the command-line
+FAILURE-MISSING-PRECOMPOBJ: warning: Cannot use debug info for 'precomp-a.obj' [LNK4099]
+FAILURE-MISSING-PRECOMPOBJ-NEXT: failed to load reference '{{.*}}precomp.obj': The path to this file must be provided on the command-line
 
 CHECK: Types (TPI Stream)
 CHECK-NOT: LF_PRECOMP




More information about the llvm-commits mailing list