OpenASIP
2.0
|
#include <AOutSymbolSectionReader.hh>
Classes | |
struct | CompilationModule |
struct | StabData |
Public Member Functions | |
virtual | ~AOutSymbolSectionReader () |
Public Member Functions inherited from TPEF::AOutSectionReader | |
virtual | ~AOutSectionReader () |
Public Member Functions inherited from TPEF::SectionReader | |
virtual | ~SectionReader () |
Protected Member Functions | |
AOutSymbolSectionReader () | |
virtual Section::SectionType | type () const |
virtual void | finalize (Section *section) const |
virtual void | readData (BinaryStream &stream, Section *section) const |
Protected Member Functions inherited from TPEF::AOutSectionReader | |
AOutSectionReader () | |
virtual BinaryReader * | parent () const |
Protected Member Functions inherited from TPEF::SectionReader | |
SectionReader () | |
Private Member Functions | |
SymbolElement * | initializeSymbol (BinaryStream &stream, SectionOffset sectionOffset, AOutReader *reader) const |
AOutSymbolSectionReader (const AOutSymbolSectionReader &) | |
Copying not allowed. More... | |
AOutSymbolSectionReader & | operator= (const AOutSymbolSectionReader &) |
Assignment not allowed. More... | |
Private Attributes | |
std::map< std::string, Word > | resolvedResources_ |
Resource id:s for strings. More... | |
std::vector< CompilationModule > | addedResources_ |
List of compilation modules of a.out. More... | |
std::vector< std::pair< Word, std::string > > | annotationes_ |
Static Private Attributes | |
static const Word | DATA_SYMBOL_SIZE = 4 |
Data symbol size in bytes. More... | |
static const std::string | GCC_MODULE_START_SYMBOL1 = "gcc2_compiled." |
One of the symbols that are used to indicate start of new compilation module in a.out symbol table. More... | |
static const std::string | GCC_MODULE_START_SYMBOL2 = "___gnu_compiled_c" |
One of the symbols that are used to indicate start of new compilation module in a.out symbol table. More... | |
static AOutSymbolSectionReader | proto_ |
Class-wide (unique) prototype instance of AOutSymbolSectionReader registered into SectionReader. 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 symbol table section from a.out binary file.
Definition at line 54 of file AOutSymbolSectionReader.hh.
|
virtual |
|
protected |
Constructor.
Registers itself to SectionReader.
Definition at line 79 of file AOutSymbolSectionReader.cc.
References TPEF::SectionReader::registerSectionReader().
|
private |
Copying not allowed.
|
protectedvirtual |
Finalizer method for AOut symbol sections.
Removes reserved gcc code symbols and converts compilation unit code label to file symbol.
Fixes resource references of special operations to use same id in all compilation units.
Adds annotationes to needed moves.
section | Section to finalize. |
Reimplemented from TPEF::SectionReader.
Definition at line 433 of file AOutSymbolSectionReader.cc.
References __func__, TPEF::SymbolElement::absolute(), TPEF::InstructionElement::addAnnotation(), addedResources_, TPEF::Section::addElement(), annotationes_, assert, TPEF::StringSection::chunk2String(), MapTools::containsKey(), TPEF::MoveElement::destinationIndex(), TPEF::MoveElement::destinationType(), TPEF::MoveElement::destinationUnit(), TPEF::CodeSection::element(), TPEF::Section::element(), TPEF::Section::elementCount(), GCC_MODULE_START_SYMBOL1, GCC_MODULE_START_SYMBOL2, TPEF::CodeSection::instruction(), TPEF::CodeSection::instructionCount(), TPEF::CodeSection::instructionToSectionIndex(), TPEF::InstructionElement::isImmediate(), TPEF::Section::link(), TPEF::MoveElement::MF_UNIT, TPEF::SymbolElement::name(), TPEF::AOutSectionReader::parent(), TPEF::CodeSymElement::reference(), TPEF::ReferenceManager::SafePointer::replaceAllReferences(), TPEF::AOutSymbolSectionReader::CompilationModule::resources_, TPEF::SymbolElement::section(), TPEF::SymbolElement::setAbsolute(), TPEF::SymbolElement::setBinding(), TPEF::MoveElement::setDestinationIndex(), TPEF::Section::setElement(), TPEF::SymbolElement::setName(), TPEF::CodeSymElement::setReference(), TPEF::SymbolElement::setSection(), TPEF::CodeSymElement::setSize(), TPEF::MoveElement::setSourceIndex(), TPEF::CodeSymElement::size(), TPEF::MoveElement::sourceIndex(), TPEF::MoveElement::sourceType(), TPEF::MoveElement::sourceUnit(), TPEF::AOutSymbolSectionReader::CompilationModule::startAddress_, TPEF::SymbolElement::STB_LOCAL, TPEF::SymbolElement::STT_CODE, TPEF::SymbolElement::STT_NOTYPE, Conversion::toInt(), TPEF::SymbolElement::type(), and TPEF::ResourceElement::UNIVERSAL_FU.
|
private |
Creates and initilizes one symbol element.
Now only non-stabb symbols are read.
stream | The stream to be read from. |
sectionOffset | The offset of the element in section. |
reader | The base reader for a.out. |
KeyAlreadyExists | If key used to register object is in use. |
UnreachableStream | If there occurs problems with stream. |
OutOfRange | If offset read is out of the section. |
Definition at line 261 of file AOutSymbolSectionReader.cc.
References addedResources_, TPEF::Section::addElement(), TPEF::ReferenceManager::SafePointer::addObjectReference(), annotationes_, TPEF::RawSection::chunk(), TPEF::StringSection::chunk2String(), MapTools::containsKey(), DATA_SYMBOL_SIZE, TPEF::AOutReader::debugSection(), GCC_MODULE_START_SYMBOL1, TPEF::AOutReader::header(), TPEF::AOutReader::N_ANN, TPEF::AOutReader::N_BSS, TPEF::AOutReader::N_DATA, TPEF::AOutReader::N_EXT, TPEF::AOutReader::N_FN, TPEF::AOutReader::N_PRTAB, TPEF::AOutReader::N_TEXT, TPEF::AOutReader::N_UNDF, TPEF::AOutReader::nullSection(), TPEF::AOutSectionReader::parent(), TPEF::BinaryStream::readByte(), TPEF::BinaryStream::readHalfWord(), TPEF::BinaryStream::readWord(), resolvedResources_, TPEF::AOutReader::sectionOffsetOfAddress(), TPEF::AOutReader::Header::sectionSizeText(), TPEF::SymbolElement::setBinding(), TPEF::DebugElement::setDebugString(), TPEF::SymbolElement::setName(), TPEF::DataSymElement::setReference(), TPEF::CodeSymElement::setReference(), TPEF::SymbolElement::setSection(), TPEF::DataSymElement::setSize(), TPEF::AOutReader::ST_STRING, TPEF::AOutReader::ST_SYMBOL, TPEF::AOutReader::ST_TEXT, TPEF::SymbolElement::STB_GLOBAL, TPEF::SymbolElement::STB_LOCAL, and type().
Referenced by readData().
|
private |
Assignment not allowed.
|
protectedvirtual |
Reads a.out symbol section out of stream and stores it in section.
stream | The stream to be read from. |
section | The section in which data 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 112 of file AOutSymbolSectionReader.cc.
References addedResources_, TPEF::Section::addElement(), TPEF::ReferenceManager::SafePointer::addObjectReference(), assert, TPEF::ResourceElement::BOOL_RF, TPEF::AOutReader::FIRST_FU_REGISTER, TPEF::ResourceElement::FP_RF, TPEF::AOutReader::header(), initializeSymbol(), TPEF::ResourceElement::INT_RF, TPEF::ResourceElement::MRT_BUS, TPEF::ResourceElement::MRT_OP, TPEF::ResourceElement::MRT_RF, TPEF::ResourceElement::MRT_SR, TPEF::ResourceElement::MRT_UNIT, TPEF::AOutReader::nullSection(), TPEF::Chunk::offset(), TPEF::AOutSectionReader::parent(), TPEF::BinaryStream::readPosition(), resolvedResources_, TPEF::AOutReader::Header::sectionSizeSymbol(), TPEF::ResourceElement::setId(), TPEF::SymbolElement::setName(), TPEF::ResourceElement::setName(), TPEF::SymbolElement::setSection(), TPEF::ResourceElement::setType(), TPEF::AOutReader::ST_STRING, TPEF::AOutReader::ST_SYMBOL, TPEF::StringSection::string2Chunk(), TPEF::ResourceElement::UNIVERSAL_BUS, and TPEF::ResourceElement::UNIVERSAL_FU.
|
protectedvirtual |
Returns the type of section that this reader reads.
Implements TPEF::SectionReader.
Definition at line 95 of file AOutSymbolSectionReader.cc.
References TPEF::Section::ST_SYMTAB.
Referenced by initializeSymbol().
|
mutableprivate |
List of compilation modules of a.out.
Definition at line 143 of file AOutSymbolSectionReader.hh.
Referenced by finalize(), initializeSymbol(), and readData().
|
mutableprivate |
Definition at line 145 of file AOutSymbolSectionReader.hh.
Referenced by finalize(), and initializeSymbol().
|
staticprivate |
Data symbol size in bytes.
Definition at line 103 of file AOutSymbolSectionReader.hh.
Referenced by initializeSymbol().
|
staticprivate |
One of the symbols that are used to indicate start of new compilation module in a.out symbol table.
Definition at line 107 of file AOutSymbolSectionReader.hh.
Referenced by finalize(), and initializeSymbol().
|
staticprivate |
One of the symbols that are used to indicate start of new compilation module in a.out symbol table.
Definition at line 111 of file AOutSymbolSectionReader.hh.
Referenced by finalize().
|
staticprivate |
Class-wide (unique) prototype instance of AOutSymbolSectionReader registered into SectionReader.
Definition at line 115 of file AOutSymbolSectionReader.hh.
|
mutableprivate |
Resource id:s for strings.
Definition at line 140 of file AOutSymbolSectionReader.hh.
Referenced by initializeSymbol(), and readData().