Re: [OS-BUILD PATCH] Fix binutils breakage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Viktor Malik on gitlab.com
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2749#note_1617578830

Argh, compiler/linker arguments in BPF Makefiles are sometimes a mess.

But, since the error occurs when linking `libbpf.a` for `samples/bpf/bpftool`,
let's take the same approach as we do for selftests and reuse the bpftool that
we've already built.

This will require one more patch to `samples/bpf/Makefile`:
```diff
diff --git a/samples/bpf/Makefile b/samples/bpf/Makefile
index 4ccf4236031c..ce9c2eea82d4 100644
--- a/samples/bpf/Makefile
+++ b/samples/bpf/Makefile
@@ -253,8 +253,9 @@ $(LIBBPF): $(wildcard $(LIBBPF_SRC)/*.[ch]
$(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU

 BPFTOOLDIR := $(TOOLS_PATH)/bpf/bpftool
 BPFTOOL_OUTPUT := $(abspath $(BPF_SAMPLES_PATH))/bpftool
-BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool
-$(BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) |
$(BPFTOOL_OUTPUT)
+DEFAULT_BPFTOOL := $(BPFTOOL_OUTPUT)/bootstrap/bpftool
+BPFTOOL ?= $(DEFAULT_BPFTOOL)
+$(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile) |
$(BPFTOOL_OUTPUT)
        $(MAKE) -C $(BPFTOOLDIR) srctree=$(BPF_SAMPLES_PATH)/../../
\
                OUTPUT=$(BPFTOOL_OUTPUT)/ bootstrap
```

and the specfile change:
```suggestion:-0+0
%{make} %{?_smp_mflags} TPROGS_USER_CFLAGS="%{?build_hostcflags}"
TPROGS_USER_LDFLAGS="%{?build_ldflags}"
BPFTOOL="$(pwd)/tools/bpf/bpftool/bpftool" ARCH=$Arch V=1 M=samples/bpf/
VMLINUX_H="${RPM_VMLINUX_H}" || true
```

This way, the samples successfully build for me. Unfortunately, rpmbuild fails
later when stripping the BPF programs `samples/bpf/*_kern.o` (another binutils
problem?), but we should be able to resolve that by just not stripping them.
_______________________________________________
kernel mailing list -- kernel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to kernel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/kernel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue




[Index of Archives]     [Fedora General Discussion]     [Older Fedora Users Archive]     [Fedora Advisory Board]     [Fedora Security]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [ATA RAID]     [Fedora Marketing]     [Fedora Mentors]     [Fedora Package Announce]     [Fedora Package Review]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Coolkey]     [Yum Users]     [Tux]     [Yosemite News]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [USB]     [Asterisk PBX]

  Powered by Linux