[PATCH] D55903: Simplify. NFC.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 19 14:33:19 PST 2018


ruiu created this revision.
ruiu added a reviewer: MaskRay.
Herald added subscribers: arichardson, emaste.
Herald added a reviewer: espindola.

Simplify the logic to set the IsNeeded bit.


https://reviews.llvm.org/D55903

Files:
  lld/ELF/SymbolTable.cpp


Index: lld/ELF/SymbolTable.cpp
===================================================================
--- lld/ELF/SymbolTable.cpp
+++ lld/ELF/SymbolTable.cpp
@@ -494,18 +494,23 @@
 
   // An undefined symbol with non default visibility must be satisfied
   // in the same DSO.
-  if (WasInserted ||
-      ((S->isUndefined() || S->isLazy()) && S->Visibility == STV_DEFAULT)) {
+  if (WasInserted) {
+    replaceSymbol<SharedSymbol>(S, File, Name, Sym.getBinding(), Sym.st_other,
+                                Sym.getType(), Sym.st_value, Sym.st_size,
+                                Alignment, VerdefIndex);
+    return;
+  }
+
+  if ((S->isUndefined() || S->isLazy()) && S->Visibility == STV_DEFAULT) {
     uint8_t Binding = S->Binding;
     bool WasUndefined = S->isUndefined();
     replaceSymbol<SharedSymbol>(S, File, Name, Sym.getBinding(), Sym.st_other,
                                 Sym.getType(), Sym.st_value, Sym.st_size,
                                 Alignment, VerdefIndex);
-    if (!WasInserted) {
-      S->Binding = Binding;
-      if (!S->isWeak() && !Config->GcSections && WasUndefined)
-        File.IsNeeded = true;
-    }
+
+    S->Binding = Binding;
+    if (!S->isWeak() && !Config->GcSections && WasUndefined)
+      File.IsNeeded = true;
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55903.178969.patch
Type: text/x-patch
Size: 1282 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181219/02494d08/attachment.bin>


More information about the llvm-commits mailing list