[PATCH] D55958: [ELF] Simplify addShared. NFC

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 20 14:58:55 PST 2018


MaskRay created this revision.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D55958

Files:
  ELF/SymbolTable.cpp


Index: ELF/SymbolTable.cpp
===================================================================
--- ELF/SymbolTable.cpp
+++ ELF/SymbolTable.cpp
@@ -494,20 +494,12 @@
 
   // An undefined symbol with non default visibility must be satisfied
   // in the same DSO.
-  if (WasInserted) {
-    replaceSymbol<SharedSymbol>(S, File, Name, Sym.getBinding(), Sym.st_other,
+  uint8_t Binding = WasInserted ? Sym.getBinding() : S->Binding;
+  if (WasInserted ||
+      ((S->isUndefined() || S->isLazy()) && S->Visibility == STV_DEFAULT)) {
+    replaceSymbol<SharedSymbol>(S, File, Name, Binding, 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;
-    replaceSymbol<SharedSymbol>(S, File, Name, Sym.getBinding(), Sym.st_other,
-                                Sym.getType(), Sym.st_value, Sym.st_size,
-                                Alignment, VerdefIndex);
-
-    S->Binding = Binding;
   }
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D55958.179168.patch
Type: text/x-patch
Size: 1117 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181220/61d7b5cc/attachment.bin>


More information about the llvm-commits mailing list