[PATCH] D47602: Correct aligment computation for shared object symbols

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 13:39:59 PDT 2018


pcc added inline comments.


================
Comment at: ELF/InputFiles.cpp:904
   if (0 < Sym.st_shndx && Sym.st_shndx < Sections.size())
-    Ret = std::min<uint64_t>(Ret, Sections[Sym.st_shndx].sh_addralign);
+    Ret = std::max<uint64_t>(Ret, Sections[Sym.st_shndx].sh_addralign);
 
----------------
Actually, now that I think about it, I think this was correct before. The `sh_addralign` field says what the maximum alignment of anything in the section is going to be, and the code on lines 899-900 (in the old code) uses the symbol's `st_value` to infer a smaller alignment wherever possible.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47602





More information about the llvm-commits mailing list