mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-28 02:36:05 +00:00

Summary: We use embedded binaries to extract offloading device code from the host fatbinary. This uses a binary format whose necessary alignment is eight bytes. The alignment is included within the ELF section type so the data extracted from the ELF should always be aligned at that amount. However, if this file was extraqcted from a static archive, it was being sent as an offset in the archive file which did not have the same alignment guaruntees as the ELF file. This was causing errors in the UB-sanitizer build as it would occasionally try to access a misaligned address. To fix this, I simply copy the memory directly to a new buffer which is guarnteed to have worst-case alignment of 16 in the case that it's not properly aligned.