From: Shahab Vahedi <Shahab.Vahedi@synopsys.com>
To: "buildroot@buildroot.org" <buildroot@buildroot.org>
Cc: Shahab Vahedi <Shahab.Vahedi@synopsys.com>,
"linux-snps-arc@lists.infradead.org"
<linux-snps-arc@lists.infradead.org>
Subject: [PATCH] package/bpftool: add a patch to fix cross compilation
Date: Fri, 10 Jun 2022 13:22:00 +0000 [thread overview]
Message-ID: <9db25812-d433-99aa-74c7-d3fe5f3aa9e4@synopsys.com> (raw)
If on the host machine the "co-re" is supported, bpftool will
build a bootstrap version of itself as well. In that case, the
cross compilation can fail. This commit adds a patch to remedy
that. The fix that you see here is already upsteamed [1].
[1]
https://lore.kernel.org/bpf/165477661272.11342.13015777410417612477.git-patchwork-notify@kernel.org/T/#t
Signed-off-by: Shahab Vahedi <shahab@synopsys.com>
---
package/bpftool/0001-fix-bootsrap.patch | 32 +++++++++++++++++++++++++
1 file changed, 32 insertions(+)
create mode 100644 package/bpftool/0001-fix-bootsrap.patch
diff --git a/package/bpftool/0001-fix-bootsrap.patch b/package/bpftool/0001-fix-bootsrap.patch
new file mode 100644
index 0000000000..03f4231cca
--- /dev/null
+++ b/package/bpftool/0001-fix-bootsrap.patch
@@ -0,0 +1,32 @@
+This is an adapted version of an upstreamed patch [1], else it won't be
+possible to cross compile bpftool if "clang-bpf-co-re" feature is enabled.
+
+[1] bpftool: Fix bootstrapping during a cross compilation
+https://lore.kernel.org/bpf/8d297f0c-cfd0-ef6f-3970-6dddb3d9a87a@synopsys.com/t/#u
+--- bpftool-v6.8.0/src/Makefile
++++ bpftool-v6.8.0/src/Makefile
+@@ -51,7 +51,7 @@
+ $(LIBBPF_BOOTSTRAP): $(wildcard $(BPF_DIR)/*.[ch] $(BPF_DIR)/Makefile) | $(LIBBPF_BOOTSTRAP_OUTPUT)
+ $(Q)$(MAKE) -C $(BPF_DIR) OBJDIR=$(patsubst %/,%,$(LIBBPF_BOOTSTRAP_OUTPUT)) \
+ PREFIX=$(LIBBPF_BOOTSTRAP_DESTDIR:/=) \
+- ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD) $@ install_headers
++ ARCH= CROSS_COMPILE= CC=$(HOSTCC) LD=$(HOSTLD) AR=$(HOSTAR) $@ install_headers
+
+ $(LIBBPF_BOOTSTRAP_INTERNAL_HDRS): $(LIBBPF_BOOTSTRAP_HDRS_DIR)/%.h: $(BPF_DIR)/%.h | $(LIBBPF_BOOTSTRAP_HDRS_DIR)
+ $(call QUIET_INSTALL, $@)
+--- bpftool-v6.8.0/src/Makefile.include
++++ bpftool-v6.8.0/src/Makefile.include
+@@ -12,11 +12,13 @@
+ ifneq ($(LLVM),)
+ $(if $(findstring default,$(origin CC)),$(eval CC := clang$(LLVM_VERSION)))
+ $(if $(findstring default,$(origin LD)),$(eval LD := ld.lld$(LLVM_VERSION)))
++ HOSTAR ?= llvm-ar
+ HOSTCC ?= clang
+ HOSTLD ?= ld.lld
+ else
+ $(if $(findstring default,$(origin CC)),$(eval CC = $(CROSS_COMPILE)$(CC)))
+ $(if $(findstring default,$(origin LD)),$(eval LD = $(CROSS_COMPILE)$(LD)))
++ HOSTAR ?= ar
+ HOSTCC ?= gcc
+ HOSTLD ?= ld
+ endif
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
next reply other threads:[~2022-06-10 13:22 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-10 13:22 Shahab Vahedi [this message]
-- strict thread matches above, loose matches on Subject: below --
2022-06-10 13:33 [PATCH] package/bpftool: add a patch to fix cross compilation Shahab Vahedi
2022-06-10 13:06 Shahab Vahedi
2022-06-10 12:41 Shahab Vahedi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=9db25812-d433-99aa-74c7-d3fe5f3aa9e4@synopsys.com \
--to=shahab.vahedi@synopsys.com \
--cc=buildroot@buildroot.org \
--cc=linux-snps-arc@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox