[PATCH] D64136: [ELF] resolveUndefined: ignore undefined symbols in SharedFile

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 08:13:58 PDT 2019


MaskRay updated this revision to Diff 207803.
MaskRay edited the summary of this revision.
MaskRay added a comment.

Reword


Repository:
  rLLD LLVM Linker

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64136/new/

https://reviews.llvm.org/D64136

Files:
  ELF/Symbols.cpp
  test/ELF/weak-undef-shared.s


Index: test/ELF/weak-undef-shared.s
===================================================================
--- test/ELF/weak-undef-shared.s
+++ test/ELF/weak-undef-shared.s
@@ -24,6 +24,11 @@
 # RUN: ld.lld %t2.o %t.so %t1.o -o %t
 # RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=GLOBAL %s
 
+## Check the binding (weak) is not affected by the STB_GLOBAL undefined
+## reference in %t2.so
+# RUN: ld.lld %t1.o %t2.so -o %t
+# RUN: llvm-readelf --dyn-syms %t | FileCheck --check-prefix=WEAK %s
+
 # WEAK:   NOTYPE WEAK   DEFAULT UND foo
 # GLOBAL: NOTYPE GLOBAL DEFAULT UND foo
 
Index: ELF/Symbols.cpp
===================================================================
--- ELF/Symbols.cpp
+++ ELF/Symbols.cpp
@@ -410,6 +410,10 @@
   if (Traced)
     printTraceSymbol(&Other);
 
+  // Ignore undefined symbols in a SharedFile.
+  if (isa_and_nonnull<SharedFile>(Other.File))
+    return;
+
   if (isUndefined()) {
     // The binding may "upgrade" from weak to non-weak.
     if (Other.Binding != STB_WEAK)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64136.207803.patch
Type: text/x-patch
Size: 1017 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190703/c43d7f11/attachment.bin>


More information about the llvm-commits mailing list