diff options
author | Simon Atanasyan <simon@atanasyan.com> | 2015-04-04 19:13:32 +0000 |
---|---|---|
committer | Simon Atanasyan <simon@atanasyan.com> | 2015-04-04 19:13:32 +0000 |
commit | c3899d22342fcaef6b02b22c136b3e06ea918f95 (patch) | |
tree | 437c4e8a992a6d03fc4d5cb402509917acb386cd /lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h | |
parent | 090132563b35651dc1ae67495b96bb781e68f9bd (diff) | |
download | bcm5719-llvm-c3899d22342fcaef6b02b22c136b3e06ea918f95.tar.gz bcm5719-llvm-c3899d22342fcaef6b02b22c136b3e06ea918f95.zip |
[Mips] Support writing .reginfo section into the linked file
In case of MIPS O32 ABI linker should merge registers usage masks stored
in the input .reginfo sections and save result into the output .reginfo
section.
The ABI states that the .reginfo section should be put into the separate
segment. This requirement is not implemented in this patch.
llvm-svn: 234103
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h')
-rw-r--r-- | lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h b/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h index 034b57ca7c3..a72a467b808 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h @@ -13,6 +13,7 @@ #include "MipsDynamicTable.h" #include "MipsELFWriters.h" #include "MipsLinkingContext.h" +#include "MipsSectionChunks.h" namespace lld { namespace elf { @@ -32,6 +33,7 @@ protected: bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override; void finalizeDefaultAtomValues() override; + void createDefaultSections() override; std::error_code setELFHeader() override { DynamicLibraryWriter<ELFT>::setELFHeader(); @@ -46,6 +48,7 @@ protected: private: MipsELFWriter<ELFT> _writeHelper; MipsTargetLayout<ELFT> &_targetLayout; + unique_bump_ptr<Section<ELFT>> _reginfo; }; template <class ELFT> @@ -70,6 +73,19 @@ void MipsDynamicLibraryWriter<ELFT>::finalizeDefaultAtomValues() { } template <class ELFT> +void MipsDynamicLibraryWriter<ELFT>::createDefaultSections() { + DynamicLibraryWriter<ELFT>::createDefaultSections(); + const auto &mask = + static_cast<const MipsLinkingContext &>(this->_ctx).getMergeReginfoMask(); + if (!ELFT::Is64Bits && mask.hasValue()) { + _reginfo = unique_bump_ptr<Section<ELFT>>( + new (this->_alloc) + MipsReginfoSection<ELFT>(this->_ctx, _targetLayout, *mask)); + this->_layout.addSection(_reginfo.get()); + } +} + +template <class ELFT> unique_bump_ptr<SymbolTable<ELFT>> MipsDynamicLibraryWriter<ELFT>::createSymbolTable() { return unique_bump_ptr<SymbolTable<ELFT>>( |