[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 12:31:57 PDT 2018


shenhan created this revision.
Herald added subscribers: llvm-commits, arichardson, emaste.
Herald added a reviewer: espindola.

The original computation for shared object symbols is apparently wrong, which caused quite a few subtle internal test failures.


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D47602

Files:
  ELF/InputFiles.cpp


Index: ELF/InputFiles.cpp
===================================================================
--- ELF/InputFiles.cpp
+++ ELF/InputFiles.cpp
@@ -899,7 +899,7 @@
   if (Sym.st_value)
     Ret = 1ULL << countTrailingZeros((uint64_t)Sym.st_value);
   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);
 
   if (Ret > UINT32_MAX)
     error(toString(this) + ": alignment too large: " +


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D47602.149340.patch
Type: text/x-patch
Size: 532 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180531/db8235f9/attachment.bin>


More information about the llvm-commits mailing list