I ran into a porting problem when using Emacs's recent unexelf.c changes in a picky build using GCC’s -fsanitize=undefined option. The attached patch worked for me, so I installed it into emacs-25. Alan, could you please check and/or improve this patch, and/or think about whether there might be similar problems elsewhere? Thanks.