Re: Kernel build error on BTFIDS vmlinux

From: Jiri Olsa
Date: Wed Aug 19 2020 - 13:19:08 EST


On Wed, Aug 19, 2020 at 04:34:30PM +0100, Nick Clifton wrote:
> Hi Mark,
>
> > Adding Nick, the binutils maintainer, so we can make sure
> > binutils/elfutils agree on some ELF section compression corner case.
>
> Thanks for doing this.
>
> > But it would obviously be better if that wasn't necessary. So I'll try
> > to fix libelf so that if it fixes up the alignment when reading the
> > compressed data, it also does that when writing out the data again. But
> > that would only help for a new version of elfutils.
> >
> > So it would be nice if binutils ld could also be fixed to write out
> > compressed sections with the correct alignment.
>
> OK, I will look into doing this.
>
> By any chance is there a small test case that you are using to check
> this behaviour ? If so, please may I have a copy for myself ?

so when I take empty object and compile like:

$ echo 'int main(int argc, char **argv) { return 0; }' | gcc -c -o ex.o -g -gz=zlib -x c -
$ ld -o ex --compress-debug-sections=zlib ex.o

then there's .debug_info section that shows sh_addralign = 1
after I open the 'ex' obejct with elf_begin and iterate sections

according to Mark that should be 8 (on 64 bits)

when I change it to 8, the elf_update call won't fail for me
on that elf file

thanks,
jirka