mirror of
https://github.com/intel/llvm.git
synced 2026-01-26 12:26:52 +08:00
Fix ubsan error that shift amount 64 is too large.
llvm-svn: 316863
This commit is contained in:
@@ -763,7 +763,9 @@ template <class ELFT> void SharedFile<ELFT>::parseRest() {
|
||||
// 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 = 1ULL << countTrailingZeros((uint64_t)Sym.st_value);
|
||||
uint32_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);
|
||||
|
||||
Reference in New Issue
Block a user