summaryrefslogtreecommitdiffstats
path: root/lld/lib/ReaderWriter/ELF/SectionChunks.h
diff options
context:
space:
mode:
Diffstat (limited to 'lld/lib/ReaderWriter/ELF/SectionChunks.h')
-rw-r--r--lld/lib/ReaderWriter/ELF/SectionChunks.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/lld/lib/ReaderWriter/ELF/SectionChunks.h b/lld/lib/ReaderWriter/ELF/SectionChunks.h
index 765a2795ad7..42c70b89d1b 100644
--- a/lld/lib/ReaderWriter/ELF/SectionChunks.h
+++ b/lld/lib/ReaderWriter/ELF/SectionChunks.h
@@ -78,6 +78,18 @@ public:
uint32_t getInfo() const { return _info; }
Layout::SegmentType getSegmentType() const { return _segmentType; }
+ /// \brief Return the type of content that the section contains
+ virtual int getContentType() const {
+ if (_flags & llvm::ELF::SHF_EXECINSTR)
+ return Chunk<ELFT>::CT_Code;
+ else if (_flags & llvm::ELF::SHF_WRITE)
+ return Chunk<ELFT>::CT_Data;
+ else if (_flags & llvm::ELF::SHF_ALLOC)
+ return Chunk<ELFT>::CT_Code;
+ else
+ return Chunk<ELFT>::CT_Unknown;
+ }
+
/// \brief convert the segment type to a String for diagnostics and printing
/// purposes
StringRef segmentKindToStr() const;
OpenPOWER on IntegriCloud