openwrt-cghmn-mt300n/package/network/utils/xdp-tools/patches/022-xdp-dump-add-missing-perf_event-include-for-bpf-and-.patch
Christian Marangi 5acc4f919c
xdp-tools: fix compilation wrongly using host header
Currently it's needed to have gcc-multilib on the host to correctly
compile xdp-tools. This is wrong and means that we are using host header
to compile a tool.

By some searching in how the makefile works it was discovered that
BPF_CFLAGS were not used and required to be appended to config.mk

Only one single header was added but we should include each BPF_CFLAGS
from bpf.mk. To make this some patching to bpf-header were required and
some patches to xdp-tools were required.
Also it's needed to pass the correct target to BPF_CFLAGS.

With the following changes xdp-tools can correctly compile with each
header from bpf-headers and should not use any host header.

Co-Developed-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Andre Heider <a.heider@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/11825
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2024-05-01 19:11:34 +02:00

35 lines
1.1 KiB
Diff

From 0388d7447de027e0d2369d6b8a9c58ea0f8f027c Mon Sep 17 00:00:00 2001
From: Christian Marangi <ansuelsmth@gmail.com>
Date: Wed, 18 Jan 2023 20:37:12 +0100
Subject: [PATCH] xdp-dump: add missing perf_event include for bpf and xdp
Add missing perf_event include needed for struct perf_event_header for
bpf and xdp.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
xdp-dump/xdpdump_bpf.c | 1 +
xdp-dump/xdpdump_xdp.c | 1 +
2 files changed, 2 insertions(+)
--- a/xdp-dump/xdpdump_bpf.c
+++ b/xdp-dump/xdpdump_bpf.c
@@ -4,6 +4,7 @@
* Include files
*****************************************************************************/
#include <stdbool.h>
+#include <linux/perf_event.h>
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_trace_helpers.h>
--- a/xdp-dump/xdpdump_xdp.c
+++ b/xdp-dump/xdpdump_xdp.c
@@ -4,6 +4,7 @@
* Include files
*****************************************************************************/
#include <stdbool.h>
+#include <linux/perf_event.h>
#include <linux/bpf.h>
#include <bpf/bpf_helpers.h>
#include <bpf/bpf_trace_helpers.h>