From: Viktor Malik on
gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1612...
@dzickusrh @hertonrk-rh I'd suggest applying one more patch (in addition to
the above quoting change) to `samples/bpf/Makefile`:
```diff
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 4ccf4236031c..140c58959b07 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -150,6 +150,9 @@ always-y += ibumad_kern.o
always-y += hbm_out_kern.o
always-y += hbm_edt_kern.o
+TPROGS_CFLAGS += $(TPROGS_USER_CFLAGS)
+TPROGS_LDFLAGS += $(TPROGS_USER_LDFLAGS)
+
ifeq ($(ARCH), arm)
# Strip all except -D__LINUX_ARM_ARCH__ option needed to handle linux
# headers when arm instruction set identification is requested.
@@ -312,7 +315,7 @@ XDP_SAMPLE_CFLAGS += -Wall -O2 \
-I$(LIBBPF_INCLUDE) \
-I$(src)/../../tools/testing/selftests/bpf
-$(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS = $(XDP_SAMPLE_CFLAGS)
+$(obj)/$(XDP_SAMPLE): TPROGS_CFLAGS = $(XDP_SAMPLE_CFLAGS)
$(TPROGS_USER_CFLAGS)
$(obj)/$(XDP_SAMPLE): $(src)/xdp_sample_user.h $(src)/xdp_sample_shared.h
-include $(BPF_SAMPLES_PATH)/Makefile.target
```
and then updating this specfile change to:
```suggestion:-0+0
%{make} %{?_smp_mflags} TPROGS_USER_CFLAGS="%{?build_hostcflags}"
TPROGS_USER_LDFLAGS="%{?build_hostldflags}"
EXTRA_CFLAGS="%{?build_hostcflags}"
EXTRA_LDFLAGS="%{?build_hostldflags}"
ARCH=$Arch V=1 M=samples/bpf/ VMLINUX_H="${RPM_VMLINUX_H}" || true
```
The `EXTRA_CFLAGS`/`EXTRA_LDFLAGS` setting should resolve the remaining -fPIE
error for libbpf.a.
@dzickusrh could you give this a try?