[DTrace-devel] [PATCH 2/4] bpf: add check for -masm=normal BPFC option

Kris Van Hees kris.van.hees at oracle.com
Fri May 24 23:57:25 UTC 2024


Newer BPF gcc cross compilers expect assembler instructions in pseudoc
syntax rather than normal syntax by default.  Those versions support
the -masm=normal option, so we test for that and use that option when
mneeded.

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 GNUmakefile | 2 +-
 Makeconfig  | 1 +
 configure   | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/GNUmakefile b/GNUmakefile
index 7d1af564..360058c6 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 $(if $(HAVE_BPFV3),-mcpu=v3)
+BPFCFLAGS ?= -O2 -Wall -Wno-unknown-pragmas $(if $(HAVE_BPFV3),-mcpu=v3) $(if $(HAVE_BPFMASM),-masm=normal)
 export BPFLD ?= bpf-unknown-none-ld
 
 all::
diff --git a/Makeconfig b/Makeconfig
index 87a601c8..f3d47c08 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -231,6 +231,7 @@ $(eval $(call check-header-rule,DIS4,disassembler(0,0,0,NULL),disasm))
 $(eval $(call check-header-rule,INITDISINFO3,init_disassemble_info(NULL,NULL,NULL),disasm))
 $(eval $(call check-header-rule,INITDISINFO4,init_disassemble_info(NULL,NULL,NULL,NULL),disasm))
 $(eval $(call check-bpfc-option-rule,BPFV3,-mcpu=v3))
+$(eval $(call check-bpfc-option-rule,BPFMASM,-masm=normal))
 
 help-overrides::
 	printf "\n" >&2
diff --git a/configure b/configure
index 40b870f8..c423bc82 100755
--- a/configure
+++ b/configure
@@ -163,6 +163,7 @@ for option in "$@"; do
         HAVE_CLOSE_RANGE=*) write_config_var CLOSE_RANGE "$option";;
         HAVE_GETTID=*) write_config_var GETTID "$option";;
         HAVE_BPFV3=*) write_config_var BPFV3 "$option";;
+        HAVE_BPFMASM=*) write_config_var BPFMASM "$option";;
 	*) echo "Unknown option $option" >&2
            exit 1;;
     esac
-- 
2.42.0




More information about the DTrace-devel mailing list