summaryrefslogtreecommitdiffstats
path: root/external/meta-clang/dynamic-layers/openembedded-layer
diff options
context:
space:
mode:
Diffstat (limited to 'external/meta-clang/dynamic-layers/openembedded-layer')
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch27
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch176
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch40
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch51
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb47
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb29
-rw-r--r--external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend3
7 files changed, 373 insertions, 0 deletions
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch
new file mode 100644
index 00000000..1ca73bae
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch
@@ -0,0 +1,27 @@
+From 9e2415679e41adacc59dd7a426d505232f0b7129 Mon Sep 17 00:00:00 2001
+From: William Findlay <william@williamfindlay.com>
+Date: Wed, 17 Jun 2020 12:07:48 -0400
+Subject: [PATCH 1/2] Add KBUILD_MODNAME flag to default cflags
+
+Upstream-Status: Backported [https://github.com/iovisor/bcc/pull/2974/commits/badd85c58549d0e7f0d536490c41213141e180c5]
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ src/cc/frontends/clang/kbuild_helper.cc | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/cc/frontends/clang/kbuild_helper.cc b/src/cc/frontends/clang/kbuild_helper.cc
+index db5ca7f6..e3aade89 100644
+--- a/src/cc/frontends/clang/kbuild_helper.cc
++++ b/src/cc/frontends/clang/kbuild_helper.cc
+@@ -101,6 +101,7 @@ int KBuildHelper::get_flags(const char *uname_machine, vector<string> *cflags) {
+ cflags->push_back("-D__HAVE_BUILTIN_BSWAP16__");
+ cflags->push_back("-D__HAVE_BUILTIN_BSWAP32__");
+ cflags->push_back("-D__HAVE_BUILTIN_BSWAP64__");
++ cflags->push_back("-DKBUILD_MODNAME=\"bcc\"");
+
+ // If ARCH env variable is set, pass this along.
+ if (archenv)
+--
+2.26.2
+
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch
new file mode 100644
index 00000000..dd879973
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Delete-existing-kbuild_modname-definitions.patch
@@ -0,0 +1,176 @@
+From eb8b0487a05d650499b20fdd5edeb6e47c2c17a5 Mon Sep 17 00:00:00 2001
+From: William Findlay <william@williamfindlay.com>
+Date: Wed, 17 Jun 2020 18:59:43 -0400
+Subject: [PATCH 2/2] Delete existing kbuild_modname definitions
+
+Upstream-Status: Backported [https://github.com/iovisor/bcc/pull/2974/commits/a5bdc9c65746389d7072e1e8e583025dde78e91b]
+
+Adjust context
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ examples/networking/xdp/xdp_drop_count.py | 1 -
+ examples/networking/xdp/xdp_macswap_count.py | 1 -
+ examples/networking/xdp/xdp_redirect_cpu.py | 1 -
+ examples/networking/xdp/xdp_redirect_map.py | 1 -
+ tests/python/test_clang.py | 8 --------
+ tools/tcplife.lua | 1 -
+ tools/tcplife.py | 1 -
+ tools/tcpstates.py | 1 -
+ 8 files changed, 15 deletions(-)
+
+diff --git a/examples/networking/xdp/xdp_drop_count.py b/examples/networking/xdp/xdp_drop_count.py
+index f03273e9..512e0a20 100755
+--- a/examples/networking/xdp/xdp_drop_count.py
++++ b/examples/networking/xdp/xdp_drop_count.py
+@@ -52,7 +52,6 @@ else:
+
+ # load BPF program
+ b = BPF(text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/bpf.h>
+ #include <linux/in.h>
+ #include <linux/if_ether.h>
+diff --git a/examples/networking/xdp/xdp_macswap_count.py b/examples/networking/xdp/xdp_macswap_count.py
+index 0e2b21ca..770ce8ca 100755
+--- a/examples/networking/xdp/xdp_macswap_count.py
++++ b/examples/networking/xdp/xdp_macswap_count.py
+@@ -50,7 +50,6 @@ else:
+
+ # load BPF program
+ b = BPF(text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/bpf.h>
+ #include <linux/in.h>
+ #include <linux/if_ether.h>
+diff --git a/examples/networking/xdp/xdp_redirect_cpu.py b/examples/networking/xdp/xdp_redirect_cpu.py
+index 15b0d09b..470079f4 100755
+--- a/examples/networking/xdp/xdp_redirect_cpu.py
++++ b/examples/networking/xdp/xdp_redirect_cpu.py
+@@ -30,7 +30,6 @@ if (cpu_id > max_cpu):
+
+ # load BPF program
+ b = BPF(text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/bpf.h>
+ #include <linux/in.h>
+ #include <linux/if_ether.h>
+diff --git a/examples/networking/xdp/xdp_redirect_map.py b/examples/networking/xdp/xdp_redirect_map.py
+index 4a622723..4936ac1e 100755
+--- a/examples/networking/xdp/xdp_redirect_map.py
++++ b/examples/networking/xdp/xdp_redirect_map.py
+@@ -29,7 +29,6 @@ out_idx = ip.link_lookup(ifname=out_if)[0]
+
+ # load BPF program
+ b = BPF(text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/bpf.h>
+ #include <linux/in.h>
+ #include <linux/if_ether.h>
+diff --git a/tests/python/test_clang.py b/tests/python/test_clang.py
+index 886eebed..648494cf 100755
+--- a/tests/python/test_clang.py
++++ b/tests/python/test_clang.py
+@@ -78,7 +78,6 @@ int count_foo(struct pt_regs *ctx, unsigned long a, unsigned long b) {
+
+ def test_probe_read3(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <net/tcp.h>
+ #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
+ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+@@ -90,7 +89,6 @@ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+
+ def test_probe_read4(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <net/tcp.h>
+ #define _(P) ({typeof(P) val = 0; bpf_probe_read(&val, sizeof(val), &P); val;})
+ int test(struct pt_regs *ctx, struct sk_buff *skb) {
+@@ -102,7 +100,6 @@ int test(struct pt_regs *ctx, struct sk_buff *skb) {
+
+ def test_probe_read_whitelist1(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <net/tcp.h>
+ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+ // The below define is in net/tcp.h:
+@@ -120,7 +117,6 @@ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+
+ def test_probe_read_whitelist2(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <net/tcp.h>
+ int count_tcp(struct pt_regs *ctx, struct sk_buff *skb) {
+ // The below define is in net/tcp.h:
+@@ -1072,7 +1068,6 @@ int test(struct __sk_buff *ctx) {
+
+ def test_probe_read_return(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/ptrace.h>
+ #include <linux/tcp.h>
+ static inline unsigned char *my_skb_transport_header(struct sk_buff *skb) {
+@@ -1088,7 +1083,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
+
+ def test_probe_read_multiple_return(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/ptrace.h>
+ #include <linux/tcp.h>
+ static inline u64 error_function() {
+@@ -1109,7 +1103,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
+
+ def test_probe_read_return_expr(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/ptrace.h>
+ #include <linux/tcp.h>
+ static inline unsigned char *my_skb_transport_header(struct sk_buff *skb) {
+@@ -1125,7 +1118,6 @@ int test(struct pt_regs *ctx, struct sock *sk, struct sk_buff *skb) {
+
+ def test_probe_read_return_call(self):
+ text = """
+-#define KBUILD_MODNAME "foo"
+ #include <uapi/linux/ptrace.h>
+ #include <linux/tcp.h>
+ static inline struct tcphdr *my_skb_transport_header(struct sk_buff *skb) {
+diff --git a/tools/tcplife.lua b/tools/tcplife.lua
+index 3f4f6afd..5e311631 100755
+--- a/tools/tcplife.lua
++++ b/tools/tcplife.lua
+@@ -25,7 +25,6 @@ uint16_t ntohs(uint16_t netshort);
+
+ local program = [[
+ #include <uapi/linux/ptrace.h>
+-#define KBUILD_MODNAME "foo"
+ #include <linux/tcp.h>
+ #include <net/sock.h>
+ #include <bcc/proto.h>
+diff --git a/tools/tcplife.py b/tools/tcplife.py
+index d4e679dd..c2bd8236 100755
+--- a/tools/tcplife.py
++++ b/tools/tcplife.py
+@@ -66,7 +66,6 @@ debug = 0
+ # define BPF program
+ bpf_text = """
+ #include <uapi/linux/ptrace.h>
+-#define KBUILD_MODNAME "foo"
+ #include <linux/tcp.h>
+ #include <net/sock.h>
+ #include <bcc/proto.h>
+diff --git a/tools/tcpstates.py b/tools/tcpstates.py
+index b9a64387..09bbe0ce 100755
+--- a/tools/tcpstates.py
++++ b/tools/tcpstates.py
+@@ -61,7 +61,6 @@ debug = 0
+ # define BPF program
+ bpf_text = """
+ #include <uapi/linux/ptrace.h>
+-#define KBUILD_MODNAME "foo"
+ #include <linux/tcp.h>
+ #include <net/sock.h>
+ #include <bcc/proto.h>
+--
+2.26.2
+
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch
new file mode 100644
index 00000000..4d71b15e
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch
@@ -0,0 +1,40 @@
+From cb3f032b55b32c50201862b26c76ea18ad37cb39 Mon Sep 17 00:00:00 2001
+From: Ovidiu Panait <ovidiu.panait@windriver.com>
+Date: Thu, 30 Jan 2020 14:19:33 +0200
+Subject: [PATCH] python/CMakeLists.txt: Remove check for host
+ /etc/debian_version
+
+Fix the following error that occurs during do_install when using the native
+version of python3:
+usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
+ or: setup.py --help [cmd1 cmd2 ...]
+ or: setup.py --help-commands
+ or: setup.py cmd --help
+
+error: option --install-layout not recognized
+
+Upstream-status: Innapropriate [oe-specific]
+
+Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
+---
+ src/python/CMakeLists.txt | 4 ----
+ 1 file changed, 4 deletions(-)
+
+diff --git a/src/python/CMakeLists.txt b/src/python/CMakeLists.txt
+index fa602397..797e0d14 100644
+--- a/src/python/CMakeLists.txt
++++ b/src/python/CMakeLists.txt
+@@ -5,10 +5,6 @@ if(NOT PYTHON_CMD)
+ set(PYTHON_CMD "python")
+ endif()
+
+-if(EXISTS "/etc/debian_version")
+- set(PYTHON_FLAGS "${PYTHON_FLAGS} --install-layout deb")
+-endif()
+-
+ file(GLOB_RECURSE PYTHON_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+ ${CMAKE_CURRENT_SOURCE_DIR}/*.py)
+ file(GLOB_RECURSE PYTHON_INCLUDES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
+--
+2.17.1
+
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch
new file mode 100644
index 00000000..f2b1495d
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch
@@ -0,0 +1,51 @@
+From 935f7e47f54df1af30f4a1cdfd2f385863ab9dec Mon Sep 17 00:00:00 2001
+From: He Zhe <zhe.he@windriver.com>
+Date: Mon, 15 Jun 2020 07:05:24 +0000
+Subject: [PATCH] tools: opensnoop: snoop do_sys_openat2 for kernel v5.6 and
+ later
+
+Since kernel v5.6, fddb5d430ad9 ("open: introduce openat2(2) syscall"),
+do_sys_openat2 instead of do_sys_open has been used as entry function for open.
+
+Upstream-Status: Inappropriate, upstream context has changed and needs more
+ tweak.
+
+Signed-off-by: He Zhe <zhe.he@windriver.com>
+---
+ tools/opensnoop.py | 13 +++++++++++--
+ 1 file changed, 11 insertions(+), 2 deletions(-)
+
+diff --git a/tools/opensnoop.py b/tools/opensnoop.py
+index 6d1388b3..3f7e48a3 100755
+--- a/tools/opensnoop.py
++++ b/tools/opensnoop.py
+@@ -21,6 +21,8 @@ from bcc.utils import printb
+ import argparse
+ from datetime import datetime, timedelta
+ import os
++import platform
++from pkg_resources import parse_version
+
+ # arguments
+ examples = """examples:
+@@ -195,8 +197,15 @@ if debug or args.ebpf:
+
+ # initialize BPF
+ b = BPF(text=bpf_text)
+-b.attach_kprobe(event="do_sys_open", fn_name="trace_entry")
+-b.attach_kretprobe(event="do_sys_open", fn_name="trace_return")
++
++# Since kernel v5.6, do_sys_openat2 instead of do_sys_open has been used as entry function for open
++if parse_version(platform.uname().release.split('-')[0]) > parse_version('5.6.0'):
++ entry = "do_sys_openat2"
++else:
++ entry = "do_sys_open"
++
++b.attach_kprobe(event=entry, fn_name="trace_entry")
++b.attach_kretprobe(event=entry, fn_name="trace_return")
+
+ initial_ts = 0
+
+--
+2.24.1
+
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb
new file mode 100644
index 00000000..5a628db4
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.13.0.bb
@@ -0,0 +1,47 @@
+SUMMARY = "BPF Compiler Collection (BCC)"
+HOMEPAGE = "https://github.com/iovisor/bcc"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e3fc50a88d0a364313df4b21ef20c29e"
+
+inherit cmake python3native manpages
+
+DEPENDS += "bison-native \
+ flex-native \
+ elfutils \
+ luajit \
+ clang \
+ "
+
+RDEPENDS_${PN} += "bash python3 python3-core python3-setuptools xz"
+
+SRC_URI = "gitsm://github.com/iovisor/bcc \
+ file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \
+ file://0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch \
+ file://0001-Add-KBUILD_MODNAME-flag-to-default-cflags.patch \
+ file://0001-Delete-existing-kbuild_modname-definitions.patch \
+ "
+
+SRCREV = "942227484d3207f6a42103674001ef01fb5335a0"
+
+S = "${WORKDIR}/git"
+
+PACKAGECONFIG ??= ""
+PACKAGECONFIG[manpages] = "-DENABLE_MAN=ON,-DENABLE_MAN=OFF,"
+
+EXTRA_OECMAKE = " \
+ -DENABLE_LLVM_SHARED=ON \
+ -DENABLE_CLANG_JIT=ON \
+ -DLLVM_PACKAGE_VERSION=${LLVMVERSION} \
+ -DPYTHON_CMD=${PYTHON} \
+ -DPYTHON_FLAGS=--install-lib=${PYTHON_SITEPACKAGES_DIR} \
+"
+
+do_install_append() {
+ sed -e 's@#!/usr/bin/python@#!/usr/bin/env python3@g' \
+ -i $(find ${D}${datadir}/${PN} -type f)
+}
+
+FILES_${PN} += "${PYTHON_SITEPACKAGES_DIR}"
+FILES_${PN}-doc += "${datadir}/${PN}/man"
+
+COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*)-linux"
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
new file mode 100644
index 00000000..ad044fd7
--- /dev/null
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-devtools/bpftrace/bpftrace_0.9.4.bb
@@ -0,0 +1,29 @@
+SUMMARY = "bpftrace"
+HOMEPAGE = "https://github.com/iovisor/bpftrace"
+LICENSE = "Apache-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
+
+DEPENDS += "bison-native \
+ flex-native \
+ gzip-native \
+ elfutils \
+ bcc \
+ "
+
+RDEPENDS_${PN} += "bash python3 xz"
+
+SRC_URI = "git://github.com/iovisor/bpftrace \
+ "
+SRCREV = "b1200771b61fd77ed7c5b326e7960d24514dd961"
+
+S = "${WORKDIR}/git"
+
+inherit cmake
+
+EXTRA_OECMAKE = " \
+ -DCMAKE_BUILD_TYPE=Release \
+ -DBUILD_TESTING=OFF \
+"
+
+COMPATIBLE_HOST = "(x86_64.*|aarch64.*|powerpc64.*)-linux"
+COMPATIBLE_HOST_libc-musl = "null"
diff --git a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend
index 53409624..a1d4585f 100644
--- a/external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend
+++ b/external/meta-clang/dynamic-layers/openembedded-layer/recipes-kernel/kernel-selftest/kernel-selftest.bbappend
@@ -1 +1,4 @@
DEPENDS_append = " clang-native"
+DEPENDS_remove = "llvm-native"
+
+EXCLUDE_FROM_WORLD_forcevariable = ""