[lld] r320412 - Handle symbols pointing to output sections.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 11 11:45:36 PST 2017
Author: rafael
Date: Mon Dec 11 11:45:36 2017
New Revision: 320412
URL: http://llvm.org/viewvc/llvm-project?rev=320412&view=rev
Log:
Handle symbols pointing to output sections.
Now that gc sections runs after linker defined symbols are added it
can see symbols that point to an OutputSection.
Should fix a bot failure.
Added:
lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s
Modified:
lld/trunk/ELF/MarkLive.cpp
Modified: lld/trunk/ELF/MarkLive.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/MarkLive.cpp?rev=320412&r1=320411&r2=320412&view=diff
==============================================================================
--- lld/trunk/ELF/MarkLive.cpp (original)
+++ lld/trunk/ELF/MarkLive.cpp Mon Dec 11 11:45:36 2017
@@ -219,7 +219,7 @@ template <class ELFT> static void doGcSe
auto MarkSymbol = [&](Symbol *Sym) {
if (auto *D = dyn_cast_or_null<Defined>(Sym))
- if (auto *IS = cast_or_null<InputSectionBase>(D->Section))
+ if (auto *IS = dyn_cast_or_null<InputSectionBase>(D->Section))
Enqueue(IS, D->Value);
};
Added: lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s?rev=320412&view=auto
==============================================================================
--- lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s (added)
+++ lld/trunk/test/ELF/gc-sections-linker-defined-symbol.s Mon Dec 11 11:45:36 2017
@@ -0,0 +1,16 @@
+# REQUIRES: x86
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: ld.lld %t.o -o %t.so --gc-sections -shared
+# RUN: llvm-readobj --dyn-symbols %t.so | FileCheck %s
+
+# CHECK: Name: _end@
+# CHECK-NEXT: Value:
+# CHECK-NEXT: Size:
+# CHECK-NEXT: Binding: Global
+# CHECK-NEXT: Type: None
+# CHECK-NEXT: Other:
+# CHECK-NEXT: Section: .dynamic
+
+ .data
+ .quad _end
More information about the llvm-commits
mailing list