Don't include tbss's alignment in offset.
The .tbss section is in the middle of a PT_LOAD. Whatever treatment we
give to its address we must also give to the offset.
We were ignoring it for address computations, but not for offset.
Fixes pr26712.
llvm-svn: 261667
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 525bb30..52741b1 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1344,7 +1344,8 @@
if (PageAlign.count(Sec))
Align = std::max<uintX_t>(Align, Target->PageSize);
- FileOff = alignTo(FileOff, Align);
+ if (Sec->getType() != SHT_NOBITS)
+ FileOff = alignTo(FileOff, Align);
Sec->setFileOffset(FileOff);
if (Sec->getType() != SHT_NOBITS)
FileOff += Sec->getSize();