Allow user defined __init_aray_start.

Fixes pr27683.

llvm-svn: 268926
This commit is contained in:
Rafael Espindola 2016-05-09 15:25:54 +00:00
parent d69b505e3c
commit 45a33fb799
2 changed files with 14 additions and 1 deletions

View File

@ -1104,8 +1104,11 @@ template <class ELFT>
static Symbol *addOptionalSynthetic(SymbolTable<ELFT> &Table, StringRef Name,
OutputSectionBase<ELFT> *Sec,
typename ELFT::uint Val) {
if (!Table.find(Name))
SymbolBody *S = Table.find(Name);
if (!S)
return nullptr;
if (!S->isUndefined() && !S->isShared())
return S->symbol();
return Table.addSynthetic(Name, Sec, Val);
}

View File

@ -0,0 +1,10 @@
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o
// RUN: ld.lld %t.o -o %t2.so -shared
// Allow user defined __init_array_start. This is used by musl because of the
// the bfd linker not handling these properly. We always create them as
// hidden, musl should not have problems with lld.
.hidden __init_array_start
.globl __init_array_start
__init_array_start:
.zero 8