From 8a59f5c79fec30f876d30f4e8347dfed64ea3df5 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Fri, 13 Jan 2017 19:18:11 +0000 Subject: Don't add DT_INIT/DT_FINI for undef and shared symbols. The freebsd dynamic linker doesn't check if the value is null (and it is reasonable for it to do that). That means that producing a .so with a null DT_INIT/DT_FINI causes the base address to be called. This should fix the libreoffice build. llvm-svn: 291944 --- lld/ELF/SymbolTable.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lld/ELF/SymbolTable.cpp') diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index 6afe3dde9ba..eceb6dc96e1 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -467,6 +467,14 @@ template SymbolBody *SymbolTable::find(StringRef Name) { return SymVector[V.Idx]->body(); } +template +SymbolBody *SymbolTable::findDefined(StringRef Name) { + if (SymbolBody *S = find(Name)) + if (S->isDefined() && !S->isShared()) + return S; + return nullptr; +} + template void SymbolTable::addLazyArchive(ArchiveFile *F, const object::Archive::Symbol Sym) { -- cgit v1.2.3