On Sun, 2018-11-18 at 15:38 +0100, Mark Wielaard wrote: > When writing out data that needs to be converted we have to make sure > the conversion function is called on correctly aligned buffers. When > using mmap this might mean we have to convert into a temporarily > buffer > if the user wants to write out the section at a location that is not > correctly aligned for the section type. > > Older gas would generate misaligned ELF notes for the .version > directive. When copying over such notes using mmap from files with > a different endianness using mmap we would get the alignment of the > conversion destination wrong. > > The new testcase would fail with configure --enable-sanitize- > undefined > on little endian systems. The GCC undefinited sanitizer caught a > similar > issue with testfile1 on big endian systems. > > gelf_xlate.h:47:1: runtime error: member access within misaligned > address > 0x7f8145d770d5 for type 'struct Elf32_Nhdr', which requires 4 byte > alignment
Pushed to master (with the typo in the subject fixed).