-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BTF kernel code support #734
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4cf317e
Add curtask task_struct cast type for field access
olsajiri ab481f7
Add Expression::resolve string set
olsajiri 81404dc
Add support to check for libbpf package
olsajiri 7a2950d
Add BTF class
olsajiri 2fdc83e
Add BTF::c_def function
olsajiri f68c58f
Add ClangParser::visit_children function
olsajiri b8251fc
Add ClangParserHandler::check_diagnostics function
olsajiri 450a01b
Add SizedType::operator!= function
olsajiri cbf7da2
Add ClangParser::parse_btf_definitions function
olsajiri f64d8c7
Add --btf option
olsajiri c665902
Add BTF tests
olsajiri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# - Try to find libbpf | ||
# Once done this will define | ||
# | ||
# LIBBPF_FOUND - system has libbpf | ||
# LIBBPF_INCLUDE_DIRS - the libbpf include directory | ||
# LIBBPF_LIBRARIES - Link these to use libbpf | ||
# LIBBPF_DEFINITIONS - Compiler switches required for using libbpf | ||
|
||
#if (LIBBPF_LIBRARIES AND LIBBPF_INCLUDE_DIRS) | ||
# set (LibBpf_FIND_QUIETLY TRUE) | ||
#endif (LIBBPF_LIBRARIES AND LIBBPF_INCLUDE_DIRS) | ||
|
||
find_path (LIBBPF_INCLUDE_DIRS | ||
NAMES | ||
bpf/bpf.h | ||
bpf/btf.h | ||
bpf/libbpf.h | ||
PATHS | ||
/usr/include | ||
/usr/local/include | ||
/opt/local/include | ||
/sw/include | ||
ENV CPATH) | ||
|
||
find_library (LIBBPF_LIBRARIES | ||
NAMES | ||
bpf | ||
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 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_INCLUDE_DIRS) | ||
|
||
mark_as_advanced(LIBBPF_INCLUDE_DIRS LIBBPF_LIBRARIES) | ||
|
||
# We need btf_dump support, set LIBBPF_BTF_DUMP_FOUND | ||
# when it's found. | ||
if (LIBBPF_FOUND) | ||
include(CheckSymbolExists) | ||
# adding also elf for static build check | ||
SET(CMAKE_REQUIRED_LIBRARIES ${LIBBPF_LIBRARIES} elf) | ||
# libbpf quirk, needs upstream fix | ||
SET(CMAKE_REQUIRED_DEFINITIONS -include stdbool.h) | ||
check_symbol_exists(btf_dump__new "${LIBBPF_INCLUDE_DIRS}/bpf/btf.h" HAVE_BTF_DUMP) | ||
if (HAVE_BTF_DUMP) | ||
set(LIBBPF_BTF_DUMP_FOUND TRUE) | ||
endif() | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't claim to know what these lines are for in FindLibElf.cmake, but why are they commented out here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's so people can pass in paths via cmake
-D
stuff. If we aren't gonna use it here we should delete it