mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2024-11-25 23:00:15 +00:00
Move SymbolSize from MCSymbolData to MCSymbol.
llvm-svn: 238580
This commit is contained in:
parent
c5a7177772
commit
7c23cba65c
@ -43,10 +43,6 @@ class MCSymbolData {
|
|||||||
uint64_t CommonSize;
|
uint64_t CommonSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// SymbolSize - An expression describing how to calculate the size of
|
|
||||||
/// a symbol. If a symbol has no size this field will be NULL.
|
|
||||||
const MCExpr *SymbolSize = nullptr;
|
|
||||||
|
|
||||||
/// CommonAlign - The alignment of the symbol, if it is 'common', or -1.
|
/// CommonAlign - The alignment of the symbol, if it is 'common', or -1.
|
||||||
//
|
//
|
||||||
// FIXME: Pack this in with other fields?
|
// FIXME: Pack this in with other fields?
|
||||||
@ -104,10 +100,6 @@ public:
|
|||||||
return CommonSize;
|
return CommonSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setSize(const MCExpr *SS) { SymbolSize = SS; }
|
|
||||||
|
|
||||||
const MCExpr *getSize() const { return SymbolSize; }
|
|
||||||
|
|
||||||
/// getCommonAlignment - Return the alignment of a 'common' symbol.
|
/// getCommonAlignment - Return the alignment of a 'common' symbol.
|
||||||
unsigned getCommonAlignment() const {
|
unsigned getCommonAlignment() const {
|
||||||
assert(isCommon() && "Not a 'common' symbol!");
|
assert(isCommon() && "Not a 'common' symbol!");
|
||||||
@ -171,6 +163,10 @@ class MCSymbol {
|
|||||||
/// Index field, for use by the object file implementation.
|
/// Index field, for use by the object file implementation.
|
||||||
mutable uint64_t Index : 60;
|
mutable uint64_t Index : 60;
|
||||||
|
|
||||||
|
/// An expression describing how to calculate the size of a symbol. If a
|
||||||
|
/// symbol has no size this field will be NULL.
|
||||||
|
const MCExpr *SymbolSize = nullptr;
|
||||||
|
|
||||||
mutable MCSymbolData Data;
|
mutable MCSymbolData Data;
|
||||||
|
|
||||||
private: // MCContext creates and uniques these.
|
private: // MCContext creates and uniques these.
|
||||||
@ -295,6 +291,10 @@ public:
|
|||||||
Index = Value;
|
Index = Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setSize(const MCExpr *SS) { SymbolSize = SS; }
|
||||||
|
|
||||||
|
const MCExpr *getSize() const { return SymbolSize; }
|
||||||
|
|
||||||
/// print - Print the value to the stream \p OS.
|
/// print - Print the value to the stream \p OS.
|
||||||
void print(raw_ostream &OS) const;
|
void print(raw_ostream &OS) const;
|
||||||
|
|
||||||
|
@ -480,9 +480,9 @@ void ELFObjectWriter::writeSymbol(SymbolTableWriter &Writer,
|
|||||||
uint64_t Value = SymbolValue(*MSD.Symbol, Layout);
|
uint64_t Value = SymbolValue(*MSD.Symbol, Layout);
|
||||||
uint64_t Size = 0;
|
uint64_t Size = 0;
|
||||||
|
|
||||||
const MCExpr *ESize = OrigData.getSize();
|
const MCExpr *ESize = MSD.Symbol->getSize();
|
||||||
if (!ESize && Base)
|
if (!ESize && Base)
|
||||||
ESize = BaseSD->getSize();
|
ESize = Base->getSize();
|
||||||
|
|
||||||
if (ESize) {
|
if (ESize) {
|
||||||
int64_t Res;
|
int64_t Res;
|
||||||
|
@ -331,12 +331,11 @@ void MCELFStreamer::EmitCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
|||||||
SD.setCommon(Size, ByteAlignment);
|
SD.setCommon(Size, ByteAlignment);
|
||||||
}
|
}
|
||||||
|
|
||||||
SD.setSize(MCConstantExpr::Create(Size, getContext()));
|
Symbol->setSize(MCConstantExpr::Create(Size, getContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
|
void MCELFStreamer::EmitELFSize(MCSymbol *Symbol, const MCExpr *Value) {
|
||||||
MCSymbolData &SD = getAssembler().getOrCreateSymbolData(*Symbol);
|
Symbol->setSize(Value);
|
||||||
SD.setSize(Value);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
void MCELFStreamer::EmitLocalCommonSymbol(MCSymbol *Symbol, uint64_t Size,
|
||||||
|
Loading…
Reference in New Issue
Block a user