55using ReferenceManager::SectionOffsetKey;
56using ReferenceManager::SectionIndexKey;
57using ReferenceManager::SafePointer;
107 assert(aOutReader != NULL);
112 assert(relocSection != NULL);
115 assert(refSection != NULL);
129 string msg =
"Relocating something else than text or data section";
173 Word secondWord = stream.
readWord();
188 if (r_addend == 0 &&
checkIfExtern(secondWord) && secondWord != 1026) {
190 elem->
setSymbol(CREATE_SAFEPOINTER(indexKey));
195 elem->
setSymbol(CREATE_SAFEPOINTER(undefSym));
227 dynamic_cast<RelocSection*
>(section)->referencedSection();
230 assert(aOutReader != NULL);
268 if (dataChunk->
offset() +
sizeof(destAddress) >
270 bool requestedChunkWasOutOfRange =
false;
271 assert(requestedChunkWasOutOfRange);
278 mauIndex, 4,
static_cast<unsigned long>(destAddress));
281 bool referencedSectionMustBeEitherCodeOrData =
false;
282 assert(referencedSectionMustBeEitherCodeOrData);
300 switch (aOutRelocType) {
308 bool unknownAOutRelocationType =
false;
309 assert(unknownAOutRelocationType);
#define assert(condition)
UInt32 AddressImage
Type for storing addresses to memory image.
AddressImage addressOfElement(SectionElement *elem) const
SectionOffset sectionOffsetOfAddress(AddressImage address) const
ASpaceElement * aSpaceOfElement(SectionElement *elem) const
static const Header & header()
@ RELOC_32
4 bytes relocation
@ RELOC_8
1 byte relocation
@ RELOC_16
2 bytes relocation
static AOutRelocationSectionReader proto_
Class-wide (unique) prototype instance of AOutRelocationSectionReader registered into SectionReader.
static const Byte RELOCATION_TYPE_MASK
Mask for extracting relocation type.
virtual void finalize(Section *section) const
AOutRelocationSectionReader()
virtual ~AOutRelocationSectionReader()
virtual Section::SectionType type() const
bool checkIfExtern(Word word) const
virtual void readData(BinaryStream &stream, Section *section) const
RelocElement::RelocType aOutToTPEFRelocType(RelocType aOutRelocType) const
void initializeRelocElement(BinaryStream &stream, RelocElement *elem, SectionId refSectionID, AOutReader *reader) const
virtual BinaryReader * parent() const
static const int OFFSET_TO_IMMEDIATE_VALUE
unsigned int readPosition()
SectionOffset offset() const
virtual Word length() const
virtual void writeValue(Word index, Word numOfMAUs, unsigned long value)
virtual Word chunkToMAUIndex(const Chunk *chunk) const
SectionElement * destination() const
void setASpace(ASpaceElement *anASpace)
void setLocation(SectionElement *aLocation)
void setSymbol(SymbolElement *aSymbol)
void setType(RelocType aType)
@ RT_SELF
Absolute address, relocate relative to address self.
SectionElement * location() const
void setDestination(SectionElement *aDestination)
Section * referencedSection() const
static void registerSectionReader(const SectionReader *sReader)
virtual void addElement(SectionElement *element)
@ ST_DATA
Initialized data section.
@ ST_RELOC
Relocation section.
SectionElement * element(Word index) const
virtual bool isCodeSection() const
Word elementCount() const
virtual SectionType type() const =0
Returns SectioType of actual section instance.
HalfWord SectionId
Type for storing binary file section ids.
Word FileOffset
Type for storing absolute file offsets.