Handle a section being more aligned than a page size.
llvm-svn: 308812
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 1853f99..558ecfb 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -1600,7 +1600,8 @@
// The first section in a PT_LOAD has to have congruent offset and address
// module the page size.
if (Sec == First)
- return alignTo(Off, Config->MaxPageSize, Sec->Addr);
+ return alignTo(Off, std::max<uint64_t>(Sec->Alignment, Config->MaxPageSize),
+ Sec->Addr);
// If two sections share the same PT_LOAD the file offset is calculated
// using this formula: Off2 = Off1 + (VA2 - VA1).