OpenASIP  2.0
SymbolElement.hh
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 SymbolElement.hh
26  *
27  * Declaration of SymbolElement class.
28  *
29  * @author Jussi Nykänen 2003 (nykanen-no.spam-cs.tut.fi)
30  * @author Mikael Lepistö 2003 (tmlepist-no.spam-cs.tut.fi)
31  * @note reviewed 22 October 2003 by ml, jn, ao, tr
32  *
33  * @note rating: yellow
34  */
35 
36 #ifndef TTA_SYMBOL_ELEMENT_HH
37 #define TTA_SYMBOL_ELEMENT_HH
38 
39 #include "TPEFBaseType.hh"
40 #include "SafePointable.hh"
41 #include "SectionElement.hh"
42 #include "SafePointer.hh"
43 #include "Exception.hh"
44 #include "Chunk.hh"
45 #include "Section.hh"
46 
47 namespace TPEF {
48 
49 /**
50  * Symbol table entry.
51  */
52 class SymbolElement : public SectionElement {
53 public:
54  /// Binding types of symbol.
56  STB_LOCAL = 0x0, ///< Not visible outside the object file that
57  ///< contains it's definition.
58  STB_GLOBAL = 0x1, ///< Visible to all files that are combined
59  ///< in TPEF file.
60  STB_WEAK = 0x2 ///< Visible to all object files that are combined
61  ///< in the TPEF file, but with linkage priority
62  ///< lower than STB_GLOBAL symbols.
63  };
64 
65  /// Type of symbol element.
66  enum SymbolType {
67  STT_NOTYPE = 0x0, ///< Type is not defined.
68  STT_DATA = 0x1, ///< Associated with data object.
69  STT_CODE = 0x2, ///< Associated with executable code.
70  STT_SECTION = 0x3,///< Associated with section.
71  STT_FILE = 0x4, ///< Name of symbol gives the name of source file
72  ///< associated with this object file.
73  STT_PROCEDURE = 0x5 ///< Symbol gives indicates procedure start
74  ///< position in section
75  };
76 
77  SymbolElement();
78  virtual ~SymbolElement();
79 
80  /// Returns type of symbol.
81  virtual SymbolType type() const = 0;
82 
83  bool absolute() const;
84  void setAbsolute(bool anAbsoluteness);
85 
86  SymbolBinding binding() const;
87  void setBinding(SymbolBinding aBinding);
88 
89  Chunk* name() const;
90  void setName(Chunk* aName);
91  void setName(const ReferenceManager::SafePointer* aName);
92 
93  Section* section() const;
94  void setSection(Section* aSect);
95  void setSection(const ReferenceManager::SafePointer* aSect);
96 
97 private:
98  /// Is symbol absolutely or relocating.
99  bool absolute_;
100  /// Binding of the symbol.
102  /// The name of the symbol.
104  /// Section to which the symbol belongs.
106 };
107 }
108 
109 #include "SymbolElement.icc"
110 
111 #endif
TPEF::SymbolElement::STT_PROCEDURE
@ STT_PROCEDURE
Symbol gives indicates procedure start position in section.
Definition: SymbolElement.hh:73
Exception.hh
TPEF::SymbolElement::~SymbolElement
virtual ~SymbolElement()
Definition: SymbolElement.cc:57
TPEF::SymbolElement::SymbolType
SymbolType
Type of symbol element.
Definition: SymbolElement.hh:66
SafePointer.hh
TPEF::SymbolElement::section_
const ReferenceManager::SafePointer * section_
Section to which the symbol belongs.
Definition: SymbolElement.hh:105
TPEF::SymbolElement::STT_FILE
@ STT_FILE
Name of symbol gives the name of source file associated with this object file.
Definition: SymbolElement.hh:71
TPEF::SymbolElement::binding
SymbolBinding binding() const
TPEF::SymbolElement::STT_SECTION
@ STT_SECTION
Associated with section.
Definition: SymbolElement.hh:70
TPEF::SymbolElement::setBinding
void setBinding(SymbolBinding aBinding)
TPEF::SymbolElement::absolute_
bool absolute_
Is symbol absolutely or relocating.
Definition: SymbolElement.hh:99
TPEF::Section
Definition: Section.hh:64
TPEF::SymbolElement::section
Section * section() const
TPEF::SymbolElement::name
Chunk * name() const
TPEF::SymbolElement::type
virtual SymbolType type() const =0
Returns type of symbol.
TPEF::ReferenceManager::SafePointer
Definition: SafePointer.hh:188
SymbolElement.icc
TPEF::SymbolElement::SymbolElement
SymbolElement()
Definition: SymbolElement.cc:46
TPEF::SymbolElement::STB_GLOBAL
@ STB_GLOBAL
Visible to all files that are combined in TPEF file.
Definition: SymbolElement.hh:58
TPEF::SymbolElement::setSection
void setSection(Section *aSect)
TPEF::SectionElement
Definition: SectionElement.hh:44
TPEF::SymbolElement
Definition: SymbolElement.hh:52
TPEF::SymbolElement::absolute
bool absolute() const
TPEF::SymbolElement::setName
void setName(Chunk *aName)
TPEF::SymbolElement::bind_
SymbolBinding bind_
Binding of the symbol.
Definition: SymbolElement.hh:101
TPEF::SymbolElement::STT_CODE
@ STT_CODE
Associated with executable code.
Definition: SymbolElement.hh:69
SectionElement.hh
TPEF::SymbolElement::SymbolBinding
SymbolBinding
Binding types of symbol.
Definition: SymbolElement.hh:55
TPEF::SymbolElement::STB_WEAK
@ STB_WEAK
Visible to all object files that are combined in the TPEF file, but with linkage priority lower than ...
Definition: SymbolElement.hh:60
Chunk.hh
Section.hh
TPEF::SymbolElement::setAbsolute
void setAbsolute(bool anAbsoluteness)
TPEF::SymbolElement::name_
const ReferenceManager::SafePointer * name_
The name of the symbol.
Definition: SymbolElement.hh:103
TPEF::SymbolElement::STT_DATA
@ STT_DATA
Associated with data object.
Definition: SymbolElement.hh:68
SafePointable.hh
TPEF::SymbolElement::STT_NOTYPE
@ STT_NOTYPE
Type is not defined.
Definition: SymbolElement.hh:67
TPEFBaseType.hh
TPEF::Chunk
Definition: Chunk.hh:45
TPEF::SymbolElement::STB_LOCAL
@ STB_LOCAL
Not visible outside the object file that contains it's definition.
Definition: SymbolElement.hh:56
TPEF
Definition: Assembler.hh:43