Bring in latest changes from libbpf which allow to use btf__dedup() for big binaries (e.g., linux kernel image). This patch also changes CMakeLists.txt to build libbpf as shared library to satisfy libdwarves shared library compilation. Signed-off-by: Andrii Nakryiko <andriin@xxxxxx> --- CMakeLists.txt | 13 +++++++++---- lib/bpf | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cc383a..d6929b4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,9 +72,14 @@ if (NOT HAVE_REALLOCARRAY_SUPPORT) endif() file(GLOB libbpf_sources "lib/bpf/src/*.c") -add_library(bpf STATIC ${libbpf_sources}) -set_target_properties(bpf PROPERTIES OUTPUT_NAME bpf) -target_include_directories(bpf PRIVATE +add_library(bpf-static STATIC ${libbpf_sources}) +set_target_properties(bpf-static PROPERTIES OUTPUT_NAME bpf) +target_include_directories(bpf-static PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include + ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi) +add_library(bpf-shared SHARED ${libbpf_sources}) +set_target_properties(bpf-shared PROPERTIES OUTPUT_NAME bpf) +target_include_directories(bpf-shared PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include ${CMAKE_CURRENT_SOURCE_DIR}/lib/bpf/include/uapi) @@ -84,7 +89,7 @@ set(dwarves_LIB_SRCS dwarves.c dwarves_fprintf.c gobuffer strings add_library(dwarves SHARED ${dwarves_LIB_SRCS}) set_target_properties(dwarves PROPERTIES VERSION 1.0.0 SOVERSION 1) set_target_properties(dwarves PROPERTIES INTERFACE_LINK_LIBRARIES "") -target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES} bpf) +target_link_libraries(dwarves ${DWARF_LIBRARIES} ${ZLIB_LIBRARIES} bpf-shared) set(dwarves_emit_LIB_SRCS dwarves_emit.c) add_library(dwarves_emit SHARED ${dwarves_emit_LIB_SRCS}) diff --git a/lib/bpf b/lib/bpf index b19c6dc..d5fa415 160000 --- a/lib/bpf +++ b/lib/bpf @@ -1 +1 @@ -Subproject commit b19c6dcf623a7adc9e538ddbe2964c2f58dd2417 +Subproject commit d5fa4150f0c3a36e3ce458e1301531bd2edbf74d -- 2.17.1