[all-commits] [llvm/llvm-project] 42a1fb: [LinkerWrapper][Fix} Fix bad alignment from extrac...

Joseph Huber via All-commits all-commits at lists.llvm.org
Wed May 11 13:57:04 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 42a1fb5ca56c494e25419a97057a9526f3e8608d
      https://github.com/llvm/llvm-project/commit/42a1fb5ca56c494e25419a97057a9526f3e8608d
  Author: Joseph Huber <jhuber6 at vols.utk.edu>
  Date:   2022-05-11 (Wed, 11 May 2022)

  Changed paths:
    M clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp

  Log Message:
  -----------
  [LinkerWrapper][Fix} Fix bad alignment from extracted archive members

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.




More information about the All-commits mailing list