Skip to content

Commit

Permalink
cmake: Make libbcc_bpf.so the BCC runtime
Browse files Browse the repository at this point in the history
This commit adds more functionality into libbcc_bpf.so such that
libbcc_bpf.so contains all of BCC's runtime components. "Runtime" in
this context means everything except the stuff that depends on
clang/LLVM.

libbcc_bpf.so was originally created in fa07345 ("make libbpf
standalone-ready") with (I'm guessing) the intent of creating
bcc-libbpf. That has been superceded by libbpf (separate repo) so I
don't think it should be used much anymore.

This updated libbcc_bpf.so will be used by ahead-of-time compiled
bpftrace scripts[0] to drop the dependency on LLVM/clang for the runtime
component.

[0]: https://dxuuu.xyz/aot-bpftrace.html
  • Loading branch information
danobi authored and yonghong-song committed Jul 1, 2021
1 parent 9686dcb commit 7191918
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/cc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,17 @@ set_target_properties(bcc-static PROPERTIES OUTPUT_NAME bcc)
set(bcc-lua-static
${bcc_common_sources} ${bcc_table_sources} ${bcc_sym_sources} ${bcc_util_sources})

add_library(bpf-static STATIC libbpf.c perf_reader.c ${libbpf_sources})
set(bpf_sources libbpf.c perf_reader.c ${libbpf_sources} ${bcc_sym_sources} ${bcc_util_sources} ${bcc_usdt_sources})
add_library(bpf-static STATIC ${bpf_sources})
set_target_properties(bpf-static PROPERTIES OUTPUT_NAME bcc_bpf)
add_library(bpf-shared SHARED libbpf.c perf_reader.c ${libbpf_sources})
target_link_libraries(bpf-static elf z)
add_library(bpf-shared SHARED ${bpf_sources})
set_target_properties(bpf-shared PROPERTIES VERSION ${REVISION_LAST} SOVERSION 0)
set_target_properties(bpf-shared PROPERTIES OUTPUT_NAME bcc_bpf)
target_link_libraries(bpf-shared elf z)
if(LIBDEBUGINFOD_FOUND)
target_link_libraries(bpf-shared ${LIBDEBUGINFOD_LIBRARIES})
endif(LIBDEBUGINFOD_FOUND)
if(CMAKE_USE_LIBBPF_PACKAGE AND LIBBPF_FOUND)
target_link_libraries(bpf-shared ${LIBBPF_LIBRARIES})
endif()
Expand Down

0 comments on commit 7191918

Please sign in to comment.