[lld] r313103 - Handle lazy symbols is Symbol::includeInDynsym.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 12 17:47:06 PDT 2017
Author: rafael
Date: Tue Sep 12 17:47:06 2017
New Revision: 313103
URL: http://llvm.org/viewvc/llvm-project?rev=313103&view=rev
Log:
Handle lazy symbols is Symbol::includeInDynsym.
This should fix the lto bootstrap.
It is somewhat hard to remember about lazy symbols deep down in the
link. It might be worth it replacing them with undefined symbols once
we are done adding files.
Added:
lld/trunk/test/ELF/Inputs/weak-undef-lazy.s
lld/trunk/test/ELF/weak-undef-lazy.s
Modified:
lld/trunk/ELF/Symbols.cpp
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=313103&r1=313102&r2=313103&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Tue Sep 12 17:47:06 2017
@@ -341,7 +341,7 @@ uint8_t Symbol::computeBinding() const {
bool Symbol::includeInDynsym() const {
if (computeBinding() == STB_LOCAL)
return false;
- if (body()->isUndefined())
+ if (body()->isUndefined() || body()->isLazy())
return Config->Shared || !body()->symbol()->isWeak();
return ExportDynamic || body()->isShared();
}
Added: lld/trunk/test/ELF/Inputs/weak-undef-lazy.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/Inputs/weak-undef-lazy.s?rev=313103&view=auto
==============================================================================
--- lld/trunk/test/ELF/Inputs/weak-undef-lazy.s (added)
+++ lld/trunk/test/ELF/Inputs/weak-undef-lazy.s Tue Sep 12 17:47:06 2017
@@ -0,0 +1,3 @@
+.global foobar
+foobar:
+ nop
Added: lld/trunk/test/ELF/weak-undef-lazy.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/weak-undef-lazy.s?rev=313103&view=auto
==============================================================================
--- lld/trunk/test/ELF/weak-undef-lazy.s (added)
+++ lld/trunk/test/ELF/weak-undef-lazy.s Tue Sep 12 17:47:06 2017
@@ -0,0 +1,11 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %S/Inputs/weak-undef-lazy.s -o %t2.o
+# RUN: rm -f %t2.a
+# RUN: llvm-ar rc %t2.a %t2.o
+# RUN: ld.lld %t.o %t2.a -o %t --export-dynamic
+
+ .global _start
+_start:
+ .weak foobar
+ .quad foobar
More information about the llvm-commits
mailing list