From c3899d22342fcaef6b02b22c136b3e06ea918f95 Mon Sep 17 00:00:00 2001 From: Simon Atanasyan Date: Sat, 4 Apr 2015 19:13:32 +0000 Subject: [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 --- lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lld/lib/ReaderWriter/ELF/Mips/MipsDynamicLibraryWriter.h') 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> &) override; void finalizeDefaultAtomValues() override; + void createDefaultSections() override; std::error_code setELFHeader() override { DynamicLibraryWriter::setELFHeader(); @@ -46,6 +48,7 @@ protected: private: MipsELFWriter _writeHelper; MipsTargetLayout &_targetLayout; + unique_bump_ptr> _reginfo; }; template @@ -69,6 +72,19 @@ void MipsDynamicLibraryWriter::finalizeDefaultAtomValues() { _writeHelper.finalizeMipsRuntimeAtomValues(); } +template +void MipsDynamicLibraryWriter::createDefaultSections() { + DynamicLibraryWriter::createDefaultSections(); + const auto &mask = + static_cast(this->_ctx).getMergeReginfoMask(); + if (!ELFT::Is64Bits && mask.hasValue()) { + _reginfo = unique_bump_ptr>( + new (this->_alloc) + MipsReginfoSection(this->_ctx, _targetLayout, *mask)); + this->_layout.addSection(_reginfo.get()); + } +} + template unique_bump_ptr> MipsDynamicLibraryWriter::createSymbolTable() { -- cgit v1.2.3