[DTrace-devel] [PATCH 2/2] bpf: add check for -mcpu=v3 BPFC option
Nick Alcock
nick.alcock at oracle.com
Thu Feb 22 17:33:58 UTC 2024
On 22 Feb 2024, Kris Van Hees via DTrace-devel stated:
> Newer BPF gcc cross compilers emit instructions that older kernels do not
> support yet. Passing -mcpu=v3 disables using those instructions, but older
> BPF cross compilers do not support that option. Fortunately, those compilers
> also do not emit the newer instructions.
>
> Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
Given a renaming of the option to be BPFC-specific,
Reviewed-by: Nick Alcock <nick.alcock at oracle.com>
> ---
> GNUmakefile | 2 +-
> Makeconfig | 1 +
> configure | 1 +
> 3 files changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/GNUmakefile b/GNUmakefile
> index 97d55618..d967134f 100644
> --- a/GNUmakefile
> +++ b/GNUmakefile
> @@ -124,7 +124,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
> +BPFCFLAGS ?= -O2 -Wall -Wno-unknown-pragmas $(if $(HAVE_BPFV3),-mcpu=v3)
> export BPFLD = bpf-unknown-none-ld
>
> all::
> diff --git a/Makeconfig b/Makeconfig
> index 332e9519..0c1fad1a 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -229,6 +229,7 @@ $(eval $(call check-header-rule,DIS1,disassembler(NULL),dis-asm))
> $(eval $(call check-header-rule,DIS4,disassembler(0,0,0,NULL),dis-asm))
> $(eval $(call check-header-rule,INITDISINFO3,init_disassemble_info(NULL,NULL,NULL),dis-asm))
> $(eval $(call check-header-rule,INITDISINFO4,init_disassemble_info(NULL,NULL,NULL,NULL),dis-asm))
> +$(eval $(call check-gcc-option-rule,BPFV3,-mcpu=v3))
>
> help-overrides::
> printf "\n" >&2
> diff --git a/configure b/configure
> index d4e71914..312e2aa2 100755
> --- a/configure
> +++ b/configure
> @@ -162,6 +162,7 @@ for option in "$@"; do
> HAVE_FUSE_NUMA=*) write_config_var FUSE_NUMA "$option";;
> HAVE_CLOSE_RANGE=*) write_config_var CLOSE_RANGE "$option";;
> HAVE_GETTID=*) write_config_var GETTID "$option";;
> + HAVE_BPFV3=*) write_config_var BPFV3 "$option";;
> *) echo "Unknown option $option" >&2
> exit 1;;
> esac
--
NULL && (void)
More information about the DTrace-devel
mailing list