Skip to content

Commit

Permalink
Adjust to build with llvm 17
Browse files Browse the repository at this point in the history
- PassManagerBuilder has been removed
- itaniumDemangle() API signature has changed
- update MAX_LLVM_MAJOR in CMakeLists.txt
- update bcc and libbpf submodules to their latest versions to allow
  building bcc with llvm 17

Signed-off-by: Khem Raj <[email protected]>
Signed-off-by: Viktor Malik <[email protected]>
  • Loading branch information
kraj authored and danobi committed Oct 2, 2023
1 parent 313eef9 commit 49d96fc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ else()
endif()

set(MIN_LLVM_MAJOR 6)
set(MAX_LLVM_MAJOR 16)
set(MAX_LLVM_MAJOR 17)

if((${LLVM_VERSION_MAJOR} VERSION_LESS ${MIN_LLVM_MAJOR}) OR (${LLVM_VERSION_MAJOR} VERSION_GREATER ${MAX_LLVM_MAJOR}))
message(SEND_ERROR "Unsupported LLVM version found via ${LLVM_INCLUDE_DIRS}: ${LLVM_VERSION_MAJOR}")
Expand Down
2 changes: 1 addition & 1 deletion bcc
Submodule bcc updated 72 files
+1 −1 .github/workflows/publish.yml
+24 −18 INSTALL.md
+31 −1 debian/changelog
+0 −2 docker/build/Dockerfile.ubuntu
+19 −0 docs/reference_guide.md
+13 −6 docs/tutorial_bcc_python_developer.md
+1 −1 examples/usdt_sample/usdt_sample.md
+1 −1 examples/usdt_sample/usdt_sample.sh
+1 −0 libbpf-tools/.gitignore
+1 −0 libbpf-tools/Makefile
+5 −4 libbpf-tools/biosnoop.bpf.c
+44 −8 libbpf-tools/biosnoop.c
+106 −0 libbpf-tools/core_fixes.bpf.h
+9 −7 libbpf-tools/cpufreq.c
+30 −8 libbpf-tools/funclatency.bpf.c
+70 −18 libbpf-tools/funclatency.c
+17 −1 libbpf-tools/maps.bpf.h
+95 −24 libbpf-tools/memleak.bpf.c
+188 −56 libbpf-tools/memleak.c
+1 −1 libbpf-tools/powerpc/vmlinux.h
+109,704 −100,447 libbpf-tools/powerpc/vmlinux_600.h
+1 −1 libbpf-tools/riscv/vmlinux.h
+122,511 −81,936 libbpf-tools/riscv/vmlinux_602.h
+325 −2 libbpf-tools/syscall_helpers.c
+9 −0 libbpf-tools/tcpconnlat.bpf.c
+142 −0 libbpf-tools/tcppktlat.bpf.c
+265 −0 libbpf-tools/tcppktlat.c
+19 −0 libbpf-tools/tcppktlat.h
+70 −0 libbpf-tools/tcppktlat_example.txt
+91 −62 libbpf-tools/tcprtt.bpf.c
+50 −9 libbpf-tools/tcprtt.c
+6 −0 libbpf-tools/tcprtt.h
+55 −2 libbpf-tools/trace_helpers.c
+1 −1 man/man8/klockstat.8
+1 −2 snap/snapcraft.yaml
+3 −3 src/cc/bcc_zip.c
+4 −0 src/cc/bpf_module.cc
+123 −18 src/cc/compat/linux/virtual_bpf.h
+13 −5 src/cc/export/helpers.h
+30 −17 src/cc/frontends/clang/b_frontend_action.cc
+1 −1 src/cc/libbpf
+103 −8 src/cc/libbpf.c
+12 −2 src/python/bcc/__init__.py
+10 −4 src/python/bcc/table.py
+1 −1 src/python/setup.py.in
+6 −0 tests/cc/test_zip.cc
+13 −10 tests/python/test_map_batch_ops.py
+43 −0 tests/python/test_ringbuf.py
+0 −1 tests/python/test_rlimit.py
+0 −1 tests/python/test_tools_smoke.py
+10 −8 tests/python/utils.py
+19 −1 tools/argdist.py
+21 −0 tools/argdist_example.txt
+48 −16 tools/cachestat.py
+46 −15 tools/cachetop.py
+7 −1 tools/cpuunclaimed.py
+1 −1 tools/deadlock.c
+8 −0 tools/deadlock.py
+4 −4 tools/funcslower.py
+1 −1 tools/klockstat.py
+2 −19 tools/kvmexit.py
+21 −6 tools/offcputime.py
+4 −2 tools/offcputime_example.txt
+3 −2 tools/offwaketime.py
+1 −1 tools/offwaketime_example.txt
+12 −1 tools/profile.py
+8 −3 tools/profile_example.txt
+8 −2 tools/runqlen.py
+4 −4 tools/statsnoop.py
+26 −21 tools/tcpstates.py
+7 −5 tools/wakeuptime.py
+1 −1 tools/wakeuptime_example.txt
2 changes: 1 addition & 1 deletion libbpf
Submodule libbpf updated 56 files
+1 −0 .gitattributes
+22 −4 .github/actions/build-selftests/build_selftests.sh
+84,023 −79,447 .github/actions/build-selftests/vmlinux.h
+6 −6 .github/actions/vmtest/action.yml
+1 −1 BPF-CHECKPOINT-COMMIT
+1 −1 CHECKPOINT-COMMIT
+1 −1 README.md
+281 −0 SYNC.md
+70 −0 ci/diffs/0001-s390-define-RUNTIME_DISCARD_EXIT-to-fix-link-error-w.patch
+37 −0 ci/diffs/0001-selftests-bpf-Check-whether-to-run-selftest.patch
+68 −0 ci/diffs/0001-tracing-fprobe-Initialize-ret-valiable-to-fix-smatch.patch
+83 −0 ci/diffs/0001-veth-take-into-account-peer-device-for-NETDEV_XDP_AC.patch
+0 −4 ci/vmtest/configs/ALLOWLIST-5.5.0
+2 −0 ci/vmtest/configs/DENYLIST-5.5.0
+4 −0 ci/vmtest/configs/DENYLIST-latest
+1 −0 ci/vmtest/configs/DENYLIST-latest.s390x
+10 −3 ci/vmtest/run_selftests.sh
+17 −8 docs/index.rst
+3 −3 docs/libbpf_naming_convention.rst
+228 −0 docs/libbpf_overview.rst
+158 −17 include/uapi/linux/bpf.h
+1 −0 include/uapi/linux/fcntl.h
+1 −0 include/uapi/linux/if_link.h
+61 −0 include/uapi/linux/netdev.h
+43 −0 include/uapi/linux/openat2.h
+3 −0 include/uapi/linux/perf_event.h
+3 −2 scripts/build-fuzzers.sh
+3 −1 scripts/sync-kernel.sh
+2 −2 src/Makefile
+58 −12 src/bpf.c
+111 −8 src/bpf.h
+2 −2 src/bpf_core_read.h
+3 −1 src/bpf_gen_internal.h
+41 −7 src/bpf_helper_defs.h
+120 −7 src/bpf_helpers.h
+290 −36 src/bpf_tracing.h
+6 −8 src/btf.c
+19 −3 src/btf_dump.c
+32 −30 src/gen_loader.c
+0 −10 src/hashmap.h
+837 −198 src/libbpf.c
+184 −28 src/libbpf.h
+15 −0 src/libbpf.map
+1 −0 src/libbpf_internal.h
+86 −0 src/libbpf_probes.c
+1 −1 src/libbpf_version.h
+15 −10 src/linker.c
+115 −11 src/netlink.c
+1 −1 src/nlattr.c
+12 −0 src/nlattr.h
+0 −3 src/relo_core.c
+2 −2 src/ringbuf.c
+4 −1 src/usdt.bpf.h
+125 −83 src/usdt.c
+333 −0 src/zip.c
+47 −0 src/zip.h
4 changes: 4 additions & 0 deletions src/ast/passes/codegen_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
#include <ctime>
#include <fstream>

#if LLVM_VERSION_MAJOR <= 16
#include <llvm-c/Transforms/IPO.h>
#endif
#include <llvm/IR/Constants.h>
#include <llvm/IR/LLVMContext.h>
#include <llvm/IR/LegacyPassManager.h>
Expand All @@ -17,7 +19,9 @@
#include <llvm/Passes/PassBuilder.h>
#endif
#include <llvm/Transforms/IPO.h>
#if LLVM_VERSION_MAJOR <= 16
#include <llvm/Transforms/IPO/PassManagerBuilder.h>
#endif
#if LLVM_VERSION_MAJOR >= 14
#include <llvm/MC/TargetRegistry.h>
#else
Expand Down
4 changes: 4 additions & 0 deletions src/cxxdemangler/cxxdemangler_llvm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ namespace bpftrace {

char* cxxdemangle(const char* mangled)
{
#if LLVM_VERSION_MAJOR <= 16
return llvm::itaniumDemangle(mangled, nullptr, nullptr, nullptr);
#else
return llvm::itaniumDemangle(mangled);
#endif
}

} // namespace bpftrace

0 comments on commit 49d96fc

Please sign in to comment.