[PATCH] D44286: [lld-link] Add support for /ignore:4037.

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 8 21:05:06 PST 2018


thakis created this revision.
thakis added a reviewer: ruiu.

Fixes PR36657.


https://reviews.llvm.org/D44286

Files:
  COFF/Config.h
  COFF/Driver.cpp
  test/COFF/order.test


Index: test/COFF/order.test
===================================================================
--- test/COFF/order.test
+++ test/COFF/order.test
@@ -16,7 +16,7 @@
 # CHECK: unrelated2
 
 # RUN: lld-link -entry:fn1 -subsystem:console -opt:noref -debug %t1.obj %t2.obj \
-# RUN:   -lldmap:- -out:%t.exe | FileCheck -check-prefix=DEFAULT %s
+# RUN:   -lldmap:- -ignore:4037 -out:%t.exe | FileCheck -check-prefix=DEFAULT %s
 # DEFAULT: fn2
 # DEFAULT: fn3
 # DEFAULT: unrelated1
@@ -35,6 +35,13 @@
 # WARN-NOT: f2
 # WARN-NOT: f3
 # WARN-NOT: f4
+# RUN: lld-link -entry:fn1 -subsystem:console -debug %t1.obj %t2.obj \
+# RUN:   -out:%t.exe -order:@%t2.order -ignore:4037 2>&1 | \
+# RUN:   FileCheck -allow-empty -check-prefix=NOWARN %s
+# NOWARN-NOT: warning: /order:{{.*}} missing symbol: foo
+# NOWARN-NOT: f2
+# NOWARN-NOT: f3
+# NOWARN-NOT: f4
 
 --- !COFF
 header:
Index: COFF/Driver.cpp
===================================================================
--- COFF/Driver.cpp
+++ COFF/Driver.cpp
@@ -804,8 +804,10 @@
     if (Config->Machine == I386 && !isDecorated(S))
       S = "_" + S;
 
-    if (Set.count(S) == 0)
-      warn("/order:" + Arg + ": missing symbol: " + S);
+    if (Set.count(S) == 0) {
+      if (Config->WarnMissingOrderSymbol)
+        warn("/order:" + Arg + ": missing symbol: " + S);
+    }
     else
       Config->Order[S] = INT_MIN + Config->Order.size();
   }
@@ -899,7 +901,9 @@
 
   // Handle /ignore
   for (auto *Arg : Args.filtered(OPT_ignore)) {
-    if (StringRef(Arg->getValue()) == "4217")
+    if (StringRef(Arg->getValue()) == "4037")
+      Config->WarnMissingOrderSymbol = false;
+    else if (StringRef(Arg->getValue()) == "4217")
       Config->WarnLocallyDefinedImported = false;
     // Other warning numbers are ignored.
   }
Index: COFF/Config.h
===================================================================
--- COFF/Config.h
+++ COFF/Config.h
@@ -187,6 +187,7 @@
   bool HighEntropyVA = false;
   bool AppContainer = false;
   bool MinGW = false;
+  bool WarnMissingOrderSymbol = true;
   bool WarnLocallyDefinedImported = true;
   bool Incremental = true;
 };


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D44286.137694.patch
Type: text/x-patch
Size: 2119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180309/718e9fd9/attachment.bin>


More information about the llvm-commits mailing list