The value is offset from the start of the section for non-common symbols, submitted by Jordan Gordeev.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@112473 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/MC/ELFObjectWriter.cpp b/lib/MC/ELFObjectWriter.cpp
index 9760417..dd2419f 100644
--- a/lib/MC/ELFObjectWriter.cpp
+++ b/lib/MC/ELFObjectWriter.cpp
@@ -384,6 +384,8 @@
}
} 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");
}