[llvm-branch-commits] [llvm] [Support] Integrate SipHash.cpp into libSupport. (PR #94394)

Kristof Beyls via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Jun 8 02:01:34 PDT 2024


kbeyls wrote:

> So, regarding big-endian things. Original siphash is always "little-endian" regardless of the host platform. On big endian hosts it essentially does byte swap in the end. We do not have it here, so we will end with different hashes on platforms with different endianness.
> 
> From the pauth perspective this is not a problem, as we do not do cross-platform hash calculation and further comparison. The hash output (discriminator value) is always compiled on compiler side and left as-is.
> 
> So, we can either keep the present code as-is. Or we can just sprinkle few calls from `Endian.h` to do byteswap on BE platforms.

I was thinking that it is important that on both big and little endian platforms, the same hash is produced? Otherwise it becomes impossible to cross-compile from an other-endian host to an other-endian target? That basically would break ABI?
It would surface when combining libraries built on differently-endian platforms. Maybe this doesn't happen often in practice, but LLVM remains supported on big-endian platforms, so I would think it's important that those platforms can cross-compile correctly to other targets?

https://github.com/llvm/llvm-project/pull/94394


More information about the llvm-branch-commits mailing list