My test refactoring in D80217 seems to have caused yaml2obj to emit unaligned
nlist_64 structs, causing ASAN'd lld to be unhappy. I don't think this is an
issue with yaml2obj though -- llvm-mc also seems to emit unaligned nlist_64s.
This diff makes lld able to safely do aligned reads under ASAN builds while
hopefully creating no overhead for regular builds on architectures that support
unaligned reads.
Depends on D80217.
i suspect you might face the same issue with other data structures which should be properly aligned too,
so it would be good to think about a general consistent approach how to handle it.
Just for the record I'd like to mention how libObject solves this problem:
https://llvm.org/doxygen/MachOObjectFile_8cpp_source.html#l04264
https://llvm.org/doxygen/MachOObjectFile_8cpp_source.html#l00068