[lld] r312820 - Handle empty dynamic lists.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 8 11:53:44 PDT 2017
Author: rafael
Date: Fri Sep 8 11:53:43 2017
New Revision: 312820
URL: http://llvm.org/viewvc/llvm-project?rev=312820&view=rev
Log:
Handle empty dynamic lists.
Added:
lld/trunk/test/ELF/dynamic-list-empty.s
Modified:
lld/trunk/ELF/Config.h
lld/trunk/ELF/ScriptParser.cpp
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Config.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Config.h?rev=312820&r1=312819&r2=312820&view=diff
==============================================================================
--- lld/trunk/ELF/Config.h (original)
+++ lld/trunk/ELF/Config.h Fri Sep 8 11:53:43 2017
@@ -126,6 +126,7 @@ struct Configuration {
bool GcSections;
bool GdbIndex;
bool GnuHash;
+ bool HasDynamicList = false;
bool ICF;
bool MipsN32Abi = false;
bool NoGnuUnique;
Modified: lld/trunk/ELF/ScriptParser.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/ScriptParser.cpp?rev=312820&r1=312819&r2=312820&view=diff
==============================================================================
--- lld/trunk/ELF/ScriptParser.cpp (original)
+++ lld/trunk/ELF/ScriptParser.cpp Fri Sep 8 11:53:43 2017
@@ -180,6 +180,7 @@ static ExprValue bitOr(ExprValue A, Expr
}
void ScriptParser::readDynamicList() {
+ Config->HasDynamicList = true;
expect("{");
std::vector<SymbolVersion> Locals;
std::vector<SymbolVersion> Globals;
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=312820&r1=312819&r2=312820&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Fri Sep 8 11:53:43 2017
@@ -1244,7 +1244,7 @@ static bool computeIsPreemptible(const S
return true;
// If we have a dynamic list it specifies which local symbols are preemptible.
- if (!Config->DynamicList.empty())
+ if (Config->HasDynamicList)
return false;
if (!Config->Shared)
Added: lld/trunk/test/ELF/dynamic-list-empty.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/dynamic-list-empty.s?rev=312820&view=auto
==============================================================================
--- lld/trunk/test/ELF/dynamic-list-empty.s (added)
+++ lld/trunk/test/ELF/dynamic-list-empty.s Fri Sep 8 11:53:43 2017
@@ -0,0 +1,18 @@
+# REQUIRES: x86
+
+# BFD reports a parse error on empty lists, but it is clear how to
+# handle it.
+
+# RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
+# RUN: echo "{ };" > %t.list
+# RUN: ld.lld -dynamic-list %t.list -shared %t.o -o %t.so
+# RUN: llvm-readobj -r %t.so | FileCheck %s
+
+# CHECK: Relocations [
+# CHECK-NEXT: ]
+
+ .globl foo
+foo:
+ ret
+
+ call foo at PLT
More information about the llvm-commits
mailing list