OpenASIP
2.0
|
#include <AOutRelocationSectionReader.hh>
Public Member Functions | |
virtual | ~AOutRelocationSectionReader () |
Public Member Functions inherited from TPEF::AOutSectionReader | |
virtual | ~AOutSectionReader () |
Public Member Functions inherited from TPEF::SectionReader | |
virtual | ~SectionReader () |
Protected Member Functions | |
AOutRelocationSectionReader () | |
virtual void | finalize (Section *section) const |
virtual void | readData (BinaryStream &stream, Section *section) const |
virtual Section::SectionType | type () const |
Protected Member Functions inherited from TPEF::AOutSectionReader | |
AOutSectionReader () | |
virtual BinaryReader * | parent () const |
Protected Member Functions inherited from TPEF::SectionReader | |
SectionReader () | |
Private Types | |
enum | RelocType { RELOC_8, RELOC_16, RELOC_32, NO_RELOC } |
Private Member Functions | |
void | initializeRelocElement (BinaryStream &stream, RelocElement *elem, SectionId refSectionID, AOutReader *reader) const |
bool | checkIfExtern (Word word) const |
AOutRelocationSectionReader (const AOutRelocationSectionReader &) | |
Copying not allowed. More... | |
AOutRelocationSectionReader & | operator= (AOutRelocationSectionReader &) |
Assignment not allowed. More... | |
RelocElement::RelocType | aOutToTPEFRelocType (RelocType aOutRelocType) const |
Static Private Attributes | |
static AOutRelocationSectionReader | proto_ |
Class-wide (unique) prototype instance of AOutRelocationSectionReader registered into SectionReader. More... | |
static const Byte | RELOCATION_TYPE_MASK = 0x1F |
Mask for extracting relocation type. More... | |
Additional Inherited Members | |
Public Types inherited from TPEF::SectionReader | |
typedef BinaryReader::Length | Length |
Static Public Member Functions inherited from TPEF::SectionReader | |
static void | readSection (BinaryStream &stream, Section *section, BinaryReader *reader) |
static void | finalizeBinary (Binary *binaryToFinalize, BinaryReader *reader) |
Static Protected Member Functions inherited from TPEF::SectionReader | |
static const SectionReader * | findSectionReader (const Section::SectionType type, const BinaryReader *bReader) |
static void | registerSectionReader (const SectionReader *sReader) |
Reads relocation sections of a.out binary.
Definition at line 51 of file AOutRelocationSectionReader.hh.
|
private |
Relocation types of a.out
Enumerator | |
---|---|
RELOC_8 | 1 byte relocation |
RELOC_16 | 2 bytes relocation |
RELOC_32 | 4 bytes relocation |
NO_RELOC | no relocation |
Definition at line 68 of file AOutRelocationSectionReader.hh.
|
virtual |
|
protected |
Constructor.
Registers itself to AOutSectionReader.
Definition at line 67 of file AOutRelocationSectionReader.cc.
References TPEF::SectionReader::registerSectionReader().
|
private |
Copying not allowed.
|
private |
Converts a.out relocation type into TPEF relocation.
aOutRelocType | Identification code of the relocation type to convert to TPEF format. |
Definition at line 295 of file AOutRelocationSectionReader.cc.
References assert, NO_RELOC, RELOC_16, RELOC_32, RELOC_8, TPEF::RelocElement::RT_NOREL, and TPEF::RelocElement::RT_SELF.
Referenced by initializeRelocElement().
|
private |
Referenced by initializeRelocElement().
|
protectedvirtual |
Finalizer method for AOut relocation sections.
Fixes values of elements pointed by location(), MOVE linker does not update values of elements referred from relocation. Also sets address spaces for relocation elements.
section | Section to finalize. |
Reimplemented from TPEF::SectionReader.
Definition at line 224 of file AOutRelocationSectionReader.cc.
References TPEF::AOutReader::addressOfElement(), TPEF::AOutReader::aSpaceOfElement(), assert, TPEF::RawSection::chunkToMAUIndex(), TPEF::RelocElement::destination(), TPEF::Section::element(), TPEF::Section::elementCount(), TPEF::Section::isCodeSection(), TPEF::DataSection::length(), TPEF::RelocElement::location(), TPEF::Chunk::offset(), TPEF::AOutSectionReader::parent(), TPEF::RelocElement::setASpace(), TPEF::ImmediateElement::setWord(), TPEF::Section::ST_DATA, TPEF::Section::type(), and TPEF::DataSection::writeValue().
|
private |
Initializes one RelocElement object with correct values.
stream | The stream to be read from. |
elem | Element to be initialized. |
refSectionID | Identification code of the section that holds relocation source. |
reader | The base reader for a.out. |
UnexpectedValue | If extern bit is not zero, or if relocation target is not text or data section. |
UnreachableStream | If stream can't be read. |
OutOfRange | Section offset of an address is invalid. |
Definition at line 158 of file AOutRelocationSectionReader.cc.
References aOutToTPEFRelocType(), BYTE_BITWIDTH, checkIfExtern(), TPEF::AOutTextSectionReader::OFFSET_TO_IMMEDIATE_VALUE, TPEF::BinaryStream::readWord(), RELOCATION_TYPE_MASK, TPEF::AOutReader::sectionOffsetOfAddress(), TPEF::RelocElement::setDestination(), TPEF::RelocElement::setLocation(), TPEF::RelocElement::setSize(), TPEF::RelocElement::setSymbol(), TPEF::RelocElement::setType(), TPEF::AOutReader::ST_SYMBOL, and TPEF::AOutReader::ST_TEXT.
Referenced by readData().
|
private |
Assignment not allowed.
|
protectedvirtual |
Reads relocation sections from a.out binary file.
stream | The stream to be read from. |
section | Section where to information is stored. |
UnreachableStream | If reading of section fails. |
KeyAlreadyExists | Key was in use when trying to register object. |
EndOfFile | If end of file were reached while it shouldn't. |
OutOfRange | Some of read values were out of range. |
WrongSubclass | Some class couldn't do what it was asked for. |
UnexpectedValue | If there was unexpected value when reading. |
Implements TPEF::SectionReader.
Definition at line 102 of file AOutRelocationSectionReader.cc.
References __func__, TPEF::Section::addElement(), assert, TPEF::AOutReader::header(), initializeRelocElement(), TPEF::Section::isCodeSection(), TPEF::AOutSectionReader::parent(), TPEF::BinaryStream::readPosition(), TPEF::RelocSection::referencedSection(), TPEF::AOutReader::Header::sectionSizeDataReloc(), TPEF::AOutReader::Header::sectionSizeTextReloc(), TPEF::Section::ST_DATA, TPEF::AOutReader::ST_DATA, TPEF::AOutReader::ST_TEXT, and TPEF::Section::type().
|
protectedvirtual |
Returns the type of section that reader can read.
Implements TPEF::SectionReader.
Definition at line 85 of file AOutRelocationSectionReader.cc.
References TPEF::Section::ST_RELOC.
|
staticprivate |
Class-wide (unique) prototype instance of AOutRelocationSectionReader registered into SectionReader.
Definition at line 91 of file AOutRelocationSectionReader.hh.
|
staticprivate |
Mask for extracting relocation type.
Definition at line 94 of file AOutRelocationSectionReader.hh.
Referenced by initializeRelocElement().