mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-20 14:29:27 +00:00
MCELF: The value of all common symbols is the offset from the start of the section. Patch by Roman Divacky.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112492 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
392953262e
commit
6cc53be24c
@ -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…
x
Reference in New Issue
Block a user