Skip to content
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

fix: Build failed on clang10 (#256) #258

Merged
merged 2 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ CLANG_VERSION = $(shell $(CMD_CLANG) --version 2>/dev/null | \
| .check_$(CMD_CLANG)
#
@echo $(shell date)
@if [ ${CLANG_VERSION} -lt 12 ]; then
echo -n "you MUST use clang 12 or newer, "
@if [ ${CLANG_VERSION} -lt 9 ]; then
echo -n "you MUST use clang 9 or newer, "
echo "your current clang version is ${CLANG_VERSION}"
exit 1
fi
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ Linux Kernel: >= 4.15.

## Tools
* golang 1.17
* clang 12.0.0
* clang 9.0
* cmake 3.18.4
* clang backend: llvm 12.0.0
* clang backend: llvm 9.0
* kernel config:CONFIG_DEBUG_INFO_BTF=y (Optional, 2022-04-17)

## command
Expand Down
4 changes: 2 additions & 2 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,9 @@ hook了`/bin/bash`的`readline`函数。

## 工具链版本
* golang 1.17
* clang 12.0.0
* clang 9.0
* cmake 3.18.4
* clang backend: llvm 12.0.0
* clang backend: llvm 9.0
* kernel config:CONFIG_DEBUG_INFO_BTF=y (可选,2022-04-17增加)


Expand Down
18 changes: 18 additions & 0 deletions kern/ecapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
#else
//CO:RE is disabled
#include <linux/kconfig.h>

// see https://github.com/ehids/ecapture/issues/256 for more detail.
/*
* This will bring in asm_volatile_goto and asm_inline macro definitions
* if enabled by compiler and config options.
*/
#include <linux/types.h>

/*
* asm_inline is defined as asm __inline in "include/linux/compiler_types.h"
* if supported by the kernel's CC (i.e CONFIG_CC_HAS_ASM_INLINE) which is not
* supported by CLANG.
*/
#ifdef asm_inline
#undef asm_inline
#define asm_inline asm
#endif

#include <uapi/linux/ptrace.h>
#include <linux/bpf.h>
#include <linux/socket.h>
Expand Down