diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2016-09-13 12:25:30 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2016-09-13 12:25:30 +0000 |
| commit | 17c35832a08d6169dc2933eba2b24a29d183c935 (patch) | |
| tree | 2abf429f1a4a849c2bcb5ea6d13efc7251860eba | |
| parent | bb6984d4019fe530663f93bcd813deb9b7c1b072 (diff) | |
| download | bcm5719-llvm-17c35832a08d6169dc2933eba2b24a29d183c935.tar.gz bcm5719-llvm-17c35832a08d6169dc2933eba2b24a29d183c935.zip | |
Turn createKey into a static helper. NFC.
llvm-svn: 281325
| -rw-r--r-- | lld/ELF/OutputSections.cpp | 36 | ||||
| -rw-r--r-- | lld/ELF/OutputSections.h | 2 |
2 files changed, 18 insertions, 20 deletions
diff --git a/lld/ELF/OutputSections.cpp b/lld/ELF/OutputSections.cpp index 7b197ce5a18..ce5bac9deb1 100644 --- a/lld/ELF/OutputSections.cpp +++ b/lld/ELF/OutputSections.cpp @@ -1831,6 +1831,24 @@ void MipsAbiFlagsOutputSection<ELFT>::addSection(InputSectionBase<ELFT> *C) { } template <class ELFT> +static SectionKey<ELFT::Is64Bits> createKey(InputSectionBase<ELFT> *C, + StringRef OutsecName) { + const typename ELFT::Shdr *H = C->getSectionHdr(); + typedef typename ELFT::uint uintX_t; + uintX_t Flags = H->sh_flags & ~SHF_GROUP & ~SHF_COMPRESSED; + + // For SHF_MERGE we create different output sections for each alignment. + // This makes each output section simple and keeps a single level mapping from + // input to output. + uintX_t Alignment = 0; + if (isa<MergeInputSection<ELFT>>(C)) + Alignment = std::max(H->sh_addralign, H->sh_entsize); + + uint32_t Type = H->sh_type; + return SectionKey<ELFT::Is64Bits>{OutsecName, Type, Flags, Alignment}; +} + +template <class ELFT> std::pair<OutputSectionBase<ELFT> *, bool> OutputSectionFactory<ELFT>::create(InputSectionBase<ELFT> *C, StringRef OutsecName) { @@ -1863,24 +1881,6 @@ OutputSectionFactory<ELFT>::create(InputSectionBase<ELFT> *C, return {Sec, true}; } -template <class ELFT> -SectionKey<ELFT::Is64Bits> -OutputSectionFactory<ELFT>::createKey(InputSectionBase<ELFT> *C, - StringRef OutsecName) { - const Elf_Shdr *H = C->getSectionHdr(); - uintX_t Flags = H->sh_flags & ~SHF_GROUP & ~SHF_COMPRESSED; - - // For SHF_MERGE we create different output sections for each alignment. - // This makes each output section simple and keeps a single level mapping from - // input to output. - uintX_t Alignment = 0; - if (isa<MergeInputSection<ELFT>>(C)) - Alignment = std::max(H->sh_addralign, H->sh_entsize); - - uint32_t Type = H->sh_type; - return SectionKey<ELFT::Is64Bits>{OutsecName, Type, Flags, Alignment}; -} - template <bool Is64Bits> typename lld::elf::SectionKey<Is64Bits> DenseMapInfo<lld::elf::SectionKey<Is64Bits>>::getEmptyKey() { diff --git a/lld/ELF/OutputSections.h b/lld/ELF/OutputSections.h index 5fee870a34c..cde4aa53272 100644 --- a/lld/ELF/OutputSections.h +++ b/lld/ELF/OutputSections.h @@ -805,8 +805,6 @@ public: StringRef OutsecName); private: - Key createKey(InputSectionBase<ELFT> *C, StringRef OutsecName); - llvm::SmallDenseMap<Key, OutputSectionBase<ELFT> *> Map; }; |

