[llvm-commits] [PATCH 2/5] Record a symbol's size which is needed for ELF symbol tables.
Matt Fleming
matt at console-pimps.org
Mon Jul 26 13:00:20 PDT 2010
---
include/llvm/MC/MCAssembler.h | 22 ++++++++++++++++++++++
lib/MC/MCAssembler.cpp | 3 ++-
2 files changed, 24 insertions(+), 1 deletions(-)
diff --git a/include/llvm/MC/MCAssembler.h b/include/llvm/MC/MCAssembler.h
index 51f265d..c189a1d 100644
--- a/include/llvm/MC/MCAssembler.h
+++ b/include/llvm/MC/MCAssembler.h
@@ -24,6 +24,7 @@ namespace llvm {
class raw_ostream;
class MCAsmLayout;
class MCAssembler;
+class MCBinaryExpr;
class MCContext;
class MCCodeEmitter;
class MCExpr;
@@ -460,6 +461,10 @@ public:
// common symbol can never get a definition.
uint64_t CommonSize;
+ uint64_t SymbolSize;
+
+ const MCBinaryExpr *SizeSymbol;
+
/// CommonAlign - The alignment of the symbol, if it is 'common'.
//
// FIXME: Pack this in with other fields?
@@ -517,6 +522,23 @@ public:
return CommonSize;
}
+ void setSize(uint64_t _SymbolSize) {
+ SymbolSize = _SymbolSize;
+ }
+
+ uint64_t getSize() {
+ return SymbolSize;
+ }
+
+ void setSizeSymbol(const MCBinaryExpr *SS) {
+ SizeSymbol = SS;
+ }
+
+ const MCBinaryExpr *getSizeSymbol() {
+ return SizeSymbol;
+ }
+
+
/// getCommonAlignment - Return the alignment of a 'common' symbol.
unsigned getCommonAlignment() const {
assert(isCommon() && "Not a 'common' symbol!");
diff --git a/lib/MC/MCAssembler.cpp b/lib/MC/MCAssembler.cpp
index a284c2e..fe55e51 100644
--- a/lib/MC/MCAssembler.cpp
+++ b/lib/MC/MCAssembler.cpp
@@ -208,7 +208,8 @@ MCSymbolData::MCSymbolData(const MCSymbol &_Symbol, MCFragment *_Fragment,
uint64_t _Offset, MCAssembler *A)
: Symbol(&_Symbol), Fragment(_Fragment), Offset(_Offset),
IsExternal(false), IsPrivateExtern(false),
- CommonSize(0), CommonAlign(0), Flags(0), Index(0)
+ CommonSize(0), SymbolSize(0), SizeSymbol(0), CommonAlign(0),
+ Flags(0), Index(0)
{
if (A)
A->getSymbolList().push_back(this);
--
1.6.4.rc0
More information about the llvm-commits
mailing list