summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/DynamicLibraryWriter.h
diff options
context:
space:
mode:
authorShankar Easwaran <shankare@codeaurora.org>2014-01-27 01:21:02 +0000
committerShankar Easwaran <shankare@codeaurora.org>2014-01-27 01:21:02 +0000
commitb11964707ca24b4bfc4c39f3c6c42ef9c2ef800b (patch)
tree84862e61f7c57f4025951ca97e65a6eb0ab73e8c /lld/lib/ReaderWriter/ELF/DynamicLibraryWriter.h
parentaf7fbd8cf426f74239bd6d30b52beda7524f46c1 (diff)
downloadbcm5719-llvm-b11964707ca24b4bfc4c39f3c6c42ef9c2ef800b.tar.gz
bcm5719-llvm-b11964707ca24b4bfc4c39f3c6c42ef9c2ef800b.zip
[ELF] Make changes to all the targets supported currently
X86_64,X86,PPC,Hexagon,Mips No change in functionality. llvm-svn: 200177
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/DynamicLibraryWriter.h')
-rw-r--r--lld/lib/ReaderWriter/ELF/DynamicLibraryWriter.h27
1 files changed, 13 insertions, 14 deletions
diff --git a/lld/lib/ReaderWriter/ELF/DynamicLibraryWriter.h b/lld/lib/ReaderWriter/ELF/DynamicLibraryWriter.h
index 176a14f912f..84d6ac4a2d5 100644
--- a/lld/lib/ReaderWriter/ELF/DynamicLibraryWriter.h
+++ b/lld/lib/ReaderWriter/ELF/DynamicLibraryWriter.h
@@ -25,17 +25,18 @@ class DynamicLibraryWriter;
template<class ELFT>
class DynamicLibraryWriter : public OutputELFWriter<ELFT> {
public:
- DynamicLibraryWriter(const ELFLinkingContext &context)
- : OutputELFWriter<ELFT>(context),
+ DynamicLibraryWriter(const ELFLinkingContext &context,
+ TargetLayout<ELFT> &layout)
+ : OutputELFWriter<ELFT>(context, layout),
_runtimeFile(new CRuntimeFile<ELFT>(context)) {}
-private:
- void buildDynamicSymbolTable(const File &file);
- void addDefaultAtoms();
+protected:
+ virtual void buildDynamicSymbolTable(const File &file);
+ virtual void addDefaultAtoms();
virtual bool createImplicitFiles(std::vector<std::unique_ptr<File> > &);
- void finalizeDefaultAtomValues();
+ virtual void finalizeDefaultAtomValues();
- llvm::BumpPtrAllocator _alloc;
+protected:
std::unique_ptr<CRuntimeFile<ELFT> > _runtimeFile;
};
@@ -47,7 +48,7 @@ void DynamicLibraryWriter<ELFT>::buildDynamicSymbolTable(const File &file) {
// Add all the defined symbols to the dynamic symbol table
// we need hooks into the Atom to find out which atoms need
// to be exported
- for (auto sec : this->_layout->sections())
+ for (auto sec : this->_layout.sections())
if (auto section = dyn_cast<AtomSection<ELFT>>(sec))
for (const auto &atom : section->atoms()) {
const DefinedAtom *da = dyn_cast<const DefinedAtom>(atom->_atom);
@@ -71,7 +72,7 @@ template <class ELFT>
bool DynamicLibraryWriter<ELFT>::createImplicitFiles(
std::vector<std::unique_ptr<File> > &result) {
// Add the default atoms as defined by executables
- addDefaultAtoms();
+ DynamicLibraryWriter<ELFT>::addDefaultAtoms();
OutputELFWriter<ELFT>::createImplicitFiles(result);
result.push_back(std::move(_runtimeFile));
return true;
@@ -79,17 +80,15 @@ bool DynamicLibraryWriter<ELFT>::createImplicitFiles(
template <class ELFT>
void DynamicLibraryWriter<ELFT>::finalizeDefaultAtomValues() {
- auto underScoreEndAtomIter = this->_layout->findAbsoluteAtom("_end");
+ auto underScoreEndAtomIter = this->_layout.findAbsoluteAtom("_end");
- if (auto bssSection = this->_layout->findOutputSection(".bss")) {
+ if (auto bssSection = this->_layout.findOutputSection(".bss")) {
(*underScoreEndAtomIter)->_virtualAddr =
bssSection->virtualAddr() + bssSection->memSize();
- } else if (auto dataSection = this->_layout->findOutputSection(".data")) {
+ } else if (auto dataSection = this->_layout.findOutputSection(".data")) {
(*underScoreEndAtomIter)->_virtualAddr =
dataSection->virtualAddr() + dataSection->memSize();
}
-
- this->_targetHandler.finalizeSymbolValues();
}
} // namespace elf
OpenPOWER on IntegriCloud