Found during FreeBSD exp run while building libjpeg-turbo
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=198611
Failure initially reported as:
% elfcopy/strip -o /dev/null --strip-debug libturbojpeg.a
strip: elf_update() failed: Layout constraint violation
Trying the individual .o files shows:
% elfcopy/strip --strip-debug -o /dev/null jccolss2-64.o
Assertion failed: (sh_off % _libelf_falign(elftype, ec) == 0), function _libelf_write_scn, file elf_update.c, line 746.
zsh: abort (core dumped) ../../elfcopy/strip --strip-debug -o /dev/null jccolss2-64.o
% elfcopy/strip --strip-debug -o /dev/null jcqnts2f-64.o
strip: elf_update() failed: Layout constraint violation
Diff:
See https://reviews.freebsd.org/D2292 for a potential fix
Root cause is a bug in NASM, with patch here: http://bugzilla.nasm.us/show_bug.cgi?id=3392307
I still think it makes sense to have elfcopy/strip increase the alignment as required, as in the review in the previous comment.
libelfhas been patched in [r3190].We could have elfcopy/strip fix up the file, perhaps issuing a warning
in the process.
Related
Commit: [r3190]