summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/DefaultLayout.h
diff options
context:
space:
mode:
authorRafael Auler <rafaelauler@gmail.com>2014-10-09 22:06:38 +0000
committerRafael Auler <rafaelauler@gmail.com>2014-10-09 22:06:38 +0000
commitb722e31906c52aa14749248bda5fc982ad3ff3fc (patch)
tree7248fcef8c8d90d64073993a10b83db217e76767 /lld/lib/ReaderWriter/ELF/DefaultLayout.h
parentd2241bf561c16ae50649096c5ed0ba5a2b4494a1 (diff)
downloadbcm5719-llvm-b722e31906c52aa14749248bda5fc982ad3ff3fc.tar.gz
bcm5719-llvm-b722e31906c52aa14749248bda5fc982ad3ff3fc.zip
Reapply [ELF] Only mark as DT_NEEDED libs that are strictly necessary (r219353)
When committed in r219353, this patch originally caused problems because it was not tested in debug build. In such scenarios, Driver.cpp adds two additional passes. These passes serialize all atoms via YAML and reads it back. Since the patch changed ObjectAtom to hold a new reference, the serialization was removing the extra data. This commit implements r219853 in another way, similar to the original MIPS way, by using a StringSet that holds the names of all copied atoms instead of directly holding a reference to the copied atom. In this way, this commit is simpler and eliminate the necessity of changing the DefinedAtom hierarchy to hold a new data. Reviewers: shankarke http://reviews.llvm.org/D5713 llvm-svn: 219449
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/DefaultLayout.h')
-rw-r--r--lld/lib/ReaderWriter/ELF/DefaultLayout.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/DefaultLayout.h b/lld/lib/ReaderWriter/ELF/DefaultLayout.h
index d198c5abc6f..87c6cfc1a29 100644
--- a/lld/lib/ReaderWriter/ELF/DefaultLayout.h
+++ b/lld/lib/ReaderWriter/ELF/DefaultLayout.h
@@ -10,6 +10,7 @@
#ifndef LLD_READER_WRITER_ELF_DEFAULT_LAYOUT_H
#define LLD_READER_WRITER_ELF_DEFAULT_LAYOUT_H
+#include "Atoms.h"
#include "Chunk.h"
#include "HeaderChunks.h"
#include "Layout.h"
@@ -303,6 +304,10 @@ public:
return _referencedDynAtoms.count(a);
}
+ bool isCopied(const SharedLibraryAtom *sla) const {
+ return _copiedDynSymNames.count(sla->name());
+ }
+
protected:
/// \brief Allocate a new section.
virtual AtomSection<ELFT> *createSection(
@@ -325,6 +330,7 @@ protected:
LLD_UNIQUE_BUMP_PTR(RelocationTable<ELFT>) _pltRelocationTable;
std::vector<lld::AtomLayout *> _absoluteAtoms;
AtomSetT _referencedDynAtoms;
+ llvm::StringSet<> _copiedDynSymNames;
const ELFLinkingContext &_context;
};
@@ -582,6 +588,11 @@ ErrorOr<const lld::AtomLayout &> DefaultLayout<ELFT>::addAtom(const Atom *atom)
if (isa<UndefinedAtom>(reloc->target()) && isLocalReloc)
continue;
+ if (_context.isCopyRelocation(*reloc)) {
+ _copiedDynSymNames.insert(definedAtom->name());
+ continue;
+ }
+
_referencedDynAtoms.insert(reloc->target());
}
OpenPOWER on IntegriCloud