[llvm-commits] [llvm] r112492 - /llvm/trunk/lib/MC/ELFObjectWriter.cpp
Benjamin Kramer
benny.kra at googlemail.com
Mon Aug 30 10:20:17 PDT 2010
Author: d0k
Date: Mon Aug 30 12:20:17 2010
New Revision: 112492
URL: http://llvm.org/viewvc/llvm-project?rev=112492&view=rev
Log:
MCELF: The value of all common symbols is the offset from the start of the section. Patch by Roman Divacky.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=112492&r1=112491&r2=112492&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Aug 30 12:20:17 2010
@@ -367,6 +367,11 @@
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 @@
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");
}
More information about the llvm-commits
mailing list