[llvm-objdump] Ensure offloading sections have proper alignment
authorJoseph Huber <jhuber6@vols.utk.edu>
Sat, 2 Jul 2022 03:24:22 +0000 (23:24 -0400)
committerJoseph Huber <jhuber6@vols.utk.edu>
Sat, 2 Jul 2022 03:26:44 +0000 (23:26 -0400)
commitccf7dd5e813dd066d720cbd7f70c9052a3a17e96
tree02722975ce47871fc67761f788017eaaa3a4fa98
parent5744b9cb799841837ca0419b0fc6287fb4649dc7
[llvm-objdump] Ensure offloading sections have proper alignment

Summary:
A previous patch added support for dumping offloading sections. The
tests for this feature added dummy input to the required section using
`llvm-objcopy`. This binary format has a required alignment of `8` which
was not being respected by the file copied with llvm-objcopy and would
cause failures on architectures sensitive to alignment problems or with
sanitizers. This patch adds the proper alignemnt and adds an error check
at least for the binary format so it's not completely opaque. This
should be improvbed so users actually get a helpful message.
llvm/lib/Object/OffloadBinary.cpp
llvm/test/tools/llvm-objdump/Offloading/binary.test
llvm/test/tools/llvm-objdump/Offloading/warning.test