aboutsummaryrefslogtreecommitdiffstats
path: root/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-05-30 17:38:04 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-05-30 17:38:04 +0000
commitcbb560c9ba3c378189c7a438bed9977b482410fb (patch)
tree8ed3968b9cb86039eb38b3b8d66fd7c17a5aed0f /ELF/LinkerScript.cpp
parentbef2946c219dc621608bcc9e47f8b973e5ef5c70 (diff)
downloadsrc-cbb560c9ba3c378189c7a438bed9977b482410fb.tar.gz
src-cbb560c9ba3c378189c7a438bed9977b482410fb.zip
Vendor import of lld trunk r304222:vendor/lld/lld-trunk-r304222
Notes
Notes: svn path=/vendor/lld/dist/; revision=319238 svn path=/vendor/lld/lld-trunk-r304222/; revision=319239; tag=vendor/lld/lld-trunk-r304222
Diffstat (limited to 'ELF/LinkerScript.cpp')
-rw-r--r--ELF/LinkerScript.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/ELF/LinkerScript.cpp b/ELF/LinkerScript.cpp
index 492b81c1fa76..99c464e3714c 100644
--- a/ELF/LinkerScript.cpp
+++ b/ELF/LinkerScript.cpp
@@ -52,11 +52,12 @@ LinkerScript *elf::Script;
uint64_t ExprValue::getValue() const {
if (Sec) {
if (Sec->getOutputSection())
- return Sec->getOffset(Val) + Sec->getOutputSection()->Addr;
+ return alignTo(Sec->getOffset(Val) + Sec->getOutputSection()->Addr,
+ Alignment);
error("unable to evaluate expression: input section " + Sec->Name +
" has no output section assigned");
}
- return Val;
+ return alignTo(Val, Alignment);
}
uint64_t ExprValue::getSecAddr() const {
@@ -143,7 +144,7 @@ void LinkerScript::assignSymbol(SymbolAssignment *Cmd, bool InSec) {
} else {
Sym->Section = V.Sec;
if (Sym->Section->Flags & SHF_ALLOC)
- Sym->Value = V.Val;
+ Sym->Value = alignTo(V.Val, V.Alignment);
else
Sym->Value = V.getValue();
}
@@ -290,6 +291,9 @@ LinkerScript::computeInputSections(const InputSectionDescription *Cmd) {
size_t SizeBefore = Ret.size();
for (InputSectionBase *Sec : InputSections) {
+ if (!isa<InputSection>(Sec))
+ continue;
+
if (Sec->Assigned)
continue;
@@ -1076,6 +1080,9 @@ template <class ELFT> void OutputSectionCommand::writeTo(uint8_t *Buf) {
return;
}
+ if (Sec->Type == SHT_NOBITS)
+ return;
+
// Write leading padding.
ArrayRef<InputSection *> Sections = Sec->Sections;
uint32_t Filler = getFiller();