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/MipsExecutableWriter.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/MipsExecutableWriter.h')
-rw-r--r-- | lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h b/lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h index 3927d69e6be..61e2eedc539 100644 --- a/lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h +++ b/lld/lib/ReaderWriter/ELF/Mips/MipsExecutableWriter.h @@ -31,6 +31,7 @@ protected: bool createImplicitFiles(std::vector<std::unique_ptr<File>> &) override; void finalizeDefaultAtomValues() override; + void createDefaultSections() override; std::error_code setELFHeader() override; unique_bump_ptr<SymbolTable<ELFT>> createSymbolTable() override; @@ -40,6 +41,7 @@ protected: private: MipsELFWriter<ELFT> _writeHelper; MipsTargetLayout<ELFT> &_targetLayout; + unique_bump_ptr<Section<ELFT>> _reginfo; }; template <class ELFT> @@ -122,6 +124,18 @@ void MipsExecutableWriter<ELFT>::finalizeDefaultAtomValues() { _writeHelper.finalizeMipsRuntimeAtomValues(); } +template <class ELFT> void MipsExecutableWriter<ELFT>::createDefaultSections() { + ExecutableWriter<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>> MipsExecutableWriter<ELFT>::createSymbolTable() { |