[PATCH] D39697: Limit the maximum alignment of copyrel'ed shared symbols to 32.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 6 14:06:52 PST 2017
ruiu updated this revision to Diff 121782.
ruiu added a comment.
- Address review comments.
https://reviews.llvm.org/D39697
Files:
lld/ELF/InputFiles.cpp
Index: lld/ELF/InputFiles.cpp
===================================================================
--- lld/ELF/InputFiles.cpp
+++ lld/ELF/InputFiles.cpp
@@ -809,13 +809,15 @@
// files because the loader takes care of it. However, if we promote a
// DSO symbol to point to .bss due to copy relocation, we need to keep
// the original alignment requirements. We infer it here.
- uint32_t Alignment = 1;
+ uint64_t Alignment = 1;
if (Sym.st_value)
Alignment = 1ULL << countTrailingZeros((uint64_t)Sym.st_value);
if (0 < Sym.st_shndx && Sym.st_shndx < Sections.size()) {
uint32_t SecAlign = Sections[Sym.st_shndx].sh_addralign;
Alignment = std::min(Alignment, SecAlign);
}
+ if (!isUint<32>(Alignment))
+ error(toString(this) + ": alignment too large: " + Name);
if (!Hidden)
Symtab->addShared(Name, this, Sym, Alignment, Ver);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39697.121782.patch
Type: text/x-patch
Size: 902 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171106/67107991/attachment.bin>
More information about the llvm-commits
mailing list