diff --git a/bpftune-git/.SRCINFO b/bpftune-git/.SRCINFO index c87aa332..ac72c9d8 100644 --- a/bpftune-git/.SRCINFO +++ b/bpftune-git/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = bpftune-git pkgdesc = BPF/tracing tools for auto-tuning Linux - pkgver = r464.f2b5ba7 + pkgver = r545.870d466 pkgrel = 1 url = https://github.com/oracle-samples/bpftune arch = x86_64 @@ -17,9 +17,9 @@ pkgbase = bpftune-git provides = bpftune conflicts = bpftune options = strip - source = git+https://github.com/oracle-samples/bpftune - source = fix-makefile.patch + source = git+https://github.com/oracle/bpftune + source = makefile-tweaks.patch sha256sums = SKIP - sha256sums = e565afc2bc7bda439b49a73c5bc9719662684ee06d3bababcc2a7496b4723882 + sha256sums = 009a8a03d2b8fee5b06a4cb264d4c2966472e9a512af9a7cd91364cb0c2e11e8 pkgname = bpftune-git diff --git a/bpftune-git/PKGBUILD b/bpftune-git/PKGBUILD index 865560ef..e801f0df 100644 --- a/bpftune-git/PKGBUILD +++ b/bpftune-git/PKGBUILD @@ -1,28 +1,21 @@ # Maintainer: Kirill Fries-Raevskiy _pkgbase="bpftune" pkgname="$_pkgbase-git" -pkgver=r464.f2b5ba7 +pkgver=r545.870d466 pkgrel=1 pkgdesc="BPF/tracing tools for auto-tuning Linux" arch=("x86_64") url="https://github.com/oracle-samples/bpftune" license=('GPLv2 WITH Linux-syscall-note') -#groups=() depends=("libbpf" "libnl" "libcap") makedepends=('git' 'bpf' 'clang' 'llvm' 'llvm-libs' 'python-docutils') provides=("$_pkgbase") conflicts=("$_pkgbase") -#replaces=() -#backup=() options=('strip') -#install= -source=('git+https://github.com/oracle-samples/bpftune' - 'fix-makefile.patch') -#noextract=() +source=('git+https://github.com/oracle/bpftune' + 'makefile-tweaks.patch') sha256sums=('SKIP' - 'e565afc2bc7bda439b49a73c5bc9719662684ee06d3bababcc2a7496b4723882') - -CC=clang + '009a8a03d2b8fee5b06a4cb264d4c2966472e9a512af9a7cd91364cb0c2e11e8') pkgver() { cd "$_pkgbase" @@ -31,9 +24,8 @@ pkgver() { prepare() { cd "$srcdir/$_pkgbase" - patch -Np1 < ../fix-makefile.patch - sed -i 's/\/lib64/\/lib/' include/bpftune/libbpftune.h - sed -i 's/\/lib64/\/lib/g' src/Makefile + msg2 "Remove native march and use O3 flag" + patch -Np1 < ../makefile-tweaks.patch sed -i 's/\/sbin/\/bin/g' src/Makefile sed -i 's/\/sbin/\/bin/g' src/bpftune.service @@ -41,13 +33,11 @@ prepare() { build() { cd "$srcdir/$_pkgbase" - export CFLAGS="-march=x86-64 -mtune=generic" - export CXXLAGS="-march=x86-64 -mtune=generic" - make -j1 || true - make + export CC="clang" + make libdir=lib } package() { cd "$srcdir/$_pkgbase" - make DESTDIR="$pkgdir" install + make DESTDIR="$pkgdir" libdir=lib install } diff --git a/bpftune-git/fix-makefile.patch b/bpftune-git/fix-makefile.patch deleted file mode 100644 index 018a90a6..00000000 --- a/bpftune-git/fix-makefile.patch +++ /dev/null @@ -1,38 +0,0 @@ -diff --git a/sample_tuner/Makefile b/sample_tuner/Makefile -index 6161de3..82be56d 100644 ---- a/sample_tuner/Makefile -+++ b/sample_tuner/Makefile -@@ -37,7 +37,7 @@ installprefix = $(DESTDIR)/$(prefix) - - INSTALLPATH = $(installprefix) - --CFLAGS = -fPIC -Wall -Wextra -march=native -g -I../include -std=c99 -+CFLAGS = -fPIC -Wall -Wextra -march=x86-64 -g -I../include -std=c99 - - CFLAGS += -DBPFTUNE_VERSION='"$(BPFTUNE_VERSION)"' $(INCLUDES) - -diff --git a/src/Makefile b/src/Makefile -index bb662e3..2ed2b09 100644 ---- a/src/Makefile -+++ b/src/Makefile -@@ -55,7 +55,7 @@ endif - VERSION = 0.1.3 - VERSION_SCRIPT := libbpftune.map - --CFLAGS = -fPIC -Wall -Wextra -march=native -g -I../include -std=c99 -+CFLAGS = -fPIC -Wall -Wextra -march=x86-64 -g -I../include -std=c99 - - CFLAGS += -DBPFTUNE_VERSION='"$(BPFTUNE_VERSION)"' $(INCLUDES) - -diff --git a/test/strategy/Makefile b/test/strategy/Makefile -index 45150eb..9b40ba4 100644 ---- a/test/strategy/Makefile -+++ b/test/strategy/Makefile -@@ -38,7 +38,7 @@ installprefix = $(DESTDIR)/$(prefix) - - INSTALLPATH = $(installprefix) - --CFLAGS = -fPIC -Wall -Wextra -march=native -g -I../include -std=c99 -+CFLAGS = -fPIC -Wall -Wextra -march=x86-64 -g -I../include -std=c99 - - CFLAGS += -DBPFTUNE_VERSION='"$(BPFTUNE_VERSION)"' $(INCLUDES) diff --git a/bpftune-git/makefile-tweaks.patch b/bpftune-git/makefile-tweaks.patch new file mode 100644 index 00000000..d1d84498 --- /dev/null +++ b/bpftune-git/makefile-tweaks.patch @@ -0,0 +1,113 @@ +From 7bc3e12a172645e595ea87eda78b5d62c19235c4 Mon Sep 17 00:00:00 2001 +From: Eric Naim +Date: Thu, 21 Nov 2024 11:20:06 +0800 +Subject: [PATCH] Makefile: Remove native march and use O3 flag + +Signed-off-by: Eric Naim +--- + sample_tuner/Makefile | 10 +++++----- + src/Makefile | 12 ++++++------ + test/strategy/Makefile | 2 +- + 3 files changed, 12 insertions(+), 12 deletions(-) + +diff --git a/sample_tuner/Makefile b/sample_tuner/Makefile +index 2003543..5a8d824 100644 +--- a/sample_tuner/Makefile ++++ b/sample_tuner/Makefile +@@ -37,7 +37,7 @@ installprefix = $(DESTDIR)/$(prefix) + + INSTALLPATH = $(installprefix) + +-CFLAGS = -fPIC -Wall -Wextra -march=native -g -I../include -std=c99 ++CFLAGS = -fPIC -Wall -Wextra -O3 -g -I../include -std=c99 + + CFLAGS += -DBPFTUNE_VERSION='"$(BPFTUNE_VERSION)"' $(INCLUDES) + +@@ -69,7 +69,7 @@ BPF_SKELS = $(patsubst %,%.skel.h,$(TUNERS)) + .PHONY: clean + + all: $(TUNER_LIBS) +- ++ + clean: + $(Q)$(RM) *.o *.d *.so* + $(Q)$(RM) *.skel*.h +@@ -88,12 +88,12 @@ $(TUNER_LIBS): $(BPF_SKELS) $(TUNER_OBJS) + $(QUIET_GEN)$(BPFTOOL) gen skeleton $< > $@ + + $(BPF_OBJS): $(patsubst %.o,%.c,$(BPF_OBJS)) ../include/bpftune/bpftune.bpf.h +- $(CLANG) -g -D__TARGET_ARCH_$(SRCARCH) -O2 -target bpf \ ++ $(CLANG) -g -D__TARGET_ARCH_$(SRCARCH) -O3 -target bpf \ + $(INCLUDES) -c $(patsubst %.o,%.c,$(@)) -o $(@); +- $(CLANG) -g -D__TARGET_ARCH_$(SRCARCH) -DBPFTUNE_LEGACY -O2 -target bpf \ ++ $(CLANG) -g -D__TARGET_ARCH_$(SRCARCH) -DBPFTUNE_LEGACY -O3 -target bpf \ + $(INCLUDES) -c $(patsubst %.o,%.c,$(@)) \ + -o $(patsubst %.o,%.legacy.o,$(@)); +- $(CLANG) -g -D__TARGET_ARCH_$(SRCARCH) -DBPFTUNE_NOBTF -DBPFTUNE_LEGACY -O2 -target bpf \ ++ $(CLANG) -g -D__TARGET_ARCH_$(SRCARCH) -DBPFTUNE_NOBTF -DBPFTUNE_LEGACY -O3 -target bpf \ + $(INCLUDES) -c $(patsubst %.o,%.c,$(@)) \ + -o $(patsubst %.o,%.nobtf.o,$(@)); + +diff --git a/src/Makefile b/src/Makefile +index 7add159..c33faa0 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -56,7 +56,7 @@ endif + VERSION = 0.1.3 + VERSION_SCRIPT := libbpftune.map + +-CFLAGS = -fPIC -Wall -Wextra -g -I../include -std=c99 ++CFLAGS = -fPIC -Wall -Wextra -O3 -g -I../include -std=c99 + + CFLAGS += -DBPFTUNE_VERSION='"$(BPFTUNE_VERSION)"' \ + -DBPFTUNER_PREFIX_DIR='"$(prefix)"' \ +@@ -75,7 +75,7 @@ VMLINUX_BTF_PATH := $(or $(VMLINUX_BTF),$(firstword \ + + OPATH := + ifeq ($(SANITIZE),1) +-CFLAGS += -fsanitize=address ++CFLAGS += -fsanitize=address + OPATH := .sanitize/ + endif + +@@ -174,20 +174,20 @@ $(OPATH)bpftune.o: $(OPATH)libbpftune.so + # check if GCC_BPF flag is set, otherwise use CLANG + ifeq ($(GCC_BPF),) + $(BPF_OBJS): $(patsubst %.o,%.c,$(BPF_OBJS)) ../include/bpftune/bpftune.bpf.h +- $(CLANG) $(BPF_CFLAGS) -D__TARGET_ARCH_$(SRCARCH) -O2 -target bpf \ ++ $(CLANG) $(BPF_CFLAGS) -D__TARGET_ARCH_$(SRCARCH) -O3 -target bpf \ + $(INCLUDES) -c $(patsubst %.o,%.c,$(@)) -o $(@) + + $(LEGACY_BPF_OBJS): $(patsubst %.legacy.o,%.c,$(LEGACY_BPF_OBJS)) ../include/bpftune/bpftune.bpf.h +- $(CLANG) $(BPF_CFLAGS) -D__TARGET_ARCH_$(SRCARCH) -DBPFTUNE_LEGACY -O2 -target bpf \ ++ $(CLANG) $(BPF_CFLAGS) -D__TARGET_ARCH_$(SRCARCH) -DBPFTUNE_LEGACY -O3 -target bpf \ + $(INCLUDES) -c $(patsubst %.legacy.o,%.c,$(@)) \ + -o $(@) + + $(NOBTF_BPF_OBJS): $(patsubst %.nobtf.o,%.c,$(NOBTF_BPF_OBJS)) ../include/bpftune/bpftune.bpf.h +- $(CLANG) $(BPF_CFLAGS) -D__TARGET_ARCH_$(SRCARCH) -DBPFTUNE_NOBTF -O2 -target bpf \ ++ $(CLANG) $(BPF_CFLAGS) -D__TARGET_ARCH_$(SRCARCH) -DBPFTUNE_NOBTF -O3 -target bpf \ + $(INCLUDES) -c $(patsubst %.nobtf.o,%.c,$(@)) \ + -o $(@) + else +-GCC_BPF_FLAGS := -g -O2 \ ++GCC_BPF_FLAGS := -g -O3 \ + $(BPF_CFLAGS) -D__TARGET_ARCH_$(SRCARCH) \ + -gbtf -mcpu=v3 -Wno-error=attributes \ + -Wno-error=address-of-packed-member \ +diff --git a/test/strategy/Makefile b/test/strategy/Makefile +index f4783bb..95c91f6 100644 +--- a/test/strategy/Makefile ++++ b/test/strategy/Makefile +@@ -39,7 +39,7 @@ installprefix = $(DESTDIR)/$(prefix) + + INSTALLPATH = $(installprefix) + +-CFLAGS = -fPIC -Wall -Wextra -march=native -g -I../include -std=c99 ++CFLAGS = -fPIC -Wall -Wextra -O3 -g -I../include -std=c99 + + CFLAGS += -DBPFTUNE_VERSION='"$(BPFTUNE_VERSION)"' $(INCLUDES) + +-- +2.47.0 +