summaryrefslogtreecommitdiffstats
path: root/lld/ELF/LinkerScript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
-rw-r--r--lld/ELF/LinkerScript.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp
index 7edfacae97a..922c23e2862 100644
--- a/lld/ELF/LinkerScript.cpp
+++ b/lld/ELF/LinkerScript.cpp
@@ -357,11 +357,14 @@ static void assignSectionSymbol(SymbolAssignment *Cmd,
Body->Value = Cmd->Expression(Sec->getVA() + Off);
}
+template <class ELFT> static bool isTbss(OutputSectionBase<ELFT> *Sec) {
+ return (Sec->getFlags() & SHF_TLS) && Sec->getType() == SHT_NOBITS;
+}
+
template <class ELFT> void LinkerScript<ELFT>::output(InputSection<ELFT> *S) {
if (!AlreadyOutputIS.insert(S).second)
return;
- bool IsTbss =
- (CurOutSec->getFlags() & SHF_TLS) && CurOutSec->getType() == SHT_NOBITS;
+ bool IsTbss = isTbss(CurOutSec);
uintX_t Pos = IsTbss ? Dot + ThreadBssOffset : Dot;
Pos = alignTo(Pos, S->Alignment);
@@ -398,7 +401,7 @@ void LinkerScript<ELFT>::switchTo(OutputSectionBase<ELFT> *Sec) {
CurOutSec = Sec;
Dot = alignTo(Dot, CurOutSec->getAlignment());
- CurOutSec->setVA(Dot);
+ CurOutSec->setVA(isTbss(CurOutSec) ? Dot + ThreadBssOffset : Dot);
}
template <class ELFT> void LinkerScript<ELFT>::process(BaseCommand &Base) {
OpenPOWER on IntegriCloud