summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-04-10 21:13:52 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-04-10 21:13:52 +0000
commit262589db70a5733e2f4fa375183af68aa8396c2d (patch)
treed6b97c8b98294ddfb01e576d07d42201d940aa96
parent9f742bc2e95075867b239c5c8bde907532efa744 (diff)
downloadbcm5719-llvm-262589db70a5733e2f4fa375183af68aa8396c2d.tar.gz
bcm5719-llvm-262589db70a5733e2f4fa375183af68aa8396c2d.zip
Don't warn on ICFed symbols, warn on synthetic ones.
Based on a patch for the ICF warning by Rui. llvm-svn: 329757
-rw-r--r--lld/ELF/Writer.cpp5
-rw-r--r--lld/test/ELF/symbol-ordering-file-warnings.s16
2 files changed, 15 insertions, 6 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index c9ae6a8cdfa..7f742d18944 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1065,7 +1065,10 @@ static DenseMap<const InputSectionBase *, int> buildSectionOrder() {
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());
}
diff --git a/lld/test/ELF/symbol-ordering-file-warnings.s b/lld/test/ELF/symbol-ordering-file-warnings.s
index 4b09857769e..71414bf5809 100644
--- a/lld/test/ELF/symbol-ordering-file-warnings.s
+++ b/lld/test/ELF/symbol-ordering-file-warnings.s
@@ -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",@progbits
multi:
- nop
+ .quad _GLOBAL_OFFSET_TABLE_
OpenPOWER on IntegriCloud