aboutsummaryrefslogtreecommitdiff
path: root/ELF/SyntheticSections.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2018-01-06 21:36:48 +0000
committerDimitry Andric <dim@FreeBSD.org>2018-01-06 21:36:48 +0000
commit97dd191f563d0b295e4abc86dc95a4f6276c6d8f (patch)
treedc66d565f400b52657b1297dba15c40cf91b74a3 /ELF/SyntheticSections.cpp
parentae1a339de31cf4065777531959a11e55a2e5fa00 (diff)
Vendor import of lld release_60 branch r321788:vendor/lld/lld-release_60-r321788
Notes
Notes: svn path=/vendor/lld/dist-release_60/; revision=327647 svn path=/vendor/lld/lld-release_60-r321788/; revision=327648; tag=vendor/lld/lld-release_60-r321788
Diffstat (limited to 'ELF/SyntheticSections.cpp')
-rw-r--r--ELF/SyntheticSections.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/ELF/SyntheticSections.cpp b/ELF/SyntheticSections.cpp
index a5e291b79a4d..f878acf8cf3f 100644
--- a/ELF/SyntheticSections.cpp
+++ b/ELF/SyntheticSections.cpp
@@ -1064,7 +1064,7 @@ template <class ELFT> void DynamicSection<ELFT>::finalizeContents() {
addInt(DT_DEBUG, 0);
this->Link = InX::DynStrTab->getParent()->SectionIndex;
- if (InX::RelaDyn->getParent() && !InX::RelaDyn->empty()) {
+ if (!InX::RelaDyn->empty()) {
addInSec(InX::RelaDyn->DynamicTag, InX::RelaDyn);
addSize(InX::RelaDyn->SizeDynamicTag, InX::RelaDyn->getParent());
@@ -1081,7 +1081,13 @@ template <class ELFT> void DynamicSection<ELFT>::finalizeContents() {
addInt(IsRela ? DT_RELACOUNT : DT_RELCOUNT, NumRelativeRels);
}
}
- if (InX::RelaPlt->getParent() && !InX::RelaPlt->empty()) {
+ // .rel[a].plt section usually consists of two parts, containing plt and
+ // iplt relocations. It is possible to have only iplt relocations in the
+ // output. In that case RelaPlt is empty and have zero offset, the same offset
+ // as RelaIplt have. And we still want to emit proper dynamic tags for that
+ // case, so here we always use RelaPlt as marker for the begining of
+ // .rel[a].plt section.
+ if (InX::RelaPlt->getParent()->Live) {
addInSec(DT_JMPREL, InX::RelaPlt);
addSize(DT_PLTRELSZ, InX::RelaPlt->getParent());
switch (Config->EMachine) {