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

Han Shen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 31 13:51:39 PDT 2018


shenhan 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);
 
----------------
ruiu wrote:
> pcc wrote:
> > 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.
> Hmm, you are probably right. Han, what are you trying to fix by this change?
I cc'ed you and @pcc in the internal bug.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47602





More information about the llvm-commits mailing list