[PATCH] D53044: [ELF] Don't warn on undefined symbols if UnresolvedPolicy::Ignore is used

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 10 15:08:26 PDT 2018


MaskRay added inline comments.


================
Comment at: ELF/Symbols.cpp:280-288
     Warn(": unable to order shared symbol: ");
-  else if (D && !D->Section)
-    Warn(": unable to order absolute symbol: ");
-  else if (D && isa<OutputSection>(D->Section))
-    Warn(": unable to order synthetic symbol: ");
-  else if (D && !D->Section->Repl->Live)
-    Warn(": unable to order discarded symbol: ");
+  } else if (D) {
+    if (!D->Section)
+      Warn(": unable to order absolute symbol: ");
+    else if (isa<OutputSection>(D->Section))
+      Warn(": unable to order synthetic symbol: ");
+    else if (!D->Section->Repl->Live)
----------------
ruiu wrote:
> Please do not change this -- this code was written in the way it is to reduce indentation depth.
Should I use `if (Sym->isUndefined() && Config->UnresolvedSymbols != UnresolvedPolicy::Ignore)` then?

I actually find dispatching by `SymbolKind` first makes the code a bit easier to understand:

* Undefined
* Shared
* Others (Defined)

For the `Defined` case, fine-grained conditions are checked for absolute/syunthetic/discarded.

I lean to this style but if you have strong opinion on this, I can change it.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D53044





More information about the llvm-commits mailing list