dtrace.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf: compile BPF library functions with -ffreestanding
@ 2025-07-31  3:09 Kris Van Hees
  2025-07-31  3:44 ` Eugene Loh
  2025-07-31  4:12 ` [DTrace-devel] " Sam James
  0 siblings, 2 replies; 3+ messages in thread
From: Kris Van Hees @ 2025-07-31  3:09 UTC (permalink / raw)
  To: dtrace, dtrace-devel

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.

Signed-off-by: Kris Van Hees <kris.van.hees@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::
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bpf: compile BPF library functions with -ffreestanding
  2025-07-31  3:09 [PATCH] bpf: compile BPF library functions with -ffreestanding Kris Van Hees
@ 2025-07-31  3:44 ` Eugene Loh
  2025-07-31  4:12 ` [DTrace-devel] " Sam James
  1 sibling, 0 replies; 3+ messages in thread
From: Eugene Loh @ 2025-07-31  3:44 UTC (permalink / raw)
  To: Kris Van Hees, dtrace, dtrace-devel

Reviewed-by: Eugene Loh <eugene.loh@oracle.com>

On 7/30/25 23:09, Kris Van Hees wrote:
> 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.
>
> Signed-off-by: Kris Van Hees <kris.van.hees@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::

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [DTrace-devel] [PATCH] bpf: compile BPF library functions with -ffreestanding
  2025-07-31  3:09 [PATCH] bpf: compile BPF library functions with -ffreestanding Kris Van Hees
  2025-07-31  3:44 ` Eugene Loh
@ 2025-07-31  4:12 ` Sam James
  1 sibling, 0 replies; 3+ messages in thread
From: Sam James @ 2025-07-31  4:12 UTC (permalink / raw)
  To: Kris Van Hees via DTrace-devel; +Cc: dtrace, Kris Van Hees

Kris Van Hees via DTrace-devel <dtrace-devel@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@gentoo.org>
Reviewed-by: Sam James <sam@gentoo.org>

>
> Signed-off-by: Kris Van Hees <kris.van.hees@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::

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-07-31  4:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-31  3:09 [PATCH] bpf: compile BPF library functions with -ffreestanding Kris Van Hees
2025-07-31  3:44 ` Eugene Loh
2025-07-31  4:12 ` [DTrace-devel] " Sam James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).