From 21182ec55dace9062be427c2ee583fd4027f899b Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Thu, 20 May 2021 06:42:46 -0700 Subject: bcc: Update to master tip In order to use latest clang, latest bcc sources are needed, this also means that we need to use vendored libbpf as thats the newest one needed and avoids dependencies on kernel bpf headers which maybe old and out of sync examples use error.h header which is not available on musl therefore disable examples when building on musl Signed-off-by: Khem Raj --- ...obe-function-blk_account_io_completion-to.patch | 169 --------------- ...dynamically-to-libclang-cpp-if-found-and-.patch | 68 ------ ...mpilation-issues-with-latest-llvm12-trunk.patch | 89 -------- ...noop-snoop-do_sys_openat2-for-kernel-v5.6.patch | 50 ----- ...s-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch | 239 --------------------- ...ompilation-error-with-latest-llvm12-trunk.patch | 60 ------ ...cc-no-libbpf-shared-library-change-libbcc.patch | 156 -------------- ...ok-for-either-static-or-dynamic-libraries.patch | 69 ------ .../recipes-devtools/bcc/bcc_0.17.0.bb | 61 ------ .../recipes-devtools/bcc/bcc_0.20.0.bb | 55 +++++ 10 files changed, 55 insertions(+), 961 deletions(-) delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Replace-kprobe-function-blk_account_io_completion-to.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0004-cmake-look-for-either-static-or-dynamic-libraries.patch delete mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.17.0.bb create mode 100644 dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.20.0.bb (limited to 'dynamic-layers') diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Replace-kprobe-function-blk_account_io_completion-to.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Replace-kprobe-function-blk_account_io_completion-to.patch deleted file mode 100644 index ef93296..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-Replace-kprobe-function-blk_account_io_completion-to.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 95c9229ea9f029a1b9e8dcbe86fc67f037c0dfa2 Mon Sep 17 00:00:00 2001 -From: Chen HaoNing -Date: Wed, 1 Jul 2020 15:49:17 -0500 -Subject: [PATCH] Replace kprobe function "blk_account_io_completion" to - "blk_account_io_done" for kernel version >= 5.8.0 - -The kernel function "blk_account_io_completion" is not available anymore as attach point of Kprobe as of kernel version 5.8.0. Therefore, after discussions, we decided to use function "blk_account_io_done" instead in every kprobe attachment to "blk_account_io_completion". - -Upstream-Status: Backport - ---- - docs/reference_guide.md | 4 ++-- - docs/tutorial_bcc_python_developer.md | 6 +++--- - examples/lua/kprobe-latency.lua | 2 +- - examples/tracing/bitehist.py | 2 +- - examples/tracing/disksnoop.py | 2 +- - tools/biosnoop.lua | 2 +- - tools/biosnoop.py | 2 +- - tools/biotop.py | 2 +- - tools/old/biosnoop.py | 2 +- - 9 files changed, 12 insertions(+), 12 deletions(-) - -diff --git a/docs/reference_guide.md b/docs/reference_guide.md -index 924fa203..9eaf27a5 100644 ---- a/docs/reference_guide.md -+++ b/docs/reference_guide.md -@@ -1784,7 +1784,7 @@ Example: - b = BPF(text=""" - BPF_HISTOGRAM(dist); - --int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req) -+int kprobe__blk_account_io_done(struct pt_regs *ctx, struct request *req) - { - dist.increment(bpf_log2l(req->__data_len / 1024)); - return 0; -@@ -1835,7 +1835,7 @@ Example: - b = BPF(text=""" - BPF_HISTOGRAM(dist); - --int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req) -+int kprobe__blk_account_io_done(struct pt_regs *ctx, struct request *req) - { - dist.increment(req->__data_len / 1024); - return 0; -diff --git a/docs/tutorial_bcc_python_developer.md b/docs/tutorial_bcc_python_developer.md -index 0cb0e780..b3b8ed6b 100644 ---- a/docs/tutorial_bcc_python_developer.md -+++ b/docs/tutorial_bcc_python_developer.md -@@ -220,7 +220,7 @@ void trace_completion(struct pt_regs *ctx, struct request *req) { - - b.attach_kprobe(event="blk_start_request", fn_name="trace_start") - b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_start") --b.attach_kprobe(event="blk_account_io_completion", fn_name="trace_completion") -+b.attach_kprobe(event="blk_account_io_done", fn_name="trace_completion") - [...] - ``` - -@@ -351,7 +351,7 @@ b = BPF(text=""" - - BPF_HISTOGRAM(dist); - --int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req) -+int kprobe__blk_account_io_done(struct pt_regs *ctx, struct request *req) - { - dist.increment(bpf_log2l(req->__data_len / 1024)); - return 0; -@@ -374,7 +374,7 @@ b["dist"].print_log2_hist("kbytes") - A recap from earlier lessons: - - - ```kprobe__```: This prefix means the rest will be treated as a kernel function name that will be instrumented using kprobe. --- ```struct pt_regs *ctx, struct request *req```: Arguments to kprobe. The ```ctx``` is registers and BPF context, the ```req``` is the first argument to the instrumented function: ```blk_account_io_completion()```. -+- ```struct pt_regs *ctx, struct request *req```: Arguments to kprobe. The ```ctx``` is registers and BPF context, the ```req``` is the first argument to the instrumented function: ```blk_account_io_done()```. - - ```req->__data_len```: Dereferencing that member. - - New things to learn: -diff --git a/examples/lua/kprobe-latency.lua b/examples/lua/kprobe-latency.lua -index 60ac2c1c..98464e5c 100644 ---- a/examples/lua/kprobe-latency.lua -+++ b/examples/lua/kprobe-latency.lua -@@ -30,7 +30,7 @@ local lat_map = bpf.map('array', bins) - local trace_start = bpf.kprobe('myprobe:blk_start_request', function (ptregs) - map[ptregs.parm1] = time() - end, false, -1, 0) --local trace_end = bpf.kprobe('myprobe2:blk_account_io_completion', function (ptregs) -+local trace_end = bpf.kprobe('myprobe2:blk_account_io_done', function (ptregs) - -- The lines below are computing index - -- using log10(x)*10 = log2(x)*10/log2(10) = log2(x)*3 - -- index = 29 ~ 1 usec -diff --git a/examples/tracing/bitehist.py b/examples/tracing/bitehist.py -index 4d7c7958..89ceb307 100755 ---- a/examples/tracing/bitehist.py -+++ b/examples/tracing/bitehist.py -@@ -25,7 +25,7 @@ b = BPF(text=""" - BPF_HISTOGRAM(dist); - BPF_HISTOGRAM(dist_linear); - --int kprobe__blk_account_io_completion(struct pt_regs *ctx, struct request *req) -+int kprobe__blk_account_io_done(struct pt_regs *ctx, struct request *req) - { - dist.increment(bpf_log2l(req->__data_len / 1024)); - dist_linear.increment(req->__data_len / 1024); -diff --git a/examples/tracing/disksnoop.py b/examples/tracing/disksnoop.py -index 1101e6f2..a35e1abd 100755 ---- a/examples/tracing/disksnoop.py -+++ b/examples/tracing/disksnoop.py -@@ -46,7 +46,7 @@ void trace_completion(struct pt_regs *ctx, struct request *req) { - if BPF.get_kprobe_functions(b'blk_start_request'): - b.attach_kprobe(event="blk_start_request", fn_name="trace_start") - b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_start") --b.attach_kprobe(event="blk_account_io_completion", fn_name="trace_completion") -+b.attach_kprobe(event="blk_account_io_done", fn_name="trace_completion") - - # header - print("%-18s %-2s %-7s %8s" % ("TIME(s)", "T", "BYTES", "LAT(ms)")) -diff --git a/tools/biosnoop.lua b/tools/biosnoop.lua -index 8d9b6a19..3e0441e2 100755 ---- a/tools/biosnoop.lua -+++ b/tools/biosnoop.lua -@@ -126,7 +126,7 @@ return function(BPF, utils) - bpf:attach_kprobe{event="blk_account_io_start", fn_name="trace_pid_start"} - bpf:attach_kprobe{event="blk_start_request", fn_name="trace_req_start"} - bpf:attach_kprobe{event="blk_mq_start_request", fn_name="trace_req_start"} -- bpf:attach_kprobe{event="blk_account_io_completion", -+ bpf:attach_kprobe{event="blk_account_io_done", - fn_name="trace_req_completion"} - - print("%-14s %-14s %-6s %-7s %-2s %-9s %-7s %7s" % {"TIME(s)", "COMM", "PID", -diff --git a/tools/biosnoop.py b/tools/biosnoop.py -index ff9b842b..5bbc77cd 100755 ---- a/tools/biosnoop.py -+++ b/tools/biosnoop.py -@@ -160,7 +160,7 @@ b.attach_kprobe(event="blk_account_io_start", fn_name="trace_pid_start") - if BPF.get_kprobe_functions(b'blk_start_request'): - b.attach_kprobe(event="blk_start_request", fn_name="trace_req_start") - b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_req_start") --b.attach_kprobe(event="blk_account_io_completion", -+b.attach_kprobe(event="blk_account_io_done", - fn_name="trace_req_completion") - - # header -diff --git a/tools/biotop.py b/tools/biotop.py -index cad3759a..d3a42ef7 100755 ---- a/tools/biotop.py -+++ b/tools/biotop.py -@@ -178,7 +178,7 @@ b.attach_kprobe(event="blk_account_io_start", fn_name="trace_pid_start") - if BPF.get_kprobe_functions(b'blk_start_request'): - b.attach_kprobe(event="blk_start_request", fn_name="trace_req_start") - b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_req_start") --b.attach_kprobe(event="blk_account_io_completion", -+b.attach_kprobe(event="blk_account_io_done", - fn_name="trace_req_completion") - - print('Tracing... Output every %d secs. Hit Ctrl-C to end' % interval) -diff --git a/tools/old/biosnoop.py b/tools/old/biosnoop.py -index 37ee3f9c..847ab91b 100755 ---- a/tools/old/biosnoop.py -+++ b/tools/old/biosnoop.py -@@ -98,7 +98,7 @@ int trace_req_completion(struct pt_regs *ctx, struct request *req) - b.attach_kprobe(event="blk_account_io_start", fn_name="trace_pid_start") - b.attach_kprobe(event="blk_start_request", fn_name="trace_req_start") - b.attach_kprobe(event="blk_mq_start_request", fn_name="trace_req_start") --b.attach_kprobe(event="blk_account_io_completion", -+b.attach_kprobe(event="blk_account_io_done", - fn_name="trace_req_completion") - - # header --- -2.17.1 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch deleted file mode 100644 index 74b2e27..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch +++ /dev/null @@ -1,68 +0,0 @@ -From f14f69d996ffc1c61dd523b839271d4a51328e4d Mon Sep 17 00:00:00 2001 -From: Luca Boccassi -Date: Fri, 1 Jan 2021 19:04:37 +0000 -Subject: [PATCH 1/3] cmake: link dynamically to libclang-cpp if found and - ENABLE_LLVM_SHARED is set - -ENABLE_LLVM_SHARED allows to dynamically link against libLLVM, but -libclang is still unconditionally linked statically. -Search for libclang-cpp.so, and if it is found and ENABLE_LLVM_SHARED -is set dynamically link against it. -Also expand the libstdc++ static linking check to include this new -condition. ---- - CMakeLists.txt | 1 + - cmake/clang_libs.cmake | 4 ++++ - cmake/static_libstdc++.cmake | 2 +- - 3 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 74fe4f19..b2e334e9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -76,6 +76,7 @@ find_library(libclangRewrite NAMES clangRewrite clang-cpp HINTS ${CLANG_SEARCH}) - find_library(libclangSema NAMES clangSema clang-cpp HINTS ${CLANG_SEARCH}) - find_library(libclangSerialization NAMES clangSerialization clang-cpp HINTS ${CLANG_SEARCH}) - find_library(libclangASTMatchers NAMES clangASTMatchers clang-cpp HINTS ${CLANG_SEARCH}) -+find_library(libclang-shared libclang-cpp.so HINTS ${CLANG_SEARCH}) - if(libclangBasic STREQUAL "libclangBasic-NOTFOUND") - message(FATAL_ERROR "Unable to find clang libraries") - endif() -diff --git a/cmake/clang_libs.cmake b/cmake/clang_libs.cmake -index c33b635c..3f1523b7 100644 ---- a/cmake/clang_libs.cmake -+++ b/cmake/clang_libs.cmake -@@ -26,6 +26,9 @@ llvm_map_components_to_libnames(_llvm_libs ${llvm_raw_libs}) - llvm_expand_dependencies(llvm_libs ${_llvm_libs}) - endif() - -+if(ENABLE_LLVM_SHARED AND NOT libclang-shared STREQUAL "libclang-shared-NOTFOUND") -+set(clang_libs ${libclang-shared}) -+else() - # order is important - set(clang_libs - ${libclangFrontend} -@@ -46,6 +49,7 @@ list(APPEND clang_libs - ${libclangAST} - ${libclangLex} - ${libclangBasic}) -+endif() - - # prune unused llvm static library stuff when linking into the new .so - set(_exclude_flags) -diff --git a/cmake/static_libstdc++.cmake b/cmake/static_libstdc++.cmake -index 3c8ac179..787ed9ad 100644 ---- a/cmake/static_libstdc++.cmake -+++ b/cmake/static_libstdc++.cmake -@@ -1,7 +1,7 @@ - # only turn on static-libstdc++ if also linking statically against clang - string(REGEX MATCH ".*[.]a$" LIBCLANG_ISSTATIC "${libclangBasic}") - # if gcc 4.9 or higher is used, static libstdc++ is a good option --if (CMAKE_COMPILER_IS_GNUCC AND LIBCLANG_ISSTATIC) -+if (CMAKE_COMPILER_IS_GNUCC AND LIBCLANG_ISSTATIC AND (NOT ENABLE_LLVM_SHARED OR libclang-shared STREQUAL "libclang-shared-NOTFOUND")) - execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION) - if (GCC_VERSION VERSION_GREATER 4.9 OR GCC_VERSION VERSION_EQUAL 4.9) - execute_process(COMMAND ${CMAKE_C_COMPILER} -print-libgcc-file-name OUTPUT_VARIABLE GCC_LIB) --- -2.29.2 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch deleted file mode 100644 index b1f56e6..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-fix-compilation-issues-with-latest-llvm12-trunk.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 675fca6a646812361c16884ccd2ff789f40c4ce8 Mon Sep 17 00:00:00 2001 -From: Yonghong Song -Date: Tue, 3 Nov 2020 22:11:57 -0800 -Subject: [PATCH 1/2] fix compilation issues with latest llvm12 trunk -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -With latest llvm12 trunk, we got two compilation bugs. - -Bug #1: - /home/yhs/work/bcc/src/cc/frontends/clang/b_frontend_action.cc: - In member function ‘void ebpf::BFrontendAction::DoMiscWorkAround()’: - /home/yhs/work/bcc/src/cc/frontends/clang/b_frontend_action.cc:1706:31: - error: ‘class clang::SourceManage’ has no member named ‘getBuffer’; did you mean ‘getBufferData’? - rewriter_->getSourceMgr().getBuffer(rewriter_->getSourceMgr().getMainFileID())->getBufferSize(), - ^~~~~~~~~ - getBufferData - - This is due to upstream change https://reviews.llvm.org/D89394. - To fix, follow upstream examples in https://reviews.llvm.org/D89394. - -Bug #2: - /home/yhs/work/bcc/src/cc/bpf_module.cc: In member function ‘int ebpf::BPFModule::finalize()’: - /home/yhs/work/bcc/src/cc/bpf_module.cc:470:11: - error: ‘class llvm::EngineBuilder’ has no member named ‘setUseOrcMCJITReplacement’ - builder.setUseOrcMCJITReplacement(false); - ^~~~~~~~~~~~~~~~~~~~~~~~~ - - This is due to upstream - https://github.com/llvm/llvm-project/commit/6154c4115cd4b78d0171892aac21e340e72e32bd - - It seems builder.setUseOrcMCJITReplacement() is not needed any more. So just remove it - from bcc. - -Signed-off-by: Yonghong Song ---- - src/cc/bpf_module.cc | 2 ++ - src/cc/bpf_module_rw_engine.cc | 2 ++ - src/cc/frontends/clang/b_frontend_action.cc | 4 ++++ - 3 files changed, 8 insertions(+) - -diff --git a/src/cc/bpf_module.cc b/src/cc/bpf_module.cc -index 8fba8d27..c194b815 100644 ---- a/src/cc/bpf_module.cc -+++ b/src/cc/bpf_module.cc -@@ -466,7 +466,9 @@ int BPFModule::finalize() { - builder.setErrorStr(&err); - builder.setMCJITMemoryManager(ebpf::make_unique(sections_p)); - builder.setMArch("bpf"); -+#if LLVM_MAJOR_VERSION <= 11 - builder.setUseOrcMCJITReplacement(false); -+#endif - engine_ = unique_ptr(builder.create()); - if (!engine_) { - fprintf(stderr, "Could not create ExecutionEngine: %s\n", err.c_str()); -diff --git a/src/cc/bpf_module_rw_engine.cc b/src/cc/bpf_module_rw_engine.cc -index d7e31a71..9890af69 100644 ---- a/src/cc/bpf_module_rw_engine.cc -+++ b/src/cc/bpf_module_rw_engine.cc -@@ -356,7 +356,9 @@ unique_ptr BPFModule::finalize_rw(unique_ptr m) { - string err; - EngineBuilder builder(move(m)); - builder.setErrorStr(&err); -+#if LLVM_MAJOR_VERSION <= 11 - builder.setUseOrcMCJITReplacement(false); -+#endif - auto engine = unique_ptr(builder.create()); - if (!engine) - fprintf(stderr, "Could not create ExecutionEngine: %s\n", err.c_str()); -diff --git a/src/cc/frontends/clang/b_frontend_action.cc b/src/cc/frontends/clang/b_frontend_action.cc -index 154a3794..80b03b9b 100644 ---- a/src/cc/frontends/clang/b_frontend_action.cc -+++ b/src/cc/frontends/clang/b_frontend_action.cc -@@ -1694,7 +1694,11 @@ void BFrontendAction::DoMiscWorkAround() { - false); - - rewriter_->getEditBuffer(rewriter_->getSourceMgr().getMainFileID()).InsertTextAfter( -+#if LLVM_MAJOR_VERSION >= 12 -+ rewriter_->getSourceMgr().getBufferOrFake(rewriter_->getSourceMgr().getMainFileID()).getBufferSize(), -+#else - rewriter_->getSourceMgr().getBuffer(rewriter_->getSourceMgr().getMainFileID())->getBufferSize(), -+#endif - "\n#include \n"); - } - --- -2.30.0 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch deleted file mode 100644 index fb659cc..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0001-tools-opensnoop-snoop-do_sys_openat2-for-kernel-v5.6.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 8e12b10e7576a6d47e0dc2cdc36caeb9ba26fa12 Mon Sep 17 00:00:00 2001 -From: He Zhe -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 ---- - tools/opensnoop.py | 12 ++++++++++-- - 1 file changed, 10 insertions(+), 2 deletions(-) - -diff --git a/tools/opensnoop.py b/tools/opensnoop.py -index 51d3dc05..522812d4 100755 ---- a/tools/opensnoop.py -+++ b/tools/opensnoop.py -@@ -22,6 +22,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: -@@ -235,8 +237,14 @@ if debug or args.ebpf: - # initialize BPF - b = BPF(text=bpf_text) - if not is_support_kfunc: -- 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.17.1 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch deleted file mode 100644 index 0269fa4..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch +++ /dev/null @@ -1,239 +0,0 @@ -From ab9a9dadf294f69e024a8b58c983a6c2085c223a Mon Sep 17 00:00:00 2001 -From: Luca Boccassi -Date: Fri, 8 Jan 2021 16:58:56 +0000 -Subject: [PATCH 2/3] cmake: always link to packaged libbpf if - CMAKE_USE_LIBBPF_PACKAGE is set (#3210) - -Some of the executables still link to the local static versions -even if the user requested CMAKE_USE_LIBBPF_PACKAGE. Fix this by -using bcc-shared-no-libbpf more widely if the variable is set. - -Skip the git submodule and the extraction commands if the user -set CMAKE_USE_LIBBPF_PACKAGE ---- - CMakeLists.txt | 2 +- - examples/cpp/CMakeLists.txt | 59 ++++++++---------------------- - examples/cpp/pyperf/CMakeLists.txt | 5 +++ - introspection/CMakeLists.txt | 8 +++- - src/cc/CMakeLists.txt | 29 ++++++++++----- - tests/cc/CMakeLists.txt | 22 +++++++---- - 6 files changed, 61 insertions(+), 64 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b2e334e9..b68571ea 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -14,7 +14,7 @@ endif() - enable_testing() - - # populate submodules (libbpf) --if(NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/libbpf/src) -+if(NOT CMAKE_USE_LIBBPF_PACKAGE AND NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/cc/libbpf/src) - execute_process(COMMAND git submodule update --init --recursive - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) - endif() -diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt -index dae0e9ce..dd343245 100644 ---- a/examples/cpp/CMakeLists.txt -+++ b/examples/cpp/CMakeLists.txt -@@ -11,49 +11,20 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") - - option(INSTALL_CPP_EXAMPLES "Install C++ examples. Those binaries are statically linked and can take plenty of disk space" OFF) - --add_executable(HelloWorld HelloWorld.cc) --target_link_libraries(HelloWorld bcc-static) -- --add_executable(CPUDistribution CPUDistribution.cc) --target_link_libraries(CPUDistribution bcc-static) -- --add_executable(RecordMySQLQuery RecordMySQLQuery.cc) --target_link_libraries(RecordMySQLQuery bcc-static) -- --add_executable(TCPSendStack TCPSendStack.cc) --target_link_libraries(TCPSendStack bcc-static) -- --add_executable(RandomRead RandomRead.cc) --target_link_libraries(RandomRead bcc-static) -- --add_executable(LLCStat LLCStat.cc) --target_link_libraries(LLCStat bcc-static) -- --add_executable(FollyRequestContextSwitch FollyRequestContextSwitch.cc) --target_link_libraries(FollyRequestContextSwitch bcc-static) -- --add_executable(UseExternalMap UseExternalMap.cc) --target_link_libraries(UseExternalMap bcc-static) -- --add_executable(CGroupTest CGroupTest.cc) --target_link_libraries(CGroupTest bcc-static) -- --add_executable(TaskIterator TaskIterator.cc) --target_link_libraries(TaskIterator bcc-static) -- --add_executable(SkLocalStorageIterator SkLocalStorageIterator.cc) --target_link_libraries(SkLocalStorageIterator bcc-static) -- --if(INSTALL_CPP_EXAMPLES) -- install (TARGETS HelloWorld DESTINATION share/bcc/examples/cpp) -- install (TARGETS CPUDistribution DESTINATION share/bcc/examples/cpp) -- install (TARGETS RecordMySQLQuery DESTINATION share/bcc/examples/cpp) -- install (TARGETS TCPSendStack DESTINATION share/bcc/examples/cpp) -- install (TARGETS RandomRead DESTINATION share/bcc/examples/cpp) -- install (TARGETS LLCStat DESTINATION share/bcc/examples/cpp) -- install (TARGETS FollyRequestContextSwitch DESTINATION share/bcc/examples/cpp) -- install (TARGETS UseExternalMap DESTINATION share/bcc/examples/cpp) -- install (TARGETS CGroupTest DESTINATION share/bcc/examples/cpp) --endif(INSTALL_CPP_EXAMPLES) -+file(GLOB EXAMPLES *.cc) -+foreach(EXAMPLE ${EXAMPLES}) -+ get_filename_component(NAME ${EXAMPLE} NAME_WE) -+ add_executable(${NAME} ${EXAMPLE}) -+ -+ if(NOT CMAKE_USE_LIBBPF_PACKAGE) -+ target_link_libraries(${NAME} bcc-static) -+ else() -+ target_link_libraries(${NAME} bcc-shared-no-libbpf) -+ endif() -+ -+ if(INSTALL_CPP_EXAMPLES) -+ install (TARGETS ${NAME} DESTINATION share/bcc/examples/cpp) -+ endif(INSTALL_CPP_EXAMPLES) -+endforeach() - - add_subdirectory(pyperf) -diff --git a/examples/cpp/pyperf/CMakeLists.txt b/examples/cpp/pyperf/CMakeLists.txt -index 6f963c66..97420806 100644 ---- a/examples/cpp/pyperf/CMakeLists.txt -+++ b/examples/cpp/pyperf/CMakeLists.txt -@@ -7,6 +7,11 @@ include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi) - - add_executable(PyPerf PyPerf.cc PyPerfUtil.cc PyPerfBPFProgram.cc PyPerfLoggingHelper.cc PyPerfDefaultPrinter.cc Py36Offsets.cc) - target_link_libraries(PyPerf bcc-static) -+if(NOT CMAKE_USE_LIBBPF_PACKAGE) -+ target_link_libraries(PyPerf bcc-static) -+else() -+ target_link_libraries(PyPerf bcc-shared-no-libbpf) -+endif() - - if(INSTALL_CPP_EXAMPLES) - install (TARGETS PyPerf DESTINATION share/bcc/examples/cpp) -diff --git a/introspection/CMakeLists.txt b/introspection/CMakeLists.txt -index 4328ee11..6c83f0c8 100644 ---- a/introspection/CMakeLists.txt -+++ b/introspection/CMakeLists.txt -@@ -8,7 +8,13 @@ include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi) - option(INSTALL_INTROSPECTION "Install BPF introspection tools" ON) - option(BPS_LINK_RT "Pass -lrt to linker when linking bps tool" ON) - --set(bps_libs_to_link bpf-static elf z) -+# Note that the order matters! bpf-static first, the rest later -+if(CMAKE_USE_LIBBPF_PACKAGE AND LIBBPF_FOUND) -+set(bps_libs_to_link bpf-shared ${LIBBPF_LIBRARIES}) -+else() -+set(bps_libs_to_link bpf-static) -+endif() -+list(APPEND bps_libs_to_link elf z) - if(BPS_LINK_RT) - list(APPEND bps_libs_to_link rt) - endif() -diff --git a/src/cc/CMakeLists.txt b/src/cc/CMakeLists.txt -index 4021c662..c8ea63aa 100644 ---- a/src/cc/CMakeLists.txt -+++ b/src/cc/CMakeLists.txt -@@ -10,8 +10,12 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/frontends/clang) - include_directories(${LLVM_INCLUDE_DIRS}) - include_directories(${LIBELF_INCLUDE_DIRS}) - # todo: if check for kernel version --include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include) --include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include/uapi) -+if (CMAKE_USE_LIBBPF_PACKAGE AND LIBBPF_FOUND) -+ include_directories(${LIBBPF_INCLUDE_DIRS}) -+else() -+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include) -+ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libbpf/include/uapi) -+endif() - - # add_definitions has a problem parsing "-D_GLIBCXX_USE_CXX11_ABI=0", this is safer - separate_arguments(LLVM_DEFINITIONS) -@@ -41,21 +45,26 @@ if(LIBBPF_INCLUDE_DIR) - add_definitions(-DHAVE_EXTERNAL_LIBBPF) - endif() - --if(LIBBPF_FOUND) -- set(extract_dir ${CMAKE_CURRENT_BINARY_DIR}/libbpf_a_extract) -- execute_process(COMMAND sh -c "mkdir -p ${extract_dir} && cd ${extract_dir} && ${CMAKE_AR} x ${LIBBPF_STATIC_LIBRARIES}") -- file(GLOB libbpf_sources "${extract_dir}/*.o") --else() -- file(GLOB libbpf_sources "libbpf/src/*.c") --endif() -+if(NOT CMAKE_USE_LIBBPF_PACKAGE) -+ if(LIBBPF_FOUND) -+ set(extract_dir ${CMAKE_CURRENT_BINARY_DIR}/libbpf_a_extract) -+ execute_process(COMMAND sh -c "mkdir -p ${extract_dir} && cd ${extract_dir} && ${CMAKE_AR} x ${LIBBPF_STATIC_LIBRARIES}") -+ file(GLOB libbpf_sources "${extract_dir}/*.o") -+ else() -+ file(GLOB libbpf_sources "libbpf/src/*.c") -+ endif() - --set(libbpf_uapi libbpf/include/uapi/linux/) -+ set(libbpf_uapi libbpf/include/uapi/linux/) -+endif() - - add_library(bpf-static STATIC libbpf.c perf_reader.c ${libbpf_sources}) - set_target_properties(bpf-static PROPERTIES OUTPUT_NAME bcc_bpf) - add_library(bpf-shared SHARED libbpf.c perf_reader.c ${libbpf_sources}) - set_target_properties(bpf-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0) - set_target_properties(bpf-shared PROPERTIES OUTPUT_NAME bcc_bpf) -+if(CMAKE_USE_LIBBPF_PACKAGE AND LIBBPF_FOUND) -+ target_link_libraries(bpf-shared ${LIBBPF_LIBRARIES}) -+endif() - - set(bcc_common_sources bcc_common.cc bpf_module.cc bcc_btf.cc exported_files.cc) - if (${LLVM_PACKAGE_VERSION} VERSION_EQUAL 6 OR ${LLVM_PACKAGE_VERSION} VERSION_GREATER 6) -diff --git a/tests/cc/CMakeLists.txt b/tests/cc/CMakeLists.txt -index 528f1bda..b2fba5e3 100644 ---- a/tests/cc/CMakeLists.txt -+++ b/tests/cc/CMakeLists.txt -@@ -7,7 +7,11 @@ include_directories(${CMAKE_SOURCE_DIR}/src/cc/libbpf/include/uapi) - include_directories(${CMAKE_SOURCE_DIR}/tests/python/include) - - add_executable(test_static test_static.c) --target_link_libraries(test_static bcc-static) -+if(NOT CMAKE_USE_LIBBPF_PACKAGE) -+ target_link_libraries(test_static bcc-static) -+else() -+ target_link_libraries(test_static bcc-shared-no-libbpf) -+endif() - - add_test(NAME c_test_static COMMAND ${TEST_WRAPPER} c_test_static sudo ${CMAKE_CURRENT_BINARY_DIR}/test_static) - -@@ -35,17 +39,19 @@ set(TEST_LIBBCC_SOURCES - utils.cc - test_parse_tracepoint.cc) - --add_executable(test_libbcc ${TEST_LIBBCC_SOURCES}) -- - file(COPY dummy_proc_map.txt DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) - add_library(usdt_test_lib SHARED usdt_test_lib.cc) - --add_dependencies(test_libbcc bcc-shared) --target_link_libraries(test_libbcc ${PROJECT_BINARY_DIR}/src/cc/libbcc.so dl usdt_test_lib) --set_target_properties(test_libbcc PROPERTIES INSTALL_RPATH ${PROJECT_BINARY_DIR}/src/cc) --target_compile_definitions(test_libbcc PRIVATE -DLIBBCC_NAME=\"libbcc.so\") -+if(NOT CMAKE_USE_LIBBPF_PACKAGE) -+ add_executable(test_libbcc ${TEST_LIBBCC_SOURCES}) -+ add_dependencies(test_libbcc bcc-shared) - --add_test(NAME test_libbcc COMMAND ${TEST_WRAPPER} c_test_all sudo ${CMAKE_CURRENT_BINARY_DIR}/test_libbcc) -+ target_link_libraries(test_libbcc ${PROJECT_BINARY_DIR}/src/cc/libbcc.so dl usdt_test_lib) -+ set_target_properties(test_libbcc PROPERTIES INSTALL_RPATH ${PROJECT_BINARY_DIR}/src/cc) -+ target_compile_definitions(test_libbcc PRIVATE -DLIBBCC_NAME=\"libbcc.so\") -+ -+ add_test(NAME test_libbcc COMMAND ${TEST_WRAPPER} c_test_all sudo ${CMAKE_CURRENT_BINARY_DIR}/test_libbcc) -+endif() - - if(LIBBPF_FOUND) - add_executable(test_libbcc_no_libbpf ${TEST_LIBBCC_SOURCES}) --- -2.29.2 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch deleted file mode 100644 index ded9f28..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0002-fix-compilation-error-with-latest-llvm12-trunk.patch +++ /dev/null @@ -1,60 +0,0 @@ -From 35ff839b1b70b3cd7a9a025d0fd96173e7be566e Mon Sep 17 00:00:00 2001 -From: Yonghong Song -Date: Mon, 4 Jan 2021 19:09:20 -0800 -Subject: [PATCH 2/2] fix compilation error with latest llvm12 trunk -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -With latest llvm trunk (llvm12), I hit the following compilation -error: - ... - [ 17%] Building CXX object src/cc/frontends/b/CMakeFiles/b_frontend.dir/codegen_llvm.cc.o - /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc: In member function - ‘virtual ebpf::StatusTuple ebpf::cc::CodegenLLVM::visit_table_decl_stmt_node(ebpf::cc::TableDeclStmtNode*)’: - /home/yhs/work/bcc/src/cc/frontends/b/codegen_llvm.cc:1122:37: - error: ‘class llvm::Module’ has no member named ‘getTypeB yName’; did you mean ‘getName’? - StructType *decl_struct = mod_->getTypeByName("_struct." + n->id_->name_); - ^~~~~~~~~~~~~ - getName - -This is due to llvm patch https://reviews.llvm.org/D78793 which -changed how to use getTypeByName(). This patch adjusted the usage -in bcc based on this patch. - -Signed-off-by: Yonghong Song ---- - src/cc/frontends/b/codegen_llvm.cc | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/src/cc/frontends/b/codegen_llvm.cc b/src/cc/frontends/b/codegen_llvm.cc -index d8c9470a..71c83b41 100644 ---- a/src/cc/frontends/b/codegen_llvm.cc -+++ b/src/cc/frontends/b/codegen_llvm.cc -@@ -1119,7 +1119,11 @@ StatusTuple CodegenLLVM::visit_table_decl_stmt_node(TableDeclStmtNode *n) { - StructType *key_stype, *leaf_stype; - TRY2(lookup_struct_type(n->key_type_, &key_stype)); - TRY2(lookup_struct_type(n->leaf_type_, &leaf_stype)); -+#if LLVM_MAJOR_VERSION >= 12 -+ StructType *decl_struct = StructType::getTypeByName(mod_->getContext(), "_struct." + n->id_->name_); -+#else - StructType *decl_struct = mod_->getTypeByName("_struct." + n->id_->name_); -+#endif - if (!decl_struct) - decl_struct = StructType::create(ctx(), "_struct." + n->id_->name_); - if (decl_struct->isOpaque()) -@@ -1182,7 +1186,11 @@ StatusTuple CodegenLLVM::visit_func_decl_stmt_node(FuncDeclStmtNode *n) { - StructType *stype; - //TRY2(lookup_struct_type(formal, &stype)); - auto var = (StructVariableDeclStmtNode *)formal; -+#if LLVM_MAJOR_VERSION >= 12 -+ stype = StructType::getTypeByName(mod_->getContext(), "_struct." + var->struct_id_->name_); -+#else - stype = mod_->getTypeByName("_struct." + var->struct_id_->name_); -+#endif - if (!stype) return mkstatus_(n, "could not find type %s", var->struct_id_->c_str()); - formals.push_back(PointerType::getUnqual(stype)); - } else { --- -2.30.0 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch deleted file mode 100644 index 25e744f..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch +++ /dev/null @@ -1,156 +0,0 @@ -From c7509c9e6377a374ca28d73960d505e129aace7b Mon Sep 17 00:00:00 2001 -From: Luca Boccassi -Date: Fri, 8 Jan 2021 17:04:03 +0000 -Subject: [PATCH 3/3] Remove libbcc-no-libbpf shared library, change libbcc - linkage instead - -The current upstream split does not work very well, as the SONAME is mangled so -nothing recognises it. Applications link against libbcc, not libbcc_no_bpf. -Remove it entirely, and switch the libbcc.so to dynamically -link with libbpf if CMAKE_USE_LIBBPF_PACKAGE is set. ---- - examples/cpp/CMakeLists.txt | 2 +- - examples/cpp/pyperf/CMakeLists.txt | 2 +- - src/cc/CMakeLists.txt | 36 +++++++++++++----------------- - tests/cc/CMakeLists.txt | 8 +++---- - 4 files changed, 21 insertions(+), 27 deletions(-) - -diff --git a/examples/cpp/CMakeLists.txt b/examples/cpp/CMakeLists.txt -index dd343245..45b30280 100644 ---- a/examples/cpp/CMakeLists.txt -+++ b/examples/cpp/CMakeLists.txt -@@ -19,7 +19,7 @@ foreach(EXAMPLE ${EXAMPLES}) - if(NOT CMAKE_USE_LIBBPF_PACKAGE) - target_link_libraries(${NAME} bcc-static) - else() -- target_link_libraries(${NAME} bcc-shared-no-libbpf) -+ target_link_libraries(${NAME} bcc-shared) - endif() - - if(INSTALL_CPP_EXAMPLES) -diff --git a/examples/cpp/pyperf/CMakeLists.txt b/examples/cpp/pyperf/CMakeLists.txt -index 97420806..618b4e75 100644 ---- a/examples/cpp/pyperf/CMakeLists.txt -+++ b/examples/cpp/pyperf/CMakeLists.txt -@@ -10,7 +10,7 @@ target_link_libraries(PyPerf bcc-static) - if(NOT CMAKE_USE_LIBBPF_PACKAGE) - target_link_libraries(PyPerf bcc-static) - else() -- target_link_libraries(PyPerf bcc-shared-no-libbpf) -+ target_link_libraries(PyPerf bcc-shared) - endif() - - if(INSTALL_CPP_EXAMPLES) -diff --git a/src/cc/CMakeLists.txt b/src/cc/CMakeLists.txt -index c8ea63aa..931de2d9 100644 ---- a/src/cc/CMakeLists.txt -+++ b/src/cc/CMakeLists.txt -@@ -83,6 +83,9 @@ set(bcc_sym_sources bcc_syms.cc bcc_elf.c bcc_perf_map.c bcc_proc.c) - set(bcc_common_headers libbpf.h perf_reader.h "${CMAKE_CURRENT_BINARY_DIR}/bcc_version.h") - set(bcc_table_headers file_desc.h table_desc.h table_storage.h) - set(bcc_api_headers bcc_common.h bpf_module.h bcc_exception.h bcc_syms.h bcc_proc.h bcc_elf.h) -+if(LIBBPF_FOUND) -+ set(bcc_common_sources ${bcc_common_sources} libbpf.c perf_reader.c) -+endif() - - if(ENABLE_CLANG_JIT) - add_library(bcc-shared SHARED -@@ -91,16 +94,6 @@ add_library(bcc-shared SHARED - set_target_properties(bcc-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0) - set_target_properties(bcc-shared PROPERTIES OUTPUT_NAME bcc) - --# If there's libbpf detected we build the libbcc-no-libbpf.so library, that --# dynamicaly links libbpf.so, in comparison to static link in libbcc.so. --if(LIBBPF_FOUND) -- add_library(bcc-shared-no-libbpf SHARED -- link_all.cc ${bcc_common_sources} ${bcc_table_sources} ${bcc_sym_sources} -- ${bcc_util_sources} libbpf.c perf_reader.c) -- set_target_properties(bcc-shared-no-libbpf PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0) -- set_target_properties(bcc-shared-no-libbpf PROPERTIES OUTPUT_NAME bcc-no-libbpf) --endif() -- - if(ENABLE_USDT) - set(bcc_usdt_sources usdt/usdt.cc usdt/usdt_args.cc) - # else undefined -@@ -123,18 +116,25 @@ set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${llvm_lib_exclude_f - set(bcc_common_libs b_frontend clang_frontend - -Wl,--whole-archive ${clang_libs} ${llvm_libs} -Wl,--no-whole-archive - ${LIBELF_LIBRARIES}) --set(bcc_common_libs_for_a ${bcc_common_libs} bpf-static) --set(bcc_common_libs_for_s ${bcc_common_libs} bpf-static) --set(bcc_common_libs_for_n ${bcc_common_libs}) --set(bcc_common_libs_for_lua b_frontend clang_frontend bpf-static -+set(bcc_common_libs_for_a ${bcc_common_libs}) -+set(bcc_common_libs_for_s ${bcc_common_libs}) -+set(bcc_common_libs_for_lua b_frontend clang_frontend - ${clang_libs} ${llvm_libs} ${LIBELF_LIBRARIES}) -+if(LIBBPF_FOUND) -+ list(APPEND bcc_common_libs_for_a ${LIBBPF_LIBRARIES}) -+ list(APPEND bcc_common_libs_for_s ${LIBBPF_LIBRARIES}) -+ list(APPEND bcc_common_libs_for_lua ${LIBBPF_LIBRARIES}) -+else() -+ list(APPEND bcc_common_libs_for_a bpf-static) -+ list(APPEND bcc_common_libs_for_s bpf-static) -+ list(APPEND bcc_common_libs_for_lua bpf-static) -+endif() - - if(ENABLE_CPP_API) - add_subdirectory(api) - list(APPEND bcc_common_libs_for_a api-static) - # Keep all API functions - list(APPEND bcc_common_libs_for_s -Wl,--whole-archive api-static -Wl,--no-whole-archive) -- list(APPEND bcc_common_libs_for_n -Wl,--whole-archive api-static -Wl,--no-whole-archive) - endif() - - if(ENABLE_USDT) -@@ -142,7 +142,6 @@ if(ENABLE_USDT) - add_subdirectory(usdt) - list(APPEND bcc_common_libs_for_a usdt-static) - list(APPEND bcc_common_libs_for_s usdt-static) -- list(APPEND bcc_common_libs_for_n usdt-static) - list(APPEND bcc_common_libs_for_lua usdt-static) - endif() - -@@ -153,11 +152,6 @@ target_link_libraries(bcc-shared ${bcc_common_libs_for_s}) - target_link_libraries(bcc-static ${bcc_common_libs_for_a} bcc-loader-static) - set(bcc-lua-static ${bcc-lua-static} ${bcc_common_libs_for_lua}) - --if(LIBBPF_FOUND) -- target_link_libraries(bcc-shared-no-libbpf ${bcc_common_libs_for_n} ${LIBBPF_LIBRARIES}) -- install(TARGETS bcc-shared-no-libbpf LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) --endif() -- - install(TARGETS bcc-shared bcc-static bcc-loader-static bpf-static LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - install(FILES ${bcc_table_headers} DESTINATION include/bcc) - install(FILES ${bcc_api_headers} DESTINATION include/bcc) -diff --git a/tests/cc/CMakeLists.txt b/tests/cc/CMakeLists.txt -index b2fba5e3..58493248 100644 ---- a/tests/cc/CMakeLists.txt -+++ b/tests/cc/CMakeLists.txt -@@ -10,7 +10,7 @@ add_executable(test_static test_static.c) - if(NOT CMAKE_USE_LIBBPF_PACKAGE) - target_link_libraries(test_static bcc-static) - else() -- target_link_libraries(test_static bcc-shared-no-libbpf) -+ target_link_libraries(test_static bcc-shared) - endif() - - add_test(NAME c_test_static COMMAND ${TEST_WRAPPER} c_test_static sudo ${CMAKE_CURRENT_BINARY_DIR}/test_static) -@@ -55,11 +55,11 @@ endif() - - if(LIBBPF_FOUND) - add_executable(test_libbcc_no_libbpf ${TEST_LIBBCC_SOURCES}) -- add_dependencies(test_libbcc_no_libbpf bcc-shared-no-libbpf) -+ add_dependencies(test_libbcc_no_libbpf bcc-shared) - -- target_link_libraries(test_libbcc_no_libbpf ${PROJECT_BINARY_DIR}/src/cc/libbcc-no-libbpf.so dl usdt_test_lib ${LIBBPF_LIBRARIES}) -+ target_link_libraries(test_libbcc_no_libbpf ${PROJECT_BINARY_DIR}/src/cc/libbcc.so dl usdt_test_lib ${LIBBPF_LIBRARIES}) - set_target_properties(test_libbcc_no_libbpf PROPERTIES INSTALL_RPATH ${PROJECT_BINARY_DIR}/src/cc) -- target_compile_definitions(test_libbcc_no_libbpf PRIVATE -DLIBBCC_NAME=\"libbcc-no-libbpf.so\") -+ target_compile_definitions(test_libbcc_no_libbpf PRIVATE -DLIBBCC_NAME=\"libbcc.so\") - - add_test(NAME test_libbcc_no_libbpf COMMAND ${TEST_WRAPPER} c_test_all_no_libbpf sudo ${CMAKE_CURRENT_BINARY_DIR}/test_libbcc_no_libbpf) - endif() --- -2.29.2 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0004-cmake-look-for-either-static-or-dynamic-libraries.patch b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0004-cmake-look-for-either-static-or-dynamic-libraries.patch deleted file mode 100644 index 31bcbcd..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc/0004-cmake-look-for-either-static-or-dynamic-libraries.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 6b4222cd41b3f5e833307aeff2b10c6b084d3f4f Mon Sep 17 00:00:00 2001 -From: Matteo Croce -Date: Wed, 27 Jan 2021 00:26:39 +0100 -Subject: [PATCH] cmake: look for either static or dynamic libraries - -On some distro, static libraries are shipped in a separate package. -Look for either a static or dynamic libbpf, and only fail if neither is found. ---- - cmake/FindLibBpf.cmake | 23 ++++++++++++++++------- - 1 file changed, 16 insertions(+), 7 deletions(-) - -diff --git a/cmake/FindLibBpf.cmake b/cmake/FindLibBpf.cmake -index 75683ae3d..dc10dcee4 100644 ---- a/cmake/FindLibBpf.cmake -+++ b/cmake/FindLibBpf.cmake -@@ -28,9 +28,9 @@ find_path (LIBBPF_INCLUDE_DIR - /sw/include - ENV CPATH) - --find_library (LIBBPF_STATIC_LIBRARIES -+find_library (LIBBPF_LIBRARIES - NAMES -- libbpf.a -+ bpf - PATHS - /usr/lib - /usr/local/lib -@@ -38,10 +38,13 @@ find_library (LIBBPF_STATIC_LIBRARIES - /sw/lib - ENV LIBRARY_PATH - ENV LD_LIBRARY_PATH) -+if(LIBBPF_LIBRARIES) -+list(APPEND PATHS LIBBPF_LIBRARIES) -+endif() - --find_library (LIBBPF_LIBRARIES -+find_library (LIBBPF_STATIC_LIBRARIES - NAMES -- bpf -+ libbpf.a - PATHS - /usr/lib - /usr/local/lib -@@ -49,13 +52,19 @@ find_library (LIBBPF_LIBRARIES - /sw/lib - ENV LIBRARY_PATH - ENV LD_LIBRARY_PATH) -+if(LIBBPF_STATIC_LIBRARIES) -+list(APPEND PATHS LIBBPF_STATIC_LIBRARIES) -+endif() - -+if(LIBBPF_STATIC_LIBRARIES OR LIBBPF_LIBRARIES) - include (FindPackageHandleStandardArgs) - - # handle the QUIETLY and REQUIRED arguments and set LIBBPF_FOUND to TRUE if all listed variables are TRUE - FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBpf "Please install the libbpf development package" -- LIBBPF_LIBRARIES -- LIBBPF_STATIC_LIBRARIES -+ ${PATHS} - LIBBPF_INCLUDE_DIR) - --mark_as_advanced(LIBBPF_INCLUDE_DIR LIBBPF_STATIC_LIBRARIES LIBBPF_LIBRARIES) -+mark_as_advanced(LIBBPF_INCLUDE_DIR ${PATHS}) -+else() -+message(Please install the libbpf development package) -+endif() --- -2.29.2 - diff --git a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.17.0.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.17.0.bb deleted file mode 100644 index 8953fd4..0000000 --- a/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.17.0.bb +++ /dev/null @@ -1,61 +0,0 @@ -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 \ - " - -LUAJIT ?= "luajit" -LUAJIT_powerpc64le = "" -LUAJIT_powerpc64 = "" - -RDEPENDS_${PN} += "bash python3 python3-core python3-setuptools xz" - -# Don't fetch submodules otherwise we fetch an older, vendored libbpf version -# We use a dynamic libbpf library instead -SRC_URI = "git://github.com/iovisor/bcc \ - file://0001-python-CMakeLists.txt-Remove-check-for-host-etc-debi.patch \ - file://0001-tools-trace.py-Fix-failing-to-exit.patch \ - file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \ - file://0001-fix-compilation-issues-with-latest-llvm12-trunk.patch \ - file://0002-fix-compilation-error-with-latest-llvm12-trunk.patch \ - file://0001-cmake-link-dynamically-to-libclang-cpp-if-found-and-.patch \ - file://0002-cmake-always-link-to-packaged-libbpf-if-CMAKE_USE_LI.patch \ - file://0003-Remove-libbcc-no-libbpf-shared-library-change-libbcc.patch \ - file://0004-cmake-look-for-either-static-or-dynamic-libraries.patch \ - " - -DEPENDS += "libbpf" - -SRCREV = "ad5b82a5196b222ed2cdc738d8444e8c9546a77f" - -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} \ - -DCMAKE_USE_LIBBPF_PACKAGE=ON \ -" - -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/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.20.0.bb b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.20.0.bb new file mode 100644 index 0000000..1c24555 --- /dev/null +++ b/dynamic-layers/openembedded-layer/recipes-devtools/bcc/bcc_0.20.0.bb @@ -0,0 +1,55 @@ +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 \ + " + +LUAJIT ?= "luajit" +LUAJIT_powerpc64le = "" +LUAJIT_powerpc64 = "" + +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-trace.py-Fix-failing-to-exit.patch \ + file://0001-CMakeLists.txt-override-the-PY_CMD_ESCAPED.patch \ + " + +SRCREV = "ab14fafec3fc13f89bd4678b7fc94829dcacaa7b" + +PV .= "+git${SRCPV}" + +S = "${WORKDIR}/git" + +PACKAGECONFIG ??= "examples" +PACKAGECONFIG_remove_libc-musl = "examples" + +PACKAGECONFIG[manpages] = "-DENABLE_MAN=ON,-DENABLE_MAN=OFF," +PACKAGECONFIG[examples] = "-DENABLE_EXAMPLES=ON,-DENABLE_EXAMPLES=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" -- cgit v1.2.3-54-g00ecf