diff --git a/.gitignore b/.gitignore index 8e683d7..5d4a553 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /029717bfd62265659993d5fc8e6847828b827fcb.tar.gz /c49b333c034a6d29a7ce90f565e27da1061af971.tar.gz +/v0.9.tar.gz diff --git a/bpftrace-add-extra-headers-from-bcc-package.patch b/bpftrace-add-extra-headers-from-bcc-package.patch deleted file mode 100644 index d60eed4..0000000 --- a/bpftrace-add-extra-headers-from-bcc-package.patch +++ /dev/null @@ -1,406 +0,0 @@ -From b41d42307ef9af6c0b338de3bb59238dc2ae2a1b Mon Sep 17 00:00:00 2001 -From: Augusto Caringi -Date: Wed, 7 Nov 2018 20:34:38 +0100 -Subject: [PATCH] Add extra headers from bcc package - ---- - CMakeLists.txt | 1 + - extra_headers/common.h | 38 +++++ - extra_headers/frontends/clang/kbuild_helper.h | 104 ++++++++++++ - extra_headers/ns_guard.h | 59 +++++++ - extra_headers/syms.h | 149 ++++++++++++++++++ - 5 files changed, 351 insertions(+) - create mode 100644 extra_headers/common.h - create mode 100644 extra_headers/frontends/clang/kbuild_helper.h - create mode 100644 extra_headers/ns_guard.h - create mode 100644 extra_headers/syms.h - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 3b01a21..2d004c6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -29,6 +29,7 @@ endif() - if (SYSTEM_BCC_LIBRARY) - find_package(LibBcc REQUIRED) - include_directories(${LIBBCC_INCLUDE_DIRS}) -+ include_directories(extra_headers) - else() - if (OFFLINE_BUILDS) - include(ExternalProject) -diff --git a/extra_headers/common.h b/extra_headers/common.h -new file mode 100644 -index 0000000..c227474 ---- /dev/null -+++ b/extra_headers/common.h -@@ -0,0 +1,38 @@ -+/* -+ * Copyright (c) 2015 PLUMgrid, Inc. -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ */ -+ -+#pragma once -+ -+#include -+#include -+#include -+#include -+ -+namespace ebpf { -+ -+template -+typename std::enable_if::value, std::unique_ptr>::type -+make_unique(Args &&... args) { -+ return std::unique_ptr(new T(std::forward(args)...)); -+} -+ -+std::vector get_online_cpus(); -+ -+std::vector get_possible_cpus(); -+ -+std::string get_pid_exe(pid_t pid); -+ -+} // namespace ebpf -diff --git a/extra_headers/frontends/clang/kbuild_helper.h b/extra_headers/frontends/clang/kbuild_helper.h -new file mode 100644 -index 0000000..5a271ff ---- /dev/null -+++ b/extra_headers/frontends/clang/kbuild_helper.h -@@ -0,0 +1,104 @@ -+/* -+ * Copyright (c) 2015 PLUMgrid, Inc. -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ */ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+namespace ebpf { -+ -+struct FileDeleter { -+ void operator() (FILE *fp) { -+ fclose(fp); -+ } -+}; -+typedef std::unique_ptr FILEPtr; -+ -+// Helper with pushd/popd semantics -+class DirStack { -+ public: -+ explicit DirStack(const std::string &dst) : ok_(false) { -+ if (getcwd(cwd_, sizeof(cwd_)) == NULL) { -+ ::perror("getcwd"); -+ return; -+ } -+ if (::chdir(dst.c_str())) { -+ fprintf(stderr, "chdir(%s): %s\n", dst.c_str(), strerror(errno)); -+ return; -+ } -+ ok_ = true; -+ } -+ ~DirStack() { -+ if (!ok_) return; -+ if (::chdir(cwd_)) { -+ fprintf(stderr, "chdir(%s): %s\n", cwd_, strerror(errno)); -+ } -+ } -+ bool ok() const { return ok_; } -+ const char * cwd() const { return cwd_; } -+ private: -+ bool ok_; -+ char cwd_[256]; -+}; -+ -+static int ftw_cb(const char *path, const struct stat *, int, struct FTW *) { -+ return ::remove(path); -+} -+ -+// Scoped class to manage the creation/deletion of tmpdirs -+class TmpDir { -+ public: -+ explicit TmpDir(const std::string &prefix = "/tmp/bcc-") -+ : ok_(false), prefix_(prefix) { -+ prefix_ += "XXXXXX"; -+ if (::mkdtemp((char *)prefix_.data()) == NULL) -+ ::perror("mkdtemp"); -+ else -+ ok_ = true; -+ } -+ ~TmpDir() { -+ if (::nftw(prefix_.c_str(), ftw_cb, 20, FTW_DEPTH) < 0) -+ ::perror("ftw"); -+ else -+ ::remove(prefix_.c_str()); -+ } -+ bool ok() const { return ok_; } -+ const std::string & str() const { return prefix_; } -+ private: -+ bool ok_; -+ std::string prefix_; -+}; -+ -+// Compute the kbuild flags for the currently running kernel -+// Do this by: -+// 1. Create temp Makefile with stub dummy.c -+// 2. Run module build on that makefile, saving the computed flags to a file -+// 3. Cache the file for fast flag lookup in subsequent runs -+// Note: Depending on environment, different cache locations may be desired. In -+// case we eventually support non-root user programs, cache in $HOME. -+class KBuildHelper { -+ public: -+ explicit KBuildHelper(const std::string &kdir, bool has_source_dir); -+ int get_flags(const char *uname_machine, std::vector *cflags); -+ private: -+ std::string kdir_; -+ bool has_source_dir_; -+}; -+ -+} // namespace ebpf -diff --git a/extra_headers/ns_guard.h b/extra_headers/ns_guard.h -new file mode 100644 -index 0000000..ce4b61b ---- /dev/null -+++ b/extra_headers/ns_guard.h -@@ -0,0 +1,59 @@ -+/* -+ * Copyright (c) 2017 Facebook, Inc. -+ * Copyright (c) 2017 VMware, Inc. -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ */ -+ -+#pragma once -+ -+#include -+#include -+ -+#include "file_desc.h" -+ -+class ProcMountNSGuard; -+ -+// ProcMountNS opens an fd corresponding to the current mount namespace and the -+// mount namespace of the target process. -+// The fds will remain uninitialized (<0) if the open fails, or if the current -+// and target namespaces are identical. -+class ProcMountNS { -+ public: -+ explicit ProcMountNS(int pid); -+ int self() const { return self_fd_; } -+ int target() const { return target_fd_; } -+ ino_t target_ino() const { return target_ino_; } -+ -+ private: -+ ebpf::FileDesc self_fd_; -+ ebpf::FileDesc target_fd_; -+ ino_t target_ino_; -+}; -+ -+// ProcMountNSGuard switches to the target mount namespace and restores the -+// original upon going out of scope. -+class ProcMountNSGuard { -+ public: -+ explicit ProcMountNSGuard(ProcMountNS *mount_ns); -+ explicit ProcMountNSGuard(int pid); -+ -+ ~ProcMountNSGuard(); -+ -+ private: -+ void init(); -+ -+ std::unique_ptr mount_ns_instance_; -+ ProcMountNS *mount_ns_; -+ bool entered_; -+}; -diff --git a/extra_headers/syms.h b/extra_headers/syms.h -new file mode 100644 -index 0000000..d7dabfa ---- /dev/null -+++ b/extra_headers/syms.h -@@ -0,0 +1,149 @@ -+/* -+ * Copyright (c) 2016 GitHub, Inc. -+ * -+ * Licensed under the Apache License, Version 2.0 (the "License"); -+ * you may not use this file except in compliance with the License. -+ * You may obtain a copy of the License at -+ * -+ * http://www.apache.org/licenses/LICENSE-2.0 -+ * -+ * Unless required by applicable law or agreed to in writing, software -+ * distributed under the License is distributed on an "AS IS" BASIS, -+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -+ * See the License for the specific language governing permissions and -+ * limitations under the License. -+ */ -+#pragma once -+ -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+#include "bcc_syms.h" -+#include "file_desc.h" -+#include "ns_guard.h" -+ -+class ProcStat { -+ std::string procfs_; -+ ino_t inode_; -+ ino_t getinode_(); -+ -+public: -+ ProcStat(int pid); -+ bool is_stale(); -+ void reset() { inode_ = getinode_(); } -+}; -+ -+class SymbolCache { -+public: -+ virtual ~SymbolCache() = default; -+ -+ virtual void refresh() = 0; -+ virtual bool resolve_addr(uint64_t addr, struct bcc_symbol *sym, bool demangle = true) = 0; -+ virtual bool resolve_name(const char *module, const char *name, -+ uint64_t *addr) = 0; -+}; -+ -+class KSyms : SymbolCache { -+ struct Symbol { -+ Symbol(const char *name, uint64_t addr) : name(name), addr(addr) {} -+ std::string name; -+ uint64_t addr; -+ -+ bool operator<(const Symbol &rhs) const { return addr < rhs.addr; } -+ }; -+ -+ std::vector syms_; -+ std::unordered_map symnames_; -+ static void _add_symbol(const char *, uint64_t, void *); -+ -+public: -+ virtual bool resolve_addr(uint64_t addr, struct bcc_symbol *sym, bool demangle = true); -+ virtual bool resolve_name(const char *unused, const char *name, -+ uint64_t *addr); -+ virtual void refresh(); -+}; -+ -+class ProcSyms : SymbolCache { -+ struct Symbol { -+ Symbol(const std::string *name, uint64_t start, uint64_t size) -+ : name(name), start(start), size(size) {} -+ const std::string *name; -+ uint64_t start; -+ uint64_t size; -+ -+ bool operator<(const struct Symbol& rhs) const { -+ return start < rhs.start; -+ } -+ }; -+ -+ enum class ModuleType { -+ UNKNOWN, -+ EXEC, -+ SO, -+ PERF_MAP, -+ VDSO -+ }; -+ -+ struct Module { -+ struct Range { -+ uint64_t start; -+ uint64_t end; -+ uint64_t file_offset; -+ Range(uint64_t s, uint64_t e, uint64_t f) -+ : start(s), end(e), file_offset(f) {} -+ }; -+ -+ Module(const char *name, ProcMountNS *mount_ns, -+ struct bcc_symbol_option *option); -+ -+ std::string name_; -+ std::vector ranges_; -+ bool loaded_; -+ ProcMountNS *mount_ns_; -+ bcc_symbol_option *symbol_option_; -+ ModuleType type_; -+ -+ // The file offset within the ELF of the SO's first text section. -+ uint64_t elf_so_offset_; -+ uint64_t elf_so_addr_; -+ -+ std::unordered_set symnames_; -+ std::vector syms_; -+ -+ void load_sym_table(); -+ -+ bool contains(uint64_t addr, uint64_t &offset) const; -+ uint64_t start() const { return ranges_.begin()->start; } -+ -+ bool find_addr(uint64_t offset, struct bcc_symbol *sym); -+ bool find_name(const char *symname, uint64_t *addr); -+ -+ static int _add_symbol(const char *symname, uint64_t start, uint64_t size, -+ void *p); -+ }; -+ -+ int pid_; -+ std::vector modules_; -+ ProcStat procstat_; -+ std::unique_ptr mount_ns_instance_; -+ bcc_symbol_option symbol_option_; -+ -+ static int _add_load_sections(uint64_t v_addr, uint64_t mem_sz, -+ uint64_t file_offset, void *payload); -+ static int _add_module(const char *, uint64_t, uint64_t, uint64_t, bool, -+ void *); -+ void load_exe(); -+ void load_modules(); -+ -+public: -+ ProcSyms(int pid, struct bcc_symbol_option *option = nullptr); -+ virtual void refresh(); -+ virtual bool resolve_addr(uint64_t addr, struct bcc_symbol *sym, bool demangle = true); -+ virtual bool resolve_name(const char *module, const char *name, -+ uint64_t *addr); -+}; --- -2.17.2 - diff --git a/bpftrace-add-support-to-link-bpftrace-against-the-system-inst.patch b/bpftrace-add-support-to-link-bpftrace-against-the-system-inst.patch deleted file mode 100644 index 4e1e40f..0000000 --- a/bpftrace-add-support-to-link-bpftrace-against-the-system-inst.patch +++ /dev/null @@ -1,239 +0,0 @@ -From c931287579bc2f83a76bd2511285b79f95f22628 Mon Sep 17 00:00:00 2001 -From: Augusto Caringi -Date: Wed, 31 Oct 2018 20:32:17 +0100 -Subject: [PATCH] Add support to link bpftrace against the system installed bcc - library - -- Add "-DSYSTEM_BCC_LIBRARY:BOOL=ON" CMake option to link bpftrace -executable against the system installed bcc library ---- - CMakeLists.txt | 50 ++++++++++++++++++++++++++---------------- - INSTALL.md | 2 ++ - cmake/FindLibBcc.cmake | 44 +++++++++++++++++++++++++++++++++++++ - src/CMakeLists.txt | 15 ++++++++----- - src/ast/CMakeLists.txt | 8 ++++--- - tests/CMakeLists.txt | 15 ++++++++----- - 6 files changed, 100 insertions(+), 34 deletions(-) - create mode 100644 cmake/FindLibBcc.cmake - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 18875ff..3b01a21 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8.12) - project(bpftrace) - - set(STATIC_LINKING OFF CACHE BOOL "Build bpftrace as a statically linked executable") -+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -+set(ENABLE_TESTS ON CACHE BOOL "Enable tests") - - add_compile_options("-std=c++14") - add_compile_options("-Wno-format-security") -@@ -20,25 +22,34 @@ add_compile_options("-Wno-format-security") - #add_compile_options("-Wstrict-overflow=5") - #add_compile_options("-Wdisabled-optimization") - --enable_testing() -+if (ENABLE_TESTS) -+ enable_testing() -+endif() - --if (OFFLINE_BUILDS) -- include(ExternalProject) -- ExternalProject_Add(bcc -- GIT_REPOSITORY https://github.com/iovisor/bcc -- STEP_TARGETS build update -- EXCLUDE_FROM_ALL 1 -- UPDATE_DISCONNECTED 1 -- BUILD_COMMAND ${CMAKE_COMMAND} --build . --target bcc-static -- ) -+if (SYSTEM_BCC_LIBRARY) -+ find_package(LibBcc REQUIRED) -+ include_directories(${LIBBCC_INCLUDE_DIRS}) - else() -- include(ExternalProject) -- ExternalProject_Add(bcc -- GIT_REPOSITORY https://github.com/iovisor/bcc -- STEP_TARGETS build update -- EXCLUDE_FROM_ALL 1 -- BUILD_COMMAND ${CMAKE_COMMAND} --build . --target bcc-static -- ) -+ if (OFFLINE_BUILDS) -+ include(ExternalProject) -+ ExternalProject_Add(bcc -+ GIT_REPOSITORY https://github.com/iovisor/bcc -+ STEP_TARGETS build update -+ EXCLUDE_FROM_ALL 1 -+ UPDATE_DISCONNECTED 1 -+ BUILD_COMMAND ${CMAKE_COMMAND} --build . --target bcc-static -+ ) -+ else() -+ include(ExternalProject) -+ ExternalProject_Add(bcc -+ GIT_REPOSITORY https://github.com/iovisor/bcc -+ STEP_TARGETS build update -+ EXCLUDE_FROM_ALL 1 -+ BUILD_COMMAND ${CMAKE_COMMAND} --build . --target bcc-static -+ ) -+ endif() -+ ExternalProject_Get_Property(bcc source_dir) -+ include_directories(${source_dir}/src/cc) - endif() - - if (STATIC_LINKING) -@@ -48,7 +59,6 @@ if (STATIC_LINKING) - set(CMAKE_LINK_SEARCH_END_STATIC TRUE) - endif() - --set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - find_package(LibElf REQUIRED) - include_directories(${LIBELF_INCLUDE_DIRS}) - -@@ -75,7 +85,9 @@ include_directories(${CLANG_INCLUDE_DIRS}) - add_subdirectory(src/arch) - add_subdirectory(src/ast) - add_subdirectory(src) --add_subdirectory(tests) -+if (ENABLE_TESTS) -+ add_subdirectory(tests) -+endif() - add_subdirectory(resources) - add_subdirectory(tools) - add_subdirectory(man) -diff --git a/INSTALL.md b/INSTALL.md -index 7058dd7..d936ee6 100644 ---- a/INSTALL.md -+++ b/INSTALL.md -@@ -170,6 +170,8 @@ By default bpftrace will be built as a dynamically linked executable. If a stati - - The latest versions of BCC and Google Test will be downloaded on each build. To speed up builds and only download their sources on the first run, use the CMake option `-DOFFLINE_BUILDS:BOOL=ON`. - -+There is also an experimental support to link the bpftrace executable against the system installed bcc library instead of downloading and building bcc from source. This can be enabled through the CMake option `-DSYSTEM_BCC_LIBRARY:BOOL=ON`. -+ - To test that the build works, you can try running the test suite, and a one-liner: - - ``` -diff --git a/cmake/FindLibBcc.cmake b/cmake/FindLibBcc.cmake -new file mode 100644 -index 0000000..860bc91 ---- /dev/null -+++ b/cmake/FindLibBcc.cmake -@@ -0,0 +1,44 @@ -+# - Try to find libbcc -+# Once done this will define -+# -+# LIBBCC_FOUND - system has libbcc -+# LIBBCC_INCLUDE_DIRS - the libbcc include directory -+# LIBBCC_LIBRARIES - Link these to use libbcc -+# LIBBCC_DEFINITIONS - Compiler switches required for using libbcc -+ -+if (LIBBCC_LIBRARIES AND LIBBCC_INCLUDE_DIRS) -+ set (LibBcc_FIND_QUIETLY TRUE) -+endif (LIBBCC_LIBRARIES AND LIBBCC_INCLUDE_DIRS) -+ -+find_path (LIBBCC_INCLUDE_DIRS -+ NAMES -+ libbpf.h -+ PATHS -+ /usr/include -+ /usr/include/bcc -+ /usr/local/include -+ /usr/local/include/libbcc -+ /opt/local/include -+ /opt/local/include/libbcc -+ /sw/include -+ /sw/include/libbcc -+ ENV CPATH) -+ -+find_library (LIBBCC_LIBRARIES -+ NAMES -+ bcc -+ PATHS -+ /usr/lib -+ /usr/local/lib -+ /opt/local/lib -+ /sw/lib -+ ENV LIBRARY_PATH -+ ENV LD_LIBRARY_PATH) -+ -+include (FindPackageHandleStandardArgs) -+ -+ -+# handle the QUIETLY and REQUIRED arguments and set LIBBCC_FOUND to TRUE if all listed variables are TRUE -+FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibBcc DEFAULT_MSG -+ LIBBCC_LIBRARIES -+ LIBBCC_INCLUDE_DIRS) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 861f899..e275416 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -19,12 +19,15 @@ if(HAVE_NAME_TO_HANDLE_AT) - endif(HAVE_NAME_TO_HANDLE_AT) - target_link_libraries(bpftrace arch ast parser resources) - --ExternalProject_Get_Property(bcc source_dir binary_dir) --target_include_directories(bpftrace PUBLIC ${source_dir}/src/cc) --target_link_libraries(bpftrace ${binary_dir}/src/cc/libbpf.a) --target_link_libraries(bpftrace ${binary_dir}/src/cc/libbcc-loader-static.a) --target_link_libraries(bpftrace ${binary_dir}/src/cc/libbcc.a) --target_link_libraries(bpftrace ${binary_dir}/src/cc/frontends/clang/libclang_frontend.a) -+if (SYSTEM_BCC_LIBRARY) -+ target_link_libraries(bpftrace ${LIBBCC_LIBRARIES}) -+else() -+ ExternalProject_Get_Property(bcc binary_dir) -+ target_link_libraries(bpftrace ${binary_dir}/src/cc/libbpf.a) -+ target_link_libraries(bpftrace ${binary_dir}/src/cc/libbcc-loader-static.a) -+ target_link_libraries(bpftrace ${binary_dir}/src/cc/libbcc.a) -+ target_link_libraries(bpftrace ${binary_dir}/src/cc/frontends/clang/libclang_frontend.a) -+endif() - target_link_libraries(bpftrace ${LIBELF_LIBRARIES}) - - install(TARGETS bpftrace DESTINATION bin) -diff --git a/src/ast/CMakeLists.txt b/src/ast/CMakeLists.txt -index 1214a38..262179e 100644 ---- a/src/ast/CMakeLists.txt -+++ b/src/ast/CMakeLists.txt -@@ -11,9 +11,11 @@ target_include_directories(ast PUBLIC ${CMAKE_SOURCE_DIR}/src/ast) - target_include_directories(ast PUBLIC ${CMAKE_BINARY_DIR}) - target_link_libraries(ast arch) - --add_dependencies(ast bcc-build parser) --ExternalProject_Get_Property(bcc source_dir) --target_include_directories(ast PUBLIC ${source_dir}/src/cc) -+if (SYSTEM_BCC_LIBRARY) -+ add_dependencies(ast parser) -+else() -+ add_dependencies(ast bcc-build parser) -+endif() - - if (STATIC_LINKING) - set(clang_libs -diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt -index 0938d5a..82e7d28 100644 ---- a/tests/CMakeLists.txt -+++ b/tests/CMakeLists.txt -@@ -108,12 +108,15 @@ if(HAVE_NAME_TO_HANDLE_AT) - endif(HAVE_NAME_TO_HANDLE_AT) - target_link_libraries(bpftrace_test arch ast parser resources) - --ExternalProject_Get_Property(bcc source_dir binary_dir) --target_include_directories(bpftrace_test PUBLIC ${source_dir}/src/cc) --target_link_libraries(bpftrace_test ${binary_dir}/src/cc/libbpf.a) --target_link_libraries(bpftrace_test ${binary_dir}/src/cc/libbcc-loader-static.a) --target_link_libraries(bpftrace_test ${binary_dir}/src/cc/libbcc.a) --target_link_libraries(bpftrace_test ${binary_dir}/src/cc/frontends/clang/libclang_frontend.a) -+if (SYSTEM_BCC_LIBRARY) -+ target_link_libraries(bpftrace_test ${LIBBCC_LIBRARIES}) -+else() -+ ExternalProject_Get_Property(bcc binary_dir) -+ target_link_libraries(bpftrace_test ${binary_dir}/src/cc/libbpf.a) -+ target_link_libraries(bpftrace_test ${binary_dir}/src/cc/libbcc-loader-static.a) -+ target_link_libraries(bpftrace_test ${binary_dir}/src/cc/libbcc.a) -+ target_link_libraries(bpftrace_test ${binary_dir}/src/cc/frontends/clang/libclang_frontend.a) -+endif() - target_link_libraries(bpftrace_test ${LIBELF_LIBRARIES}) - - find_package(Threads REQUIRED) --- -2.17.2 - diff --git a/bpftrace-install-_example.txt-files-to-tools-doc-they-are-ref.patch b/bpftrace-install-_example.txt-files-to-tools-doc-they-are-ref.patch deleted file mode 100644 index 9ff91d8..0000000 --- a/bpftrace-install-_example.txt-files-to-tools-doc-they-are-ref.patch +++ /dev/null @@ -1,23 +0,0 @@ -From c3c53e4bcd8026b7fd46203322acb4cabf6b459c Mon Sep 17 00:00:00 2001 -From: Augusto Caringi -Date: Thu, 22 Nov 2018 15:55:30 +0100 -Subject: [PATCH] Install *_example.txt files to tools/doc (they are referenced - in man pages) - ---- - tools/CMakeLists.txt | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 10002a7..e25d858 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -1,2 +1,5 @@ - file(GLOB BT_FILES *.bt) -+file(GLOB TXT_FILES *.txt) -+list(REMOVE_ITEM TXT_FILES ${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) - install(FILES ${BT_FILES} DESTINATION share/bpftrace/tools) -+install(FILES ${TXT_FILES} DESTINATION share/bpftrace/tools/doc) --- -2.17.2 - diff --git a/bpftrace.spec b/bpftrace.spec index fd6ebd7..22c8732 100644 --- a/bpftrace.spec +++ b/bpftrace.spec @@ -1,21 +1,11 @@ -%global commit_bpftrace c49b333c034a6d29a7ce90f565e27da1061af971 -%global shortcommit_bpftrace %(c=%{commit_bpftrace}; echo ${c:0:7}) - Name: bpftrace -Version: 0.0 -Release: 2.20181210git%{shortcommit_bpftrace}%{?dist} +Version: 0.9 +Release: 0%{?dist} Summary: High-level tracing language for Linux eBPF License: ASL 2.0 URL: https://github.com/iovisor/bpftrace -Source0: %{url}/archive/%{commit_bpftrace}.tar.gz - -# https://github.com/iovisor/bpftrace/pull/227 -Patch0: %{name}-add-support-to-link-bpftrace-against-the-system-inst.patch -# https://github.com/iovisor/bcc/pull/2022 -Patch1: %{name}-add-extra-headers-from-bcc-package.patch -# https://github.com/iovisor/bpftrace/pull/264 -Patch2: %{name}-install-_example.txt-files-to-tools-doc-they-are-ref.patch +Source0: %{url}/archive/v%{version}.tar.gz # Arches will be included as upstream support is added and dependencies are # satisfied in the respective arches @@ -27,7 +17,8 @@ BuildRequires: flex BuildRequires: cmake BuildRequires: elfutils-libelf-devel BuildRequires: zlib-devel -BuildRequires: llvm-devel +BuildRequires: llvm7.0-devel +BuildRequires: llvm7.0-static BuildRequires: clang-devel BuildRequires: bcc-devel @@ -43,15 +34,15 @@ and predecessor tracers such as DTrace and SystemTap %prep -%autosetup -p1 -n bpftrace-%{commit_bpftrace} +%autosetup -p1 %build %cmake . \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ - -DSYSTEM_BCC_LIBRARY:BOOL=ON \ - -DENABLE_TESTS:BOOL=OFF \ - -DBUILD_SHARED_LIBS:BOOL=OFF + -DBUILD_TESTING:BOOL=OFF \ + -DBUILD_SHARED_LIBS:BOOL=OFF \ + -DLLVM_DIR=/usr/lib64/llvm7.0/lib/cmake/llvm/ make %{?_smp_mflags} @@ -81,6 +72,9 @@ mv %{buildroot}%{_prefix}/man/* %{buildroot}%{_mandir}/ %changelog +* Mon Mar 25 2019 Augusto Caringi - 0.9-0 +- Updated to version 0.9 + * Thu Jan 31 2019 Fedora Release Engineering - 0.0-2.20181210gitc49b333 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild diff --git a/sources b/sources index 7699410..cad99cc 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (c49b333c034a6d29a7ce90f565e27da1061af971.tar.gz) = 99cc2686b688e732ab1a9b31389ed261e5d873248ce572452800431bfbd1cb165efbcb3cb705f1405de83dbff2280f0bde38723fe92b81b8f4f48cad03316811 +SHA512 (v0.9.tar.gz) = 771c412a6b1ee7a7d5bba9e0910633056c6f5523e5d1efd9d7ccb5b9f9b462b7bda8d170c5ed0653f3c1bfd5cc77fce2fd552f12eb8222a8747620b3dc9b49f8