mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-08 04:11:27 +00:00
MCELF: The value of all common symbols is the offset from the start of the section. Patch by Roman Divacky.
llvm-svn: 112492
This commit is contained in:
parent
d29fb4b991
commit
6c5076f317
@ -367,6 +367,11 @@ void ELFObjectWriterImpl::WriteSymbol(MCDataFragment *F, ELFSymbolData &MSD,
|
||||
if (Data.isCommon() && Data.isExternal())
|
||||
Value = Data.getCommonAlignment();
|
||||
|
||||
if (!Data.isCommon())
|
||||
if (MCFragment *FF = Data.getFragment())
|
||||
Value = Layout.getSymbolAddress(&Data) -
|
||||
Layout.getSectionAddress(FF->getParent());
|
||||
|
||||
ESize = Data.getSize();
|
||||
if (Data.getSize()) {
|
||||
MCValue Res;
|
||||
@ -380,12 +385,9 @@ void ELFObjectWriterImpl::WriteSymbol(MCDataFragment *F, ELFSymbolData &MSD,
|
||||
Layout.getAssembler().getSymbolData(Res.getSymB()->getSymbol());
|
||||
|
||||
Size = Layout.getSymbolAddress(&A) - Layout.getSymbolAddress(&B);
|
||||
Value = Layout.getSymbolAddress(&Data);
|
||||
}
|
||||
} else if (ESize->getKind() == MCExpr::Constant) {
|
||||
Size = static_cast<const MCConstantExpr *>(ESize)->getValue();
|
||||
MCFragment *F = Data.getFragment();
|
||||
Value = Layout.getSymbolAddress(&Data) - Layout.getSectionAddress(F->getParent());
|
||||
} else {
|
||||
assert(0 && "Unsupported size expression");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user