Subject: Re: alignment problem with recent Emacs unexelf.c changes

From: Alan Modra <[email-masked]>
Date: Tue, 17 Nov 2015 19:33:04 +1030

On Mon, Nov 16, 2015 at 05:59:25PM -0800, Paul Eggert wrote:
> 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.

The patch looks good to me, and yes, section headers ought to be
aligned to their natural alignment (4 byte for 32-bit object files,
8 byte for 64-bit objects).  .symtab should be kept aligned too, and
your patch accomplishes that as well.  Thanks for fixing this.  No
other alignment requirements come to mind.

Note that the new unexelf.c does not handle objects using .lrodata,
.ldata and .lbss or other "large sections" typically loaded well above
.bss in the address space.  The old unexelf.c didn't handle them
properly either..

-- 
Alan Modra
Australia Development Lab, IBM