4 #include "llvm/IR/Function.h" 5 #include "llvm/IR/LLVMContext.h" 17 static std::unique_ptr<llvm::Module>
20 unsigned int kernel_version;
23 return std::unique_ptr<llvm::Module>(
nullptr);
25 std::string cflag_kver(
"-DLINUX_VERSION_CODE=" +
26 std::to_string(kernel_version));
28 std::unique_ptr<llvm::Module>
M =
43 for (llvm::Function& F : *
M)
44 if (F.getName() ==
"bpf_func__SyS_epoll_pwait")
int fetch_kernel_version(unsigned int *puint, char *str, size_t str_size)
int test__clang_to_obj(void)
void perf_clang__cleanup(void)
const char test_llvm__bpf_base_prog[]
static std::unique_ptr< llvm::Module > __test__clang_to_IR(void)
int test__clang_to_IR(void)
static std::unique_ptr< llvm::Module > getModuleFromSource(llvm::opt::ArgStringList CFlags, StringRef Path, IntrusiveRefCntPtr< vfs::FileSystem > VFS)
std::unique_ptr< llvm::SmallVectorImpl< char > > getBPFObjectFromModule(llvm::Module *Module)
void perf_clang__init(void)