Created attachment 182066 [details]
Patch to fix the problem
The libelf file in base fails to perform elf_update when growing the file by adding new sections, because elf_getdata erroneously checks section boundaries against the old file size.
This can be fixed by omitting this check when doing elf_update.
The attached patch fixes the problem.
Review for fix: https://reviews.freebsd.org/D10487
Drop from 12.0 tracking; there is an open question in the review and this is unlikely to be resolved before release.