Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-20 Thread Alexei Starovoitov
On Thu, Aug 20, 2020 at 10:54 AM Yonghong Song wrote: > > > > On 8/20/20 10:36 AM, Mark Wielaard wrote: > > Hi > > > > On Thu, 2020-08-20 at 08:51 -0700, Yonghong Song wrote: > Do you think we could skip these .debug_* sections somehow in elf > parsing in resolve_btfids? resolve_btfids d

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-20 Thread Yonghong Song
On 8/20/20 10:36 AM, Mark Wielaard wrote: Hi On Thu, 2020-08-20 at 08:51 -0700, Yonghong Song wrote: Do you think we could skip these .debug_* sections somehow in elf parsing in resolve_btfids? resolve_btfids does not need to read these sections. This way, no need to change their alignment e

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-20 Thread Mark Wielaard
Hi On Thu, 2020-08-20 at 08:51 -0700, Yonghong Song wrote: > > > Do you think we could skip these .debug_* sections somehow in elf > > > parsing in resolve_btfids? resolve_btfids does not need to read > > > these sections. This way, no need to change their alignment > > > either. > > > > The issu

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-20 Thread Yonghong Song
On 8/20/20 3:18 AM, Mark Wielaard wrote: Hi, On Wed, 2020-08-19 at 20:23 -0700, Yonghong Song wrote: On 8/19/20 7:27 PM, Fāng-ruì Sòng wrote: I think this is resolve_btfids's bug. GNU ld and LLD are innocent. These .debug_* sections work fine if their sh_addralign is 1. When the section f

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-20 Thread Jiri Olsa
On Wed, Aug 19, 2020 at 08:23:10PM -0700, Yonghong Song wrote: > > > On 8/19/20 7:27 PM, Fāng-ruì Sòng wrote: > > > > > section(36) .comment, size 44, link 0, flags 30, type=1 > > > > > section(37) .debug_aranges, size 45684, link 0, flags 800, type=1 > > > > > - fixing wrong alignme

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-20 Thread Mark Wielaard
Hi, On Wed, 2020-08-19 at 20:23 -0700, Yonghong Song wrote: > On 8/19/20 7:27 PM, Fāng-ruì Sòng wrote: > > > > > > > I think this is resolve_btfids's bug. GNU ld and LLD are innocent. > > These .debug_* sections work fine if their sh_addralign is 1. > > When the section flag SHF_COMPRESSED is set

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-19 Thread Yonghong Song
On 8/19/20 7:27 PM, Fāng-ruì Sòng wrote: section(36) .comment, size 44, link 0, flags 30, type=1 section(37) .debug_aranges, size 45684, link 0, flags 800, type=1 - fixing wrong alignment sh_addralign 16, expected 8 section(38) .debug_info, size 129104957, link 0, flags 800, t

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-19 Thread Yonghong Song
On 8/19/20 2:23 AM, Jiri Olsa wrote: The data of compressed section should be aligned to 4 (for 32bit) or 8 (for 64 bit) bytes. The binutils ld sets sh_addralign to 1, which makes libelf fail with misaligned section error during the update as reported by Jesper: FAILED elf_update(WRITE):

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-19 Thread Yonghong Song
On 8/19/20 11:16 AM, Nick Desaulniers wrote: On Wed, Aug 19, 2020 at 10:36 AM Jiri Olsa wrote: On Wed, Aug 19, 2020 at 08:31:51AM -0700, Yonghong Song wrote: On 8/19/20 2:23 AM, Jiri Olsa wrote: The data of compressed section should be aligned to 4 (for 32bit) or 8 (for 64 bit) bytes.

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-19 Thread Jiri Olsa
On Wed, Aug 19, 2020 at 08:31:51AM -0700, Yonghong Song wrote: > > > On 8/19/20 2:23 AM, Jiri Olsa wrote: > > The data of compressed section should be aligned to 4 > > (for 32bit) or 8 (for 64 bit) bytes. > > > > The binutils ld sets sh_addralign to 1, which makes libelf > > fail with misaligned

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-19 Thread Jesper Dangaard Brouer
On Wed, 19 Aug 2020 11:23:42 +0200 Jiri Olsa wrote: > The data of compressed section should be aligned to 4 > (for 32bit) or 8 (for 64 bit) bytes. > > The binutils ld sets sh_addralign to 1, which makes libelf > fail with misaligned section error during the update as > reported by Jesper: > >

Re: [PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-19 Thread Yonghong Song
On 8/19/20 2:23 AM, Jiri Olsa wrote: The data of compressed section should be aligned to 4 (for 32bit) or 8 (for 64 bit) bytes. The binutils ld sets sh_addralign to 1, which makes libelf fail with misaligned section error during the update as reported by Jesper: FAILED elf_update(WRITE):

[PATCH bpf-next] tools/resolve_btfids: Fix sections with wrong alignment

2020-08-19 Thread Jiri Olsa
The data of compressed section should be aligned to 4 (for 32bit) or 8 (for 64 bit) bytes. The binutils ld sets sh_addralign to 1, which makes libelf fail with misaligned section error during the update as reported by Jesper: FAILED elf_update(WRITE): invalid section alignment While waiting f