OpenASIP  2.0
AOutSymbolSectionReader.cc
Go to the documentation of this file.
1 /*
2  Copyright (c) 2002-2009 Tampere University.
3 
4  This file is part of TTA-Based Codesign Environment (TCE).
5 
6  Permission is hereby granted, free of charge, to any person obtaining a
7  copy of this software and associated documentation files (the "Software"),
8  to deal in the Software without restriction, including without limitation
9  the rights to use, copy, modify, merge, publish, distribute, sublicense,
10  and/or sell copies of the Software, and to permit persons to whom the
11  Software is furnished to do so, subject to the following conditions:
12 
13  The above copyright notice and this permission notice shall be included in
14  all copies or substantial portions of the Software.
15 
16  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22  DEALINGS IN THE SOFTWARE.
23  */
24 /**
25  * @file AOutSymbolSectionReader.cc
26  *
27  * Definition of class AOutSymbolSectionReader.
28  *
29  * @author Jussi Nykänen 2003 (nykanen-no.spam-cs.tut.fi)
30  * @author Mikael Lepistö 18.12.2003 (tmlepist-no.spam-cs.tut.fi)
31  * @note reviewed 23 October 2003 by pj, am, ll, jn
32  *
33  * @note rating: yellow
34  */
35 
37 #include "AOutReader.hh"
38 #include "ReferenceKey.hh"
39 #include "SafePointer.hh"
40 #include "SectionReader.hh"
41 #include "NoTypeSymElement.hh"
42 #include "DataSymElement.hh"
43 #include "CodeSymElement.hh"
44 #include "ProcedSymElement.hh"
45 #include "SectionSymElement.hh"
46 #include "FileSymElement.hh"
47 #include "ResourceSection.hh"
48 #include "ResourceElement.hh"
49 #include "StringSection.hh"
50 #include "DebugStabElem.hh"
51 #include "CodeSection.hh"
52 #include "InstructionElement.hh"
53 #include "MoveElement.hh"
54 #include "NullSection.hh"
55 #include "DebugSection.hh"
56 #include "CodeSection.hh"
57 
58 namespace TPEF {
59 
60 using ReferenceManager::SectionKey;
61 using ReferenceManager::SectionOffsetKey;
62 using ReferenceManager::SectionIndexKey;
63 using ReferenceManager::SafePointer;
64 
65 AOutSymbolSectionReader AOutSymbolSectionReader::proto_;
67 
68 const std::string
70 
71 const std::string
73 
74 /**
75  * Constructor.
76  *
77  * Registers itself to SectionReader.
78  */
81 }
82 
83 /**
84  * Destructor.
85  */
87 }
88 
89 /**
90  * Returns the type of section that this reader reads.
91  *
92  * @return The type of section this reader can read.
93  */
96  return Section::ST_SYMTAB;
97 }
98 
99 /**
100  * Reads a.out symbol section out of stream and stores it in section.
101  *
102  * @param stream The stream to be read from.
103  * @param section The section in which data is stored.
104  * @exception UnreachableStream If reading of section fails.
105  * @exception KeyAlreadyExists Key was in use when trying to register object.
106  * @exception EndOfFile If end of file were reached while it shouldn't.
107  * @exception OutOfRange Some of read values were out of range.
108  * @exception WrongSubclass Some class couldn't do what it was asked for.
109  * @exception UnexpectedValue If there was unexpected value when reading.
110  */
111 void
113  BinaryStream& stream, Section* section) const {
114  StringSection* stringSection =
115  dynamic_cast<AOutReader*>(parent())->stringSection();
116 
117  FileOffset offset = stream.readPosition();
118  AOutReader* reader = dynamic_cast<AOutReader*>(parent());
119  assert(reader != NULL);
120 
121  // create undef symbol to start of section (needed by TPEF)
122  SymbolElement *undefSymbol = new NoTypeSymElement();
123 
124  SectionOffsetKey nullStringKey =
126 
127  undefSymbol->setName(CREATE_SAFEPOINTER(nullStringKey));
128  undefSymbol->setSection(reader->nullSection());
129 
130  SectionIndexKey undefSymbolKey =
132  SafePointer::addObjectReference(undefSymbolKey, undefSymbol);
133 
134  section->addElement(undefSymbol);
135 
136  // in this point there is no recources added yet
137  resolvedResources_.clear();
138  addedResources_.clear();
139 
140  // symbols start in a.out with index 0
141  int symIndex = 0;
142  while (stream.readPosition() <
143  offset + reader->header().sectionSizeSymbol()) {
144 
145  SectionOffset sectionOffset = stream.readPosition() - offset;
146 
147  SymbolElement* elem =
148  initializeSymbol(stream, sectionOffset, reader);
149 
150  if (elem != NULL) {
151  SectionIndexKey symIndexKey =
152  SectionIndexKey(AOutReader::ST_SYMBOL, symIndex + 1);
153  SafePointer::addObjectReference(symIndexKey, elem);
154 
155  section->addElement(elem);
156 
157  }
158 
159  // always remember to increment index counter, even if symbol is not
160  // created
161  symIndex++;
162  }
163 
164 
165  // ----------------------------------------------------------------------
166  // write resource table out of N_PRTAB stabs collected from symbol table
167  // ----------------------------------------------------------------------
168 
169  ResourceSection* resourceTable =
170  dynamic_cast<AOutReader*>(parent())->resourceTable();
171 
172  ResourceElement *resource = NULL;
173 
174  while (!resolvedResources_.empty()) {
175  Word value = (*(resolvedResources_.begin())).second;
176  Chunk* name =
177  stringSection->string2Chunk(
178  (*(resolvedResources_.begin())).first);
179 
180  // if operation register, make entry to resource table
181  if (value > AOutReader::FIRST_FU_REGISTER) {
182 
183  resource = new ResourceElement();
184  resource->setId(value);
185  resource->setType(ResourceElement::MRT_OP);
186 
187  resource->setName(
188  CREATE_SAFEPOINTER(
190 
191  resourceTable->addElement(resource);
192 
193  // the very first of FU registers in a.out is
194  // "return-address" special register
195  } else if (value == AOutReader::FIRST_FU_REGISTER) {
196 
197  resource = new ResourceElement();
198  resource->setId(value);
199  resource->setType(ResourceElement::MRT_SR);
200 
201  resource->setName(
202  CREATE_SAFEPOINTER(
204 
205  resourceTable->addElement(resource);
206  }
207 
208  resolvedResources_.erase(resolvedResources_.begin());
209  }
210 
211  // add int register file
212  resource = new ResourceElement();
213  resource->setId(ResourceElement::INT_RF);
214  resource->setType(ResourceElement::MRT_RF);
215  resource->setName(CREATE_SAFEPOINTER(nullStringKey));
216  resourceTable->addElement(resource);
217 
218  // add fp registerfile
219  resource = new ResourceElement();
220  resource->setId(ResourceElement::FP_RF);
221  resource->setType(ResourceElement::MRT_RF);
222  resource->setName(CREATE_SAFEPOINTER(nullStringKey));
223  resourceTable->addElement(resource);
224 
225  // add bool register file
226  resource = new ResourceElement();
227  resource->setType(ResourceElement::MRT_RF);
228  resource->setId(ResourceElement::BOOL_RF);
229  resource->setName(CREATE_SAFEPOINTER(nullStringKey));
230  resourceTable->addElement(resource);
231 
232  // add unit
233  resource = new ResourceElement();
236  resource->setName(CREATE_SAFEPOINTER(nullStringKey));
237  resourceTable->addElement(resource);
238 
239  // add bus
240  resource = new ResourceElement();
243  resource->setName(CREATE_SAFEPOINTER(nullStringKey));
244  resourceTable->addElement(resource);
245 }
246 
247 /**
248  * Creates and initilizes one symbol element.
249  *
250  * Now only non-stabb symbols are read.
251  *
252  * @param stream The stream to be read from.
253  * @param sectionOffset The offset of the element in section.
254  * @param reader The base reader for a.out.
255  * @return Newly created symbol.
256  * @exception KeyAlreadyExists If key used to register object is in use.
257  * @exception UnreachableStream If there occurs problems with stream.
258  * @exception OutOfRange If offset read is out of the section.
259  */
262  BinaryStream& stream, SectionOffset sectionOffset,
263  AOutReader* reader) const {
264  StringSection* stringSection =
265  dynamic_cast<AOutReader*>(parent())->stringSection();
266 
267  SymbolElement *element = NULL;
268 
269  // first there is an offset to string in string table
270  Word strtabOff = stream.readWord();
271 
272  // type of symbol
273  Byte type = stream.readByte();
274 
275  // not used
276  Byte other = stream.readByte();
277 
278  // description of the symbol, reserved for debugger use
279  // not needed in tpef (there is debug section for that)
280  HalfWord desc = stream.readHalfWord();
281 
282  // offset of the value of the symbol
283  Word value = stream.readWord();
284 
285  // key to string of symbol
286  SectionOffsetKey strOffKey =
288 
289 
290  // create element of right type
291  switch (type&(~AOutReader::N_EXT)) {
292 
293  case AOutReader::N_UNDF: {
294  element = new NoTypeSymElement();
295  element->setSection(reader->nullSection());
296  break;
297  }
298 
299  case AOutReader::N_TEXT: {
300  // create code symbols only if there really is code section
301  if (reader->header().sectionSizeText() != 0) {
302 
303  // if new compilation module start symbol, start new module for
304  // resource id resolving...
305  std::string symbolName =
306  stringSection->chunk2String(stringSection->chunk(strtabOff));
307 
308  if (GCC_MODULE_START_SYMBOL1 == symbolName) {
309  Word tpefAddress = value/8;
310  addedResources_.push_back(CompilationModule(tpefAddress));
311  }
312 
313  element = new CodeSymElement();
314 
315  // convert a.out address to suitable for section offset key..
316  value = reader->sectionOffsetOfAddress(value);
317 
318  SectionOffsetKey valueKey(AOutReader::ST_TEXT, value);
319  CodeSymElement *elem = dynamic_cast<CodeSymElement*>(element);
320  elem->setReference(CREATE_SAFEPOINTER(valueKey));
321 
323  element->setSection(CREATE_SAFEPOINTER(sKey));
324 
325  } else { // otherwise create no type symbol
326  element = new NoTypeSymElement();
327  element->setSection(reader->nullSection());
328  }
329 
330  break;
331  }
332 
333  case AOutReader::N_DATA:
334  case AOutReader::N_BSS: {
335  element = new DataSymElement();
336 
337  value = reader->sectionOffsetOfAddress(value);
338 
339  SectionOffsetKey valueKey(type&(~AOutReader::N_EXT), value);
340  DataSymElement *elem = dynamic_cast<DataSymElement*>(element);
341  elem->setReference(CREATE_SAFEPOINTER(valueKey));
342 
343 
344  elem->setSize(DATA_SYMBOL_SIZE);
345 
347  element->setSection(CREATE_SAFEPOINTER(sKey));
348  break;
349  }
350 
351  case AOutReader::N_FN: {
352  element = new FileSymElement();
353  element->setSection(reader->nullSection());
354  break;
355  }
356 
357  case AOutReader::N_PRTAB: {
358  std::string symbolName =
359  stringSection->chunk2String(stringSection->chunk(strtabOff));
360 
361  if (!MapTools::containsKey(resolvedResources_, symbolName)) {
362  resolvedResources_[symbolName] = value;
363  } else {
364  // if symbol with same name has different value
365  // add replacement entry
366  Word resolvedValue = resolvedResources_[symbolName];
367  if (value != resolvedValue) {
368  addedResources_[addedResources_.size()-1].resources_[value] =
369  resolvedValue;
370  }
371  }
372 
373  return NULL;
374  }
375 
376  case AOutReader::N_ANN: {
377 
378  std::string symbolName =
379  stringSection->chunk2String(stringSection->chunk(strtabOff));
380 
381  // value - address of instruction, symbolName - all the data
382  Word numberOfInstruction = value / 8;
383  annotationes_.push_back(std::pair<Word, std::string>(numberOfInstruction, symbolName));
384  return NULL;
385  }
386 
387  // rest of symbols are stored as stabs
388  default: {
389  DebugStabElem* stab =
390  new DebugStabElem(type, other, desc, value);
391 
392  stab->setDebugString(CREATE_SAFEPOINTER(strOffKey));
393 
394  reader->debugSection()->addElement(stab);
395 
396  return NULL;
397  } break;
398 
399  }
400 
401  // inform ReferenceManager about new symbol
402  SectionOffsetKey offKey =
403  SectionOffsetKey(AOutReader::ST_SYMBOL, sectionOffset);
404  SafePointer::addObjectReference(offKey, element);
405 
406  // figure out symbol linkage scope (local/global)
407  if (static_cast<Byte>(type) & static_cast<Byte>(AOutReader::N_EXT)) {
409  } else {
411  }
412 
413  // symbol name string
414  element->setName(CREATE_SAFEPOINTER(strOffKey));
415 
416  return element;
417 }
418 
419 /**
420  * Finalizer method for AOut symbol sections.
421  *
422  * Removes reserved gcc code symbols and converts compilation unit code label
423  * to file symbol.
424  *
425  * Fixes resource references of special operations to use same id in all
426  * compilation units.
427  *
428  * Adds annotationes to needed moves.
429  *
430  * @param section Section to finalize.
431  */
432 void
434 
435  StringSection *strTab = dynamic_cast<StringSection*>(section->link());
436 
437  NullSection* nullSection =
438  dynamic_cast<AOutReader*>(parent())->nullSection();
439 
440  assert(nullSection);
441 
442  // make file symbols to tpef
443  for (Word i = 0; i < section->elementCount(); i++) {
444 
445  SymbolElement *sym =
446  dynamic_cast<SymbolElement*>(section->element(i));
447 
448  if (sym->type() == SymbolElement::STT_CODE) {
449 
450  std::string symName = strTab->chunk2String(sym->name());
451 
452  // if read a.out is linked and compilation unit's start
453  // symbol is found (i == 1 and GCC_MODULE_START_SYMBOL1 is
454  // found it means that first read symbol from a.out was
455  // GCC_MODULE_START_SYMBOL1. In linked a.out there is always
456  // symbol for each compilation module before
457  // GCC_MODULE_START_SYMBOL1)
458 
459 
460  if (i > 1 && symName == GCC_MODULE_START_SYMBOL1) {
461 
462  SymbolElement *prevSymbol =
463  dynamic_cast<SymbolElement*>(section->element(i - 1));
464 
465  // previous symbol can be either code symbol or no type,
466  // if there is no instructions in compilation modulex
467  assert(prevSymbol->type() == SymbolElement::STT_CODE ||
468  prevSymbol->type() == SymbolElement::STT_NOTYPE);
469 
470  FileSymElement *newFileSym = new FileSymElement();
471  newFileSym->setName(prevSymbol->name());
472 
473  newFileSym->setSection(nullSection);
474 
475  CodeSymElement *codeSym =
476  dynamic_cast<CodeSymElement*>(prevSymbol);
477 
478  if (codeSym != NULL) {
479  // TODO: set value and section to be same that in code
480  // section newFileSym->setSection(codeSym->section());
481  // newFileSym->setValue();
482  }
483 
484  section->setElement(i - 1, newFileSym);
485 
486  // replace all references to prevSymbol with
487  // newFileSym reference.
488  SafePointer::replaceAllReferences(newFileSym, prevSymbol);
489  delete prevSymbol;
490  prevSymbol = NULL;
491  }
492 
493  if (symName == GCC_MODULE_START_SYMBOL1 ||
494  symName == GCC_MODULE_START_SYMBOL2) {
495 
496  NoTypeSymElement *replacingSymbol = new NoTypeSymElement();
497  replacingSymbol->setName(sym->name());
498  replacingSymbol->setSection(nullSection);
499 
500  section->setElement(i, replacingSymbol);
501 
502  // replace all references to sym with replacing symbol
503  // reference
504  SafePointer::replaceAllReferences(replacingSymbol, sym);
505  delete sym;
506  sym = NULL;
507 
508  } else {
509  // create corresponding STT_PROCEDURE symbol for each code
510  // symbol
511  ProcedSymElement *newSym = new ProcedSymElement();
512  CodeSymElement *codeSym = dynamic_cast<CodeSymElement*>(sym);
513  assert(codeSym != NULL);
514 
515  newSym->setAbsolute(codeSym->absolute());
517  newSym->setName(codeSym->name());
518  newSym->setSection(codeSym->section());
519  newSym->setReference(codeSym->reference());
520  newSym->setSize(codeSym->size());
521 
522  section->addElement(newSym);
523  }
524  }
525  }
526 
527  // fix operand references from code section with information gathered from
528  // symbol table.
529 
530  CodeSection* textSection =
531  dynamic_cast<AOutReader*>(parent())->textSection();
532 
533  for (unsigned int i = 0; i < addedResources_.size(); i++) {
534  CompilationModule& module = addedResources_[i];
535 
536  // resolve address slice to convert...
537  Word lastAddress = textSection->instructionCount();
538 
539  if (i < addedResources_.size() - 1) {
540  lastAddress = addedResources_[i+1].startAddress_;
541  }
542 
543  // fix the stuff...
544  for (unsigned int j = module.startAddress_; j < lastAddress; j++) {
545 
546  // get move to check
547  InstructionElement* instr = &textSection->instruction(j);
548 
549  MoveElement* move = NULL;
550 
551  // check only move's
552  if (instr->isImmediate()) {
553  Word sectionIndex = textSection->instructionToSectionIndex(j);
554  instr = dynamic_cast<InstructionElement*>(
555  textSection->element(sectionIndex + 1));
556  }
557 
558  move = dynamic_cast<MoveElement*>(instr);
559 
560  // if source is universal FU port, replace if updating is needed
561  if (move->sourceType() == MoveElement::MF_UNIT &&
564  module.resources_, move->sourceIndex())) {
565 
566  move->setSourceIndex(module.resources_[move->sourceIndex()]);
567  }
568 
569  // if destination is universal FU port,
570  // replace if updating is needed
571  if (move->destinationType() == MoveElement::MF_UNIT &&
574  module.resources_, move->destinationIndex())) {
575 
576  move->setDestinationIndex(
577  module.resources_[move->destinationIndex()]);
578  }
579  }
580 
581  }
582 
583  // Add annotations to instruction elements
584  for (Word i = 0; i < annotationes_.size(); i++) {
585 
586  InstructionElement* instr = dynamic_cast<InstructionElement*>(
587  textSection->element(annotationes_[i].first));
588 
589  std::string annString = annotationes_[i].second;
590 
591  // first 10 letters are annotation ID
592  if (annString.at(10) != ':') {
593  throw IllegalProgram(
594  __FILE__, __LINE__, __func__,
595  "11 first characters of annotation stab must contain "
596  "annotation ID ending with ':' e.g. '0x00011000:'");
597  }
598 
599  Word annId = Conversion::toInt(annString.substr(0,10));
600 
601  std::string payString = annString.substr(11,annString.length() - 10);
602  std::vector<Byte> payload;
603 
604  for (unsigned int j = 0; j < payString.length(); j++) {
605  payload.push_back(payString.at(j));
606  }
607 
608  instr->addAnnotation(new InstructionAnnotation(annId, payload));
609  }
610 }
611 
612 } // namespace TPEF
TPEF::CodeSection::element
virtual InstructionElement * element(Word index) const
Definition: CodeSection.cc:88
TPEF::ResourceElement::MRT_OP
@ MRT_OP
Operation operand or function unit register.
Definition: ResourceElement.hh:56
TPEF::ResourceElement::MRT_BUS
@ MRT_BUS
Transport bus.
Definition: ResourceElement.hh:53
TPEF::AOutSymbolSectionReader::DATA_SYMBOL_SIZE
static const Word DATA_SYMBOL_SIZE
Data symbol size in bytes.
Definition: AOutSymbolSectionReader.hh:103
TPEF::AOutSymbolSectionReader::initializeSymbol
SymbolElement * initializeSymbol(BinaryStream &stream, SectionOffset sectionOffset, AOutReader *reader) const
Definition: AOutSymbolSectionReader.cc:261
TPEF::DataSymElement::setReference
void setReference(Chunk *aReference)
Definition: DataSymElement.cc:81
TPEF::ResourceSection
Definition: ResourceSection.hh:47
TPEF::BinaryStream::readPosition
unsigned int readPosition()
Definition: BinaryStream.cc:561
TPEF::Section::ST_SYMTAB
@ ST_SYMTAB
Symbol table.
Definition: Section.hh:72
TPEF::InstructionElement::addAnnotation
void addAnnotation(InstructionAnnotation *anAnnotation)
TPEF::AOutReader::N_EXT
@ N_EXT
Mask bit for external.
Definition: AOutReader.hh:69
CodeSymElement.hh
TPEF::AOutReader::N_PRTAB
@ N_PRTAB
TCE processors resource entry.
Definition: AOutReader.hh:102
TPEF::AOutReader::nullSection
NullSection * nullSection() const
TPEF::ResourceElement::BOOL_RF
@ BOOL_RF
Universal boolean register file.
Definition: ResourceElement.hh:68
TPEF::InstructionElement
Definition: InstructionElement.hh:77
NullSection.hh
DebugSection.hh
TPEF::MoveElement::MF_UNIT
@ MF_UNIT
Function unit.
Definition: MoveElement.hh:56
TPEF::Section::setElement
virtual void setElement(Word index, SectionElement *element)
Definition: Section.cc:145
TPEF::BinaryStream
Definition: BinaryStream.hh:59
TPEF::ResourceElement::MRT_SR
@ MRT_SR
Special register.
Definition: ResourceElement.hh:58
TPEF::ResourceElement
Definition: ResourceElement.hh:47
DataSymElement.hh
SafePointer.hh
TPEF::FileSymElement
Definition: FileSymElement.hh:44
TPEF::AOutSymbolSectionReader::GCC_MODULE_START_SYMBOL2
static const std::string GCC_MODULE_START_SYMBOL2
One of the symbols that are used to indicate start of new compilation module in a....
Definition: AOutSymbolSectionReader.hh:111
TPEF::AOutSymbolSectionReader::resolvedResources_
std::map< std::string, Word > resolvedResources_
Resource id:s for strings.
Definition: AOutSymbolSectionReader.hh:140
TPEF::StringSection::chunk2String
std::string chunk2String(const Chunk *chunk) const
Definition: StringSection.cc:72
TPEF::AOutSymbolSectionReader::readData
virtual void readData(BinaryStream &stream, Section *section) const
Definition: AOutSymbolSectionReader.cc:112
TPEF::InstructionElement::isImmediate
bool isImmediate() const
InstructionElement.hh
TPEF::MoveElement::sourceIndex
HalfWord sourceIndex() const
FileSymElement.hh
StringSection.hh
Byte
unsigned char Byte
Definition: BaseType.hh:116
ResourceSection.hh
TPEF::ReferenceManager::SectionIndexKey
Definition: ReferenceKey.hh:65
TPEF::SymbolElement::setBinding
void setBinding(SymbolBinding aBinding)
TPEF::ReferenceManager::SafePointer::addObjectReference
static void addObjectReference(SectionIndexKey key, const SafePointable *obj)
Definition: SafePointer.cc:306
TPEF::DebugStabElem
Definition: DebugStabElem.hh:48
TPEF::ResourceElement::setType
void setType(ResourceType aType)
TPEF::Section
Definition: Section.hh:64
TPEF::CodeSymElement::setReference
void setReference(InstructionElement *aReference)
Definition: CodeSymElement.cc:81
TPEF::StringSection
Definition: StringSection.hh:48
TPEF::SymbolElement::section
Section * section() const
TPEF::SymbolElement::name
Chunk * name() const
AOutSymbolSectionReader.hh
TPEF::Section::link
Section * link() const
TPEF::Section::element
SectionElement * element(Word index) const
assert
#define assert(condition)
Definition: Application.hh:86
TPEF::AOutReader::debugSection
DebugSection * debugSection() const
TPEF::Section::addElement
virtual void addElement(SectionElement *element)
Definition: Section.cc:133
TPEF::AOutSymbolSectionReader::AOutSymbolSectionReader
AOutSymbolSectionReader()
Definition: AOutSymbolSectionReader.cc:79
SectionSymElement.hh
TPEF::NullSection
Definition: NullSection.hh:46
TPEF::SymbolElement::type
virtual SymbolType type() const =0
Returns type of symbol.
TPEF::AOutReader::Header::sectionSizeSymbol
Word sectionSizeSymbol() const
TPEF::CodeSymElement::setSize
void setSize(Word aSize)
Definition: CodeSymElement.cc:112
TPEF::AOutReader::N_ANN
@ N_ANN
TCE annotation entry.
Definition: AOutReader.hh:103
TPEF::MoveElement::sourceUnit
HalfWord sourceUnit() const
TPEF::AOutSymbolSectionReader::proto_
static AOutSymbolSectionReader proto_
Class-wide (unique) prototype instance of AOutSymbolSectionReader registered into SectionReader.
Definition: AOutSymbolSectionReader.hh:115
TPEF::AOutReader::N_TEXT
@ N_TEXT
Text.
Definition: AOutReader.hh:64
TPEF::AOutReader::N_DATA
@ N_DATA
Data.
Definition: AOutReader.hh:65
TPEF::AOutReader
Definition: AOutReader.hh:54
TPEF::AOutSectionReader::parent
virtual BinaryReader * parent() const
Definition: AOutSectionReader.cc:57
ResourceElement.hh
TPEF::AOutSymbolSectionReader::CompilationModule::resources_
std::map< Word, SectionOffset > resources_
Resources id replacements for the compilation module.
Definition: AOutSymbolSectionReader.hh:136
TPEF::SymbolElement::STB_GLOBAL
@ STB_GLOBAL
Visible to all files that are combined in TPEF file.
Definition: SymbolElement.hh:58
TPEF::AOutSymbolSectionReader::annotationes_
std::vector< std::pair< Word, std::string > > annotationes_
Definition: AOutSymbolSectionReader.hh:145
TPEF::MoveElement
Definition: MoveElement.hh:47
SectionReader.hh
TPEF::StringSection::string2Chunk
Chunk * string2Chunk(const std::string &str)
Definition: StringSection.cc:103
IllegalProgram
Definition: Exception.hh:895
TPEF::SymbolElement::setSection
void setSection(Section *aSect)
TPEF::AOutSymbolSectionReader::finalize
virtual void finalize(Section *section) const
Definition: AOutSymbolSectionReader.cc:433
__func__
#define __func__
Definition: Application.hh:67
TPEF::FileOffset
Word FileOffset
Type for storing absolute file offsets.
Definition: TPEFBaseType.hh:52
TPEF::CodeSection::instruction
InstructionElement & instruction(Word index) const
Definition: CodeSection.cc:165
TPEF::AOutSymbolSectionReader::addedResources_
std::vector< CompilationModule > addedResources_
List of compilation modules of a.out.
Definition: AOutSymbolSectionReader.hh:143
TPEF::MoveElement::destinationIndex
HalfWord destinationIndex() const
TPEF::SectionReader::registerSectionReader
static void registerSectionReader(const SectionReader *sReader)
Definition: SectionReader.cc:145
TPEF::AOutSymbolSectionReader::CompilationModule
Definition: AOutSymbolSectionReader.hh:127
TPEF::SymbolElement
Definition: SymbolElement.hh:52
TPEF::SymbolElement::absolute
bool absolute() const
TPEF::MoveElement::setDestinationIndex
void setDestinationIndex(HalfWord aDestinationIndex)
TPEF::BinaryStream::readHalfWord
HalfWord readHalfWord()
Definition: BinaryStream.cc:150
TPEF::SymbolElement::setName
void setName(Chunk *aName)
TPEF::DataSymElement
Definition: DataSymElement.hh:41
TPEF::BinaryStream::readByte
Byte readByte()
Definition: BinaryStream.cc:120
TPEF::AOutReader::ST_TEXT
@ ST_TEXT
Text section.
Definition: AOutReader.hh:116
TPEF::MoveElement::destinationType
FieldType destinationType() const
TPEF::CodeSection
Definition: CodeSection.hh:44
TPEF::ResourceElement::MRT_RF
@ MRT_RF
Register file.
Definition: ResourceElement.hh:55
TPEF::CodeSymElement::reference
InstructionElement * reference() const
Definition: CodeSymElement.cc:71
TPEF::SymbolElement::STT_CODE
@ STT_CODE
Associated with executable code.
Definition: SymbolElement.hh:69
TPEF::AOutReader::N_FN
@ N_FN
File name.
Definition: AOutReader.hh:68
TPEF::MoveElement::destinationUnit
HalfWord destinationUnit() const
TPEF::AOutReader::N_BSS
@ N_BSS
BSS.
Definition: AOutReader.hh:66
TPEF::SectionOffset
Word SectionOffset
Type for storing offsets relative to a given base offset value.
Definition: TPEFBaseType.hh:49
TPEF::ReferenceManager::SectionKey
Definition: ReferenceKey.hh:145
TPEF::NoTypeSymElement
Definition: NoTypeSymElement.hh:44
TPEF::DataSymElement::setSize
void setSize(Word aSize)
Definition: DataSymElement.cc:112
TPEF::AOutReader::header
static const Header & header()
MapTools::containsKey
static bool containsKey(const MapType &aMap, const KeyType &aKey)
TPEF::ProcedSymElement
Definition: ProcedSymElement.hh:45
TPEF::Chunk::offset
SectionOffset offset() const
AOutReader.hh
TPEF::CodeSection::instructionCount
Word instructionCount() const
Definition: CodeSection.cc:148
TPEF::AOutSymbolSectionReader::GCC_MODULE_START_SYMBOL1
static const std::string GCC_MODULE_START_SYMBOL1
One of the symbols that are used to indicate start of new compilation module in a....
Definition: AOutSymbolSectionReader.hh:107
TPEF::AOutReader::FIRST_FU_REGISTER
static const Word FIRST_FU_REGISTER
Index of the first function unit register.
Definition: AOutReader.hh:137
TPEF::AOutReader::sectionOffsetOfAddress
SectionOffset sectionOffsetOfAddress(AddressImage address) const
TPEF::AOutSymbolSectionReader::~AOutSymbolSectionReader
virtual ~AOutSymbolSectionReader()
Definition: AOutSymbolSectionReader.cc:86
TPEF::AOutSectionReader
Definition: AOutSectionReader.hh:45
TPEF::AOutSymbolSectionReader::CompilationModule::startAddress_
Word startAddress_
Start address of linked compilation module in a.out.
Definition: AOutSymbolSectionReader.hh:133
TPEF::InstructionAnnotation
Definition: InstructionElement.hh:49
TPEF::MoveElement::setSourceIndex
void setSourceIndex(HalfWord aSourceIndex)
TPEF::CodeSection::instructionToSectionIndex
Word instructionToSectionIndex(Word index) const
Definition: CodeSection.cc:183
TPEF::SymbolElement::setAbsolute
void setAbsolute(bool anAbsoluteness)
TPEF::AOutReader::ST_SYMBOL
@ ST_SYMBOL
Symbol table.
Definition: AOutReader.hh:119
TPEF::ResourceElement::MRT_UNIT
@ MRT_UNIT
Function unit.
Definition: ResourceElement.hh:54
TPEF::ReferenceManager::SectionOffsetKey
Definition: ReferenceKey.hh:93
TPEF::Section::SectionType
SectionType
Definition: Section.hh:69
TPEF::CodeSymElement
Definition: CodeSymElement.hh:46
ProcedSymElement.hh
TPEF::CodeSymElement::size
Word size() const
Definition: CodeSymElement.cc:102
TPEF::SymbolElement::STT_NOTYPE
@ STT_NOTYPE
Type is not defined.
Definition: SymbolElement.hh:67
TPEF::ResourceElement::setId
void setId(HalfWord aId)
TPEF::MoveElement::sourceType
FieldType sourceType() const
Conversion::toInt
static int toInt(const T &source)
TPEF::ResourceElement::UNIVERSAL_BUS
@ UNIVERSAL_BUS
Universal bus.
Definition: ResourceElement.hh:64
TPEF::ResourceElement::FP_RF
@ FP_RF
Universal floating point register file.
Definition: ResourceElement.hh:69
TPEF::ResourceElement::INT_RF
@ INT_RF
Universal integer register file.
Definition: ResourceElement.hh:67
TPEF::ReferenceManager::SafePointer::replaceAllReferences
static void replaceAllReferences(SafePointable *newObj, SafePointable *oldObj)
TPEF::RawSection::chunk
virtual Chunk * chunk(SectionOffset offset) const
Definition: Section.cc:212
ReferenceKey.hh
TPEF::AOutReader::N_UNDF
@ N_UNDF
Undefined.
Definition: AOutReader.hh:62
TPEF::BinaryStream::readWord
Word readWord()
Definition: BinaryStream.cc:187
NoTypeSymElement.hh
MoveElement.hh
TPEF::AOutReader::Header::sectionSizeText
Word sectionSizeText() const
TPEF::ResourceElement::setName
void setName(ReferenceManager::SafePointer *aName)
TPEF::Chunk
Definition: Chunk.hh:45
CodeSection.hh
TPEF::SymbolElement::STB_LOCAL
@ STB_LOCAL
Not visible outside the object file that contains it's definition.
Definition: SymbolElement.hh:56
TPEF::AOutSymbolSectionReader::type
virtual Section::SectionType type() const
Definition: AOutSymbolSectionReader.cc:95
TPEF::Section::elementCount
Word elementCount() const
DebugStabElem.hh
TPEF
Definition: Assembler.hh:43
TPEF::DebugElement::setDebugString
void setDebugString(const ReferenceManager::SafePointer *aString)
Definition: DebugElement.cc:68
TPEF::ResourceElement::UNIVERSAL_FU
@ UNIVERSAL_FU
Universal function unit.
Definition: ResourceElement.hh:65
TPEF::AOutReader::ST_STRING
@ ST_STRING
String table.
Definition: AOutReader.hh:120