diff --git a/main.cc b/main.cc index a11f5b55..db56158a 100644 --- a/main.cc +++ b/main.cc @@ -303,17 +303,17 @@ int main(int argc, char **argv) { return; uint64_t off = 0; + uint32_t align = 0; for (InputSection *isec : osec->chunks) { off = align_to(off, isec->shdr.sh_addralign); isec->offset = off; off += isec->shdr.sh_size; - - osec->shdr.sh_addralign = - std::max(osec->shdr.sh_addralign, isec->shdr.sh_addralign); + align = std::max(align, isec->shdr.sh_addralign); } osec->shdr.sh_size = off; + osec->shdr.sh_addralign = align; }); }