[lld] 00dd2d1 - [ELF] --symbol-ordering-file: remove weird !lazy condition for "no such symbol" diagnostic
    Fangrui Song via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Jan  5 02:04:39 PST 2022
    
    
  
Author: Fangrui Song
Date: 2022-01-05T02:04:36-08:00
New Revision: 00dd2d15a40b0fe9916bb55a48f264498d8fe910
URL: https://github.com/llvm/llvm-project/commit/00dd2d15a40b0fe9916bb55a48f264498d8fe910
DIFF: https://github.com/llvm/llvm-project/commit/00dd2d15a40b0fe9916bb55a48f264498d8fe910.diff
LOG: [ELF] --symbol-ordering-file: remove weird !lazy condition for "no such symbol" diagnostic
The diagnostic is emitted for an unextracted lazy symbol but suppressed for an
undefined symbol. Suppressing the diagnostic for unextracted lazy symbol
probably makes more sense because (a) an unextracted lazy symbol is quite
similar to an undefined symbol and (b) an unextracted lazy symbol is different
from "no such symbol".
Added: 
    
Modified: 
    lld/ELF/Writer.cpp
    lld/test/ELF/symbol-ordering-file-warnings.s
Removed: 
    
################################################################################
diff  --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index f62f6bf68ed71..cf346808110b4 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1313,8 +1313,7 @@ static DenseMap<const InputSectionBase *, int> buildSectionOrder() {
   // We want both global and local symbols. We get the global ones from the
   // symbol table and iterate the object files for the local ones.
   for (Symbol *sym : symtab->symbols())
-    if (!sym->isLazy())
-      addSym(*sym);
+    addSym(*sym);
 
   for (ELFFileBase *file : objectFiles)
     for (Symbol *sym : file->getSymbols()) {
diff  --git a/lld/test/ELF/symbol-ordering-file-warnings.s b/lld/test/ELF/symbol-ordering-file-warnings.s
index daf47bcdb31c0..e4611e4031aab 100644
--- a/lld/test/ELF/symbol-ordering-file-warnings.s
+++ b/lld/test/ELF/symbol-ordering-file-warnings.s
@@ -64,11 +64,11 @@
 # RUN: ld.lld %t1.o %t2.o -o %t --symbol-ordering-file %t-order-weak.txt \
 # RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN --allow-empty
 
-# Check that symbols only in unused archive members result in a warning.
+# Check that symbols only in unused archive members does not result in a warning.
 # RUN: rm -f %t.a
 # RUN: llvm-ar rc %t.a %t3.o
 # RUN: ld.lld %t1.o %t.a -o %t --symbol-ordering-file %t-order-missing.txt \
-# RUN:   --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,MISSING --allow-empty
+# RUN:   --unresolved-symbols=ignore-all 2>&1 | count 0
 
 # Check that a warning for each same-named symbol with an issue.
 # RUN: echo "multi" > %t-order-same-name.txt
        
    
    
More information about the llvm-commits
mailing list