Handle empty dynamic lists.

llvm-svn: 312820
This commit is contained in:
Rafael Espindola
2017-09-08 18:53:43 +00:00
parent 2f4df7ec41
commit 8016bdfd93
4 changed files with 21 additions and 1 deletions

View File

@@ -126,6 +126,7 @@ struct Configuration {
bool GcSections;
bool GdbIndex;
bool GnuHash;
bool HasDynamicList = false;
bool ICF;
bool MipsN32Abi = false;
bool NoGnuUnique;

View File

@@ -180,6 +180,7 @@ static ExprValue bitOr(ExprValue A, ExprValue B) {
}
void ScriptParser::readDynamicList() {
Config->HasDynamicList = true;
expect("{");
std::vector<SymbolVersion> Locals;
std::vector<SymbolVersion> Globals;

View File

@@ -1244,7 +1244,7 @@ static bool computeIsPreemptible(const SymbolBody &B) {
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)

View File

@@ -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@PLT