llvm-project/llvm/tools/llvm-objcopy
Daniel Rodríguez Troitiño 8fbe1e7602 [llvm-objcopy] Fix misaligned access to load command data.
It seems that llvm-objcopy stores data temporarily misaligned with the
requirements of the underlaying struct from libBinaryFormat, and UBSan
generates a runtime error.

Instead of trying to reinterpret the memory as the struct itself, simply
access the `char *` pointer that we are interested in, and that do not
have alignment restrictions.

This problem was pointed out in a comment of D111164.

Differential Revision: https://reviews.llvm.org/D112744
2021-10-28 22:14:39 -07:00
..
COFF [llvm-objcopy][COFF] Fix test for debug dir presence 2021-09-10 09:57:18 +01:00
ELF [llvm-objcopy] Rename relocation sections together with their targets. 2021-09-29 16:36:37 +07:00
MachO [llvm-objcopy] Fix misaligned access to load command data. 2021-10-28 22:14:39 -07:00
wasm [llvm-strip][WebAssembly] Support strip flags 2021-07-14 14:17:02 -07:00
BitcodeStripOpts.td [llvm-objcopy][MachO] Add llvm-bitcode-strip driver 2020-09-18 18:13:05 -07:00
CMakeLists.txt [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00
CommonConfig.h [llvm-objcopy][NFC] Refactor CopyConfig structure - categorize options. 2021-09-08 19:16:38 +03:00
CommonOpts.td [llvm-objcopy][MachO] Add support for --keep-undefined 2021-03-08 18:57:25 -08:00
ConfigManager.cpp [tools] Delete redundant 'static' from namespace scope 'static const'. NFC 2021-10-18 22:38:42 -07:00
ConfigManager.h [llvm-objcopy][NFC] Refactor CopyConfig structure - remove lazy options processing. 2021-05-31 14:40:27 +03:00
InstallNameToolOpts.td [llvm-install-name-tool] Add -prepend_rpath option 2020-10-23 15:01:03 -07:00
MultiFormatConfig.h [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00
ObjcopyOpts.td [llvm-objcopy][docs] Add missing options to the help output and the command guide 2021-09-24 09:44:46 +01:00
StripOpts.td [llvm-objcopy][MachO] Add support for removing Swift symbols 2020-05-26 16:49:56 -07:00
llvm-objcopy.cpp [llvm] Rename StringRef _lower() method calls to _insensitive() 2021-06-25 00:22:01 +03:00
llvm-objcopy.h [llvm-objcopy] Refactor CopyConfig structure. 2021-05-20 13:14:51 +03:00