[lld] r329757 - Don't warn on ICFed symbols, warn on synthetic ones.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 10 14:13:53 PDT 2018
Author: rafael
Date: Tue Apr 10 14:13:52 2018
New Revision: 329757
URL: http://llvm.org/viewvc/llvm-project?rev=329757&view=rev
Log:
Don't warn on ICFed symbols, warn on synthetic ones.
Based on a patch for the ICF warning by Rui.
Modified:
lld/trunk/ELF/Writer.cpp
lld/trunk/test/ELF/symbol-ordering-file-warnings.s
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=329757&r1=329756&r2=329757&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Tue Apr 10 14:13:52 2018
@@ -1065,7 +1065,10 @@ static DenseMap<const InputSectionBase *
else if (D && !D->Section)
warn(toString(File) +
": unable to order absolute symbol: " + Sym.getName());
- else if (D && !D->Section->Live)
+ else if (D && isa<OutputSection>(D->Section))
+ warn(toString(File) +
+ ": unable to order synthetic symbol: " + Sym.getName());
+ else if (D && !D->Section->Repl->Live)
warn(toString(File) +
": unable to order discarded symbol: " + Sym.getName());
}
Modified: lld/trunk/test/ELF/symbol-ordering-file-warnings.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/symbol-ordering-file-warnings.s?rev=329757&r1=329756&r2=329757&view=diff
==============================================================================
--- lld/trunk/test/ELF/symbol-ordering-file-warnings.s (original)
+++ lld/trunk/test/ELF/symbol-ordering-file-warnings.s Tue Apr 10 14:13:52 2018
@@ -39,11 +39,15 @@
# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-gc.txt --gc-sections \
# RUN: --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,GC
-# Check that a warning is emitted for the symbol removed due to --icf.
+# Check that a warning is not emitted for the symbol removed due to --icf.
# RUN: echo "icf1" > %t-order-icf.txt
# RUN: echo "icf2" >> %t-order-icf.txt
# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-icf.txt --icf=all \
-# RUN: --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,ICF
+# RUN: --unresolved-symbols=ignore-all --fatal-warnings
+
+# RUN: echo "_GLOBAL_OFFSET_TABLE_" > %t-order-synthetic.txt
+# RUN: ld.lld %t1.o -o %t --symbol-ordering-file %t-order-synthetic.txt --icf=all \
+# RUN: --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,SYNTHETIC
# Check that a warning is emitted for symbols discarded due to a linker script /DISCARD/ section.
# RUN: echo "discard" > %t-order-discard.txt
@@ -90,13 +94,16 @@
# RUN: echo "absolute" >> %t-order-multi.txt
# RUN: echo "gc" >> %t-order-multi.txt
# RUN: echo "discard" >> %t-order-multi.txt
+# RUN: echo "_GLOBAL_OFFSET_TABLE_" >> %t-order-multi.txt
# RUN: echo "_start" >> %t-order-multi.txt
# RUN: ld.lld %t1.o %t3.o %t.so -o %t --symbol-ordering-file %t-order-multi.txt --gc-sections -T %t.script \
-# RUN: --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,SAMESYM,ABSOLUTE,SHARED,UNDEFINED,GC,DISCARD,MISSING2
+# RUN: --unresolved-symbols=ignore-all 2>&1 | FileCheck %s --check-prefixes=WARN,SAMESYM,ABSOLUTE,SHARED,UNDEFINED,GC,DISCARD,MISSING2,SYNTHETIC
# WARN-NOT: warning:
# SAMESYM: warning: {{.*}}.txt: duplicate ordered symbol: _start
# WARN-NOT: warning:
+# SYNTHETIC: warning: <internal>: unable to order synthetic symbol: _GLOBAL_OFFSET_TABLE_
+# WARN-NOT: warning:
# DISCARD: warning: {{.*}}1.o: unable to order discarded symbol: discard
# WARN-NOT: warning:
# GC: warning: {{.*}}1.o: unable to order discarded symbol: gc
@@ -109,7 +116,6 @@
# WARN-NOT: warning:
# MISSING: warning: symbol ordering file: no such symbol: missing
# MISSING2: warning: symbol ordering file: no such symbol: missing_sym
-# ICF: warning: {{.*}}1.o: unable to order discarded symbol: icf2
# COMDAT: warning: {{.*}}1.o: unable to order discarded symbol: comdat
# MULTI: warning: {{.*}}3.o: unable to order undefined symbol: multi
# MULTI-NEXT: warning: {{.*}}2.o: unable to order absolute symbol: multi
@@ -156,4 +162,4 @@ icf2:
# This is a "good" instance of the symbol
.section .text.multi,"ax", at progbits
multi:
- nop
+ .quad _GLOBAL_OFFSET_TABLE_
More information about the llvm-commits
mailing list