[lld] r316863 - Fix ubsan error that shift amount 64 is too large.
Rafael Avila de Espindola via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 3 21:06:35 PDT 2017
Rui Ueyama via llvm-commits <llvm-commits at lists.llvm.org> writes:
> Modified: lld/trunk/ELF/InputFiles.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=316863&r1=316862&r2=316863&view=diff
> ==============================================================================
> --- lld/trunk/ELF/InputFiles.cpp (original)
> +++ lld/trunk/ELF/InputFiles.cpp Sun Oct 29 09:49:42 2017
> @@ -763,7 +763,9 @@ template <class ELFT> void SharedFile<EL
> // 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);
This still implicitly discard information if st_value is aligned to more
than 32 bits, no? Should Alignment be a uint_64?
Cheers,
Rafael
More information about the llvm-commits
mailing list