Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-04 Thread Jose E. Marchesi via Gcc
> Hi everyone. > > I built and ran selftests/bpf with GCC 15-20241229, and would like to > share my findings. > > Building required small adjustments in the Makefile, besides -std=gnu17 > > With the following change we can mitigate int64_t issue: > > +progs/test_cls_redirect.c-CFLAGS := -nostdinc

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-03 Thread Andrew Pinski via Gcc
On Fri, Jan 3, 2025 at 3:48 PM Ihor Solodrai wrote: > > Hi everyone. > > I built and ran selftests/bpf with GCC 15-20241229, and would like to > share my findings. > > Building required small adjustments in the Makefile, besides -std=gnu17 > > With the following change we can mitigate int64_t issu

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-03 Thread Ihor Solodrai via Gcc
Hi everyone. I built and ran selftests/bpf with GCC 15-20241229, and would like to share my findings. Building required small adjustments in the Makefile, besides -std=gnu17 With the following change we can mitigate int64_t issue: +progs/test_cls_redirect.c-CFLAGS := -nostdinc +progs/test_cls_r

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-03 Thread Jose E. Marchesi via Gcc
> On Thu, 2025-01-02 at 19:24 +0100, Jose E. Marchesi wrote: > > [...] > >> IMO the BPP selftest (and BPF programs in general) must not include host >> glibc headers at all, regardless of what BPF compiler is used. The >> glibc headers installed in the host are tailored to some particular >> arc

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-03 Thread Jose E. Marchesi via Gcc
> [...] >>> We could switch to "wrap" to align with clang, but in that case it would >>> be up to the user to provide a "host" stdint.h that contains sensible >>> definitions for BPF. The kernel selftests, for example, would need to >>> do so to avoid including /usr/include/stdint.h that more li

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-03 Thread Jose E. Marchesi via Gcc
> On Fri, 2025-01-03 at 01:16 +0100, Jose E. Marchesi wrote: > > [...] > >> Yes, in the GCC BPF backend we are using >> >>   use_gcc_stdint=provide >> >> which makes GCC to provide the version of stdint.h that assumes >> freestanding ("baremetal") mode. If we changed it to use >> >>   use_gcc

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-02 Thread Eduard Zingerman via Gcc
On Fri, 2025-01-03 at 01:16 +0100, Jose E. Marchesi wrote: [...] > Yes, in the GCC BPF backend we are using > >   use_gcc_stdint=provide > > which makes GCC to provide the version of stdint.h that assumes > freestanding ("baremetal") mode. If we changed it to use > >   use_gcc_stdint=wrap >

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-02 Thread Eduard Zingerman via Gcc
On Thu, 2025-01-02 at 19:24 +0100, Jose E. Marchesi wrote: [...] > IMO the BPP selftest (and BPF programs in general) must not include host > glibc headers at all, regardless of what BPF compiler is used. The > glibc headers installed in the host are tailored to some particular > architecture, b

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-02 Thread Jose E. Marchesi via Gcc
> On Thu, 2025-01-02 at 10:47 +0100, Jose E. Marchesi wrote: >> Hi Ihor. >> Thanks for working on this! :) >> >> > [...] >> > Older versions compile the dummy program without errors, however on >> > attempt to build the selftests there is a different issue: conflicting >> > int64 definitions (fu

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-02 Thread Eduard Zingerman via Gcc
On Thu, 2025-01-02 at 10:47 +0100, Jose E. Marchesi wrote: > Hi Ihor. > Thanks for working on this! :) > > > [...] > > Older versions compile the dummy program without errors, however on > > attempt to build the selftests there is a different issue: conflicting > > int64 definitions (full log at [

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-02 Thread Jose E. Marchesi via Gcc
> On Thursday, January 2nd, 2025 at 1:47 AM, Jose E. Marchesi > wrote: > >> Hi Ihor. >> Thanks for working on this! :) >> >> > [...] >> > Older versions compile the dummy program without errors, however on >> > attempt to build the selftests there is a different issue: conflicting >> > int64 d

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-02 Thread Ihor Solodrai via Gcc
On Thursday, January 2nd, 2025 at 1:47 AM, Jose E. Marchesi wrote: > Hi Ihor. > Thanks for working on this! :) > > > [...] > > Older versions compile the dummy program without errors, however on > > attempt to build the selftests there is a different issue: conflicting > > int64 definitions (fu

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2025-01-02 Thread Jose E. Marchesi via Gcc
Hi Ihor. Thanks for working on this! :) > [...] > Older versions compile the dummy program without errors, however on > attempt to build the selftests there is a different issue: conflicting > int64 definitions (full log at [6]). > > In file included from /usr/include/x86_64-linux-gnu/sys/ty

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2024-12-30 Thread Alexei Starovoitov via Gcc
On Mon, Dec 30, 2024 at 5:26 PM Ihor Solodrai wrote: > > > > > > > #if STDC_VERSION < 202311L > > > enum { > > > false = 0, > > > true = 1, > > > }; > > > #endif > > > > > > Any drawbacks to this? > > > > > > By special hacking this specific enum in bpftool ? > > Feels like overkill when just addi

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2024-12-30 Thread Ihor Solodrai via Gcc
On Monday, December 30th, 2024 at 4:42 PM, Alexei Starovoitov wrote: > > > On Mon, Dec 30, 2024 at 12:59 PM Ihor Solodrai ihor.solod...@pm.me wrote: > > > On Monday, December 30th, 2024 at 12:36 PM, Sam James s...@gentoo.org wrote: > > > > > Andrew Pinski via Gcc gcc@gcc.gnu.org writes: > >

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2024-12-30 Thread Alexei Starovoitov via Gcc
On Mon, Dec 30, 2024 at 12:59 PM Ihor Solodrai wrote: > > On Monday, December 30th, 2024 at 12:36 PM, Sam James wrote: > > > > > > > Andrew Pinski via Gcc gcc@gcc.gnu.org writes: > > > > > On Mon, Dec 30, 2024 at 12:11 PM Ihor Solodrai via Gcc gcc@gcc.gnu.org > > > wrote: > > > > > > > Hello eve

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2024-12-30 Thread Sam James via Gcc
Ihor Solodrai writes: > On Monday, December 30th, 2024 at 12:36 PM, Sam James wrote: > >> > >> > >> Andrew Pinski via Gcc gcc@gcc.gnu.org writes: >> > >> > On Mon, Dec 30, 2024 at 12:11 PM Ihor Solodrai via Gcc gcc@gcc.gnu.org >> > wrote: >> > > >> > > Hello everyone. >> > > > >> > > I pic

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2024-12-30 Thread Ihor Solodrai via Gcc
On Monday, December 30th, 2024 at 12:36 PM, Sam James wrote: > > > Andrew Pinski via Gcc gcc@gcc.gnu.org writes: > > > On Mon, Dec 30, 2024 at 12:11 PM Ihor Solodrai via Gcc gcc@gcc.gnu.org > > wrote: > > > > > Hello everyone. > > > > > > I picked up the work adding GCC BPF backend to BPF C

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2024-12-30 Thread Sam James via Gcc
Andrew Pinski via Gcc writes: > On Mon, Dec 30, 2024 at 12:11 PM Ihor Solodrai via Gcc > wrote: >> >> Hello everyone. >> >> I picked up the work adding GCC BPF backend to BPF CI pipeline [1], >> originally done by Cupertino Miranda [2]. >> >> I encountered issues compiling BPF objects for selft

Re: Errors compiling BPF programs from Linux selftests/bpf with GCC

2024-12-30 Thread Andrew Pinski via Gcc
On Mon, Dec 30, 2024 at 12:11 PM Ihor Solodrai via Gcc wrote: > > Hello everyone. > > I picked up the work adding GCC BPF backend to BPF CI pipeline [1], > originally done by Cupertino Miranda [2]. > > I encountered issues compiling BPF objects for selftests/bpf with > recent GCC 15 snapshots. An

Errors compiling BPF programs from Linux selftests/bpf with GCC

2024-12-30 Thread Ihor Solodrai via Gcc
Hello everyone. I picked up the work adding GCC BPF backend to BPF CI pipeline [1], originally done by Cupertino Miranda [2]. I encountered issues compiling BPF objects for selftests/bpf with recent GCC 15 snapshots. An additional test runner binary is supposed to be generated by tools/testing/se