/// \brief Read input sections and populate necessary data structures
/// to read them later and create atoms
- virtual std::error_code createAtomizableSections();
+ std::error_code createAtomizableSections();
/// \brief Create mergeable atoms from sections that have the merge attribute
/// set
- virtual std::error_code createMergeableAtoms();
+ std::error_code createMergeableAtoms();
/// \brief Add the symbols that the sections contain. The symbols will be
/// converted to atoms for
/// Undefined symbols, absolute symbols
- virtual std::error_code createSymbolsFromAtomizableSections();
+ std::error_code createSymbolsFromAtomizableSections();
/// \brief Create individual atoms
- virtual std::error_code createAtoms();
+ std::error_code createAtoms();
const atom_collection<DefinedAtom> &defined() const override {
return _definedAtoms;
/// \brief After all the Atoms and References are created, update each
/// Reference's target with the Atom pointer it refers to.
- virtual void updateReferences();
+ void updateReferences();
/// \brief Update the reference if the access corresponds to a merge string
/// section.
- virtual void updateReferenceForMergeStringAccess(ELFReference<ELFT> *ref,
- const Elf_Sym *symbol,
- const Elf_Shdr *shdr);
+ void updateReferenceForMergeStringAccess(ELFReference<ELFT> *ref,
+ const Elf_Sym *symbol,
+ const Elf_Shdr *shdr);
/// \brief Return true if the symbol is corresponding to an architecture
/// specific section. We will let the TargetHandler handle such atoms.
- virtual bool isTargetSpecificAtom(const Elf_Shdr *shdr, const Elf_Sym *sym);
+ bool isTargetSpecificAtom(const Elf_Shdr *shdr, const Elf_Sym *sym);
/// \brief Do we want to ignore the section. Ignored sections are
/// not processed to create atoms
- virtual bool isIgnoredSection(const Elf_Shdr *section);
+ bool isIgnoredSection(const Elf_Shdr *section);
/// \brief Is the current section be treated as a mergeable string section.
/// The contents of a mergeable string section are null-terminated strings.
/// If the section have mergeable strings, the linker would need to split
/// the section into multiple atoms and mark them mergeByContent.
- virtual bool isMergeableStringSection(const Elf_Shdr *section);
+ bool isMergeableStringSection(const Elf_Shdr *section);
/// \brief Returns a new anonymous atom whose size is equal to the
/// section size. That atom will be used to represent the entire
/// section that have no symbols.
- virtual ELFDefinedAtom<ELFT> *createSectionAtom(const Elf_Shdr *section,
- StringRef sectionName,
- ArrayRef<uint8_t> contents);
+ ELFDefinedAtom<ELFT> *createSectionAtom(const Elf_Shdr *section,
+ StringRef sectionName,
+ ArrayRef<uint8_t> contents);
/// Returns the symbol's content size. The nextSymbol should be null if the
/// symbol is the last one in the section.
- virtual uint64_t symbolContentSize(const Elf_Shdr *section,
- const Elf_Sym *symbol,
- const Elf_Sym *nextSymbol);
-
- virtual void createEdge(ELFDefinedAtom<ELFT> *from, ELFDefinedAtom<ELFT> *to,
- uint32_t edgeKind);
+ uint64_t symbolContentSize(const Elf_Shdr *section,
+ const Elf_Sym *symbol,
+ const Elf_Sym *nextSymbol);
/// Determines if the reader needs to create atoms for the section.
- virtual bool ignoreCreateAtomsForSection(const Elf_Shdr *shdr) {
+ bool ignoreCreateAtomsForSection(const Elf_Shdr *shdr) {
return false;
}
+ void createEdge(ELFDefinedAtom<ELFT> *from, ELFDefinedAtom<ELFT> *to,
+ uint32_t edgeKind);
+
/// Get the section name for a section.
- virtual ErrorOr<StringRef> getSectionName(const Elf_Shdr *shdr) const {
+ ErrorOr<StringRef> getSectionName(const Elf_Shdr *shdr) const {
if (!shdr)
return StringRef();
return _objFile->getSectionName(shdr);
}
/// Determines if the section occupy memory space.
- virtual bool sectionOccupiesMemorySpace(const Elf_Shdr *shdr) const {
+ bool sectionOccupiesMemorySpace(const Elf_Shdr *shdr) const {
return (shdr->sh_type != llvm::ELF::SHT_NOBITS);
}
/// Return the section contents.
- virtual ErrorOr<ArrayRef<uint8_t>>
- getSectionContents(const Elf_Shdr *shdr) const {
+ ErrorOr<ArrayRef<uint8_t>> getSectionContents(const Elf_Shdr *shdr) const {
if (!shdr || !sectionOccupiesMemorySpace(shdr))
return ArrayRef<uint8_t>();
return _objFile->getSectionContents(shdr);
}
/// Returns true if the symbol is a undefined symbol.
- virtual bool isUndefinedSymbol(const Elf_Sym *sym) const {
+ bool isUndefinedSymbol(const Elf_Sym *sym) const {
return (sym->st_shndx == llvm::ELF::SHN_UNDEF);
}
/// Determines if the target wants to create an atom for a section that has no
/// symbol references.
- virtual bool
- handleSectionWithNoSymbols(const Elf_Shdr *shdr,
- std::vector<Elf_Sym_Iter> &symbols) const {
+ bool handleSectionWithNoSymbols(const Elf_Shdr *shdr,
+ std::vector<Elf_Sym_Iter> &symbols) const {
if (shdr && shdr->sh_type == llvm::ELF::SHT_PROGBITS && symbols.empty())
return true;
return false;
}
/// Process the Undefined symbol and create an atom for it.
- virtual ErrorOr<ELFUndefinedAtom<ELFT> *>
+ ErrorOr<ELFUndefinedAtom<ELFT> *>
handleUndefinedSymbol(StringRef symName, const Elf_Sym *sym) {
return new (_readerStorage) ELFUndefinedAtom<ELFT>(*this, symName, sym);
}
/// Returns true if the symbol is a absolute symbol.
- virtual bool isAbsoluteSymbol(const Elf_Sym *sym) const {
+ bool isAbsoluteSymbol(const Elf_Sym *sym) const {
return (sym->st_shndx == llvm::ELF::SHN_ABS);
}
/// Process the Absolute symbol and create an atom for it.
- virtual ErrorOr<ELFAbsoluteAtom<ELFT> *>
+ ErrorOr<ELFAbsoluteAtom<ELFT> *>
handleAbsoluteSymbol(StringRef symName, const Elf_Sym *sym, int64_t value) {
return new (_readerStorage)
ELFAbsoluteAtom<ELFT>(*this, symName, sym, value);
}
/// Process the Merge string and create an atom for it.
- virtual ErrorOr<ELFMergeAtom<ELFT> *>
+ ErrorOr<ELFMergeAtom<ELFT> *>
handleMergeString(StringRef sectionName, const Elf_Shdr *sectionHdr,
ArrayRef<uint8_t> contentData, unsigned int offset) {
ELFMergeAtom<ELFT> *mergeAtom = new (_readerStorage)
new HexagonELFFile<ELFT>(std::move(mb), atomizeStrings));
}
- virtual bool isCommonSymbol(const Elf_Sym *symbol) const {
+ bool isCommonSymbol(const Elf_Sym *symbol) const override {
switch (symbol->st_shndx) {
// Common symbols
case llvm::ELF::SHN_HEXAGON_SCOMMON:
}
/// Process the Defined symbol and create an atom for it.
- virtual ErrorOr<ELFDefinedAtom<ELFT> *>
+ ErrorOr<ELFDefinedAtom<ELFT> *>
handleDefinedSymbol(StringRef symName, StringRef sectionName,
const Elf_Sym *sym, const Elf_Shdr *sectionHdr,
ArrayRef<uint8_t> contentData,
unsigned int referenceStart, unsigned int referenceEnd,
- std::vector<ELFReference<ELFT> *> &referenceList) {
+ std::vector<ELFReference<ELFT> *> &referenceList) override {
return new (this->_readerStorage) HexagonELFDefinedAtom<ELFT>(
*this, symName, sectionName, sym, sectionHdr, contentData,
referenceStart, referenceEnd, referenceList);
}
/// Process the Common symbol and create an atom for it.
- virtual ErrorOr<ELFCommonAtom<ELFT> *>
- handleCommonSymbol(StringRef symName, const Elf_Sym *sym) {
+ ErrorOr<ELFCommonAtom<ELFT> *>
+ handleCommonSymbol(StringRef symName, const Elf_Sym *sym) override {
return new (this->_readerStorage)
HexagonELFCommonAtom<ELFT>(*this, symName, sym);
}