summaryrefslogtreecommitdiffstats
path: root/lld/ELF/Writer.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2015-08-31 22:55:21 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2015-08-31 22:55:21 +0000
commitce8c9c05489ad6b87f63ca949946ccf089ef8d0c (patch)
tree08834950d99d7f242151776f65c41437ce4cfdd3 /lld/ELF/Writer.cpp
parentfa715655ee88fdcdfcf7abf03df2a5301b6fa629 (diff)
downloadbcm5719-llvm-ce8c9c05489ad6b87f63ca949946ccf089ef8d0c.tar.gz
bcm5719-llvm-ce8c9c05489ad6b87f63ca949946ccf089ef8d0c.zip
Set the correct value for the common symbols.
In the relocatable object it is the alignment, but in the linked file it is a regular address. llvm-svn: 246505
Diffstat (limited to 'lld/ELF/Writer.cpp')
-rw-r--r--lld/ELF/Writer.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 2412cb86dba..1cee79cf051 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -344,7 +344,10 @@ template <class ELFT> void SymbolTableSection<ELFT>::writeTo(uint8_t *Buf) {
uintX_t VA = Out->getVA();
if (Section)
VA += Section->getOutputSectionOff();
- VA += InputSym->st_value;
+ if (auto *C = dyn_cast<DefinedCommon<ELFT>>(Body))
+ VA += C->OffsetInBSS;
+ else
+ VA += InputSym->st_value;
ESym->st_value = VA;
}
@@ -445,6 +448,7 @@ template <class ELFT> void Writer<ELFT>::createSections() {
const Elf_Sym &Sym = C->Sym;
uintX_t Align = Sym.st_value;
Off = RoundUpToAlignment(Off, Align);
+ C->OffsetInBSS = Off;
Off += Sym.st_size;
}
BSSSec->setSize(Off);
OpenPOWER on IntegriCloud