[DTrace-devel] [PATCH] bpf: compile BPF library functions with -ffreestanding
Sam James
sam at gentoo.org
Thu Jul 31 04:12:48 UTC 2025
Kris Van Hees via DTrace-devel <dtrace-devel at oss.oracle.com> writes:
> Per Jose, we should be compiling our BPF code with -ffreestanding to
> ensure that BPF-specific standard header files are used instead of
> host-specific ones.
Consider adding a link to https://gcc.gnu.org/PR121259 and
https://bugs.gentoo.org/959876.
Thanks -- it fixes the problem and it looks right.
Tested-by: Sam James <sam at gentoo.org>
Reviewed-by: Sam James <sam at gentoo.org>
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
> ---
> GNUmakefile | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/GNUmakefile b/GNUmakefile
> index b8e09f574..7ad857f88 100644
> --- a/GNUmakefile
> +++ b/GNUmakefile
> @@ -127,7 +127,7 @@ PREPROCESS = $(CC) -E
> export BPFC ?= bpf-unknown-none-gcc
>
> BPFCPPFLAGS += -D$(subst sparc64,__sparc,$(subst aarch64,__aarch64__,$(subst x86_64,__amd64,$(ARCH))))
> -BPFCFLAGS ?= -O2 -Wall -Wno-unknown-pragmas $(if $(HAVE_BPFV3),-mcpu=v3) $(if $(HAVE_BPFMASM),-masm=normal)
> +BPFCFLAGS ?= -O2 -Wall -Wno-unknown-pragmas $(if $(HAVE_BPFV3),-mcpu=v3) $(if $(HAVE_BPFMASM),-masm=normal) -ffreestanding
> export BPFLD ?= bpf-unknown-none-ld
>
> all::
More information about the DTrace-devel
mailing list