[lld] r268926 - Allow user defined __init_aray_start.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Mon May 9 08:25:54 PDT 2016
Author: rafael
Date: Mon May 9 10:25:54 2016
New Revision: 268926
URL: http://llvm.org/viewvc/llvm-project?rev=268926&view=rev
Log:
Allow user defined __init_aray_start.
Fixes pr27683.
Added:
lld/trunk/test/ELF/user_def_init_array_start.s
Modified:
lld/trunk/ELF/Writer.cpp
Modified: lld/trunk/ELF/Writer.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Writer.cpp?rev=268926&r1=268925&r2=268926&view=diff
==============================================================================
--- lld/trunk/ELF/Writer.cpp (original)
+++ lld/trunk/ELF/Writer.cpp Mon May 9 10:25:54 2016
@@ -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);
}
Added: lld/trunk/test/ELF/user_def_init_array_start.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/user_def_init_array_start.s?rev=268926&view=auto
==============================================================================
--- lld/trunk/test/ELF/user_def_init_array_start.s (added)
+++ lld/trunk/test/ELF/user_def_init_array_start.s Mon May 9 10:25:54 2016
@@ -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
More information about the llvm-commits
mailing list