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

set clang version lower to 9 from 12 #41

Merged
merged 4 commits into from
Apr 21, 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
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ all: ebpf assets build

nocore: ebpf_nocore assets build_nocore
@echo $(shell date)
# centos 8.2 4.18.0-305.3.1.el8.x86_64
# centos 8.2 gcc Version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
# clang 12.0.1-4.module_el8.5.0+1025+93159d6c

.ONESHELL:
SHELL = /bin/sh
Expand Down Expand Up @@ -82,15 +79,15 @@ EXTRA_CFLAGS_NOCORE ?= -emit-llvm -O2 -S\
CLANG_VERSION = $(shell $(CMD_CLANG) --version 2>/dev/null | \
head -1 | $(CMD_TR) -d '[:alpha:]' | $(CMD_TR) -d '[:space:]' | $(CMD_CUT) -d'.' -f1)

#TODO 系统内核版本检测 5.8 以上
#TODO 系统内核版本检测 5.2 以上

# clang 编译器版本检测,llvm检测,
.checkver_$(CMD_CLANG): \
| .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 Expand Up @@ -157,6 +154,10 @@ ifeq ($(UNAME_M),aarch64)
GO_ARCH = arm64
endif

#
# include vpath
#

KERN_RELEASE ?= $(UNAME_R)
KERN_BUILD_PATH ?= $(if $(KERN_HEADERS),$(KERN_HEADERS),/lib/modules/$(KERN_RELEASE)/build)
KERN_SRC_PATH ?= $(if $(KERN_HEADERS),$(KERN_HEADERS),$(if $(wildcard /lib/modules/$(KERN_RELEASE)/source),/lib/modules/$(KERN_RELEASE)/source,$(KERN_BUILD_PATH)))
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Download ELF zip file [release](https://github.com/ehids/ecapture/releases) , unzip and use by command `./ecapture --help`.

* Linux kernel version >= 4.18
* Enable BTF [BPF Type Format (BTF)](https://www.kernel.org/doc/html/latest/bpf/btf.html)
* Enable BTF [BPF Type Format (BTF)](https://www.kernel.org/doc/html/latest/bpf/btf.html) (Optional, 2022-04-17)

### check your server BTF config:
```shell
Expand Down Expand Up @@ -102,9 +102,9 @@ Linux Kernel: >= 4.18.
## Tools
* golang 1.16
* gcc 10.3.0
* clang 12.0.0
* clang 9.0.0
* cmake 3.18.4
* clang backend: llvm 12.0.0
* clang backend: llvm 9.0.0
* pahole >= v1.13
* kernel config:CONFIG_DEBUG_INFO_BTF=y (Optional, 2022-04-17)

Expand Down
6 changes: 3 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ eBPF HOOK uprobe实现的各种用户态进程的数据捕获,无需改动原

系统配置要求
* 系统linux kernel版本必须高于4.18。
* 开启BTF [BPF Type Format (BTF)](https://www.kernel.org/doc/html/latest/bpf/btf.html) 支持。
* 开启BTF [BPF Type Format (BTF)](https://www.kernel.org/doc/html/latest/bpf/btf.html) 支持。 (可选, 2022-04-17)

### 验证方法:
```shell
Expand Down Expand Up @@ -108,9 +108,9 @@ hook了`/bin/bash`的`readline`函数。
## 工具链版本
* golang 1.16
* gcc 10.3.0
* clang 12.0.0
* clang 9.0.0
* cmake 3.18.4
* clang backend: llvm 12.0.0
* clang backend: llvm 9.0.0
* pahole >= v1.13
* kernel config:CONFIG_DEBUG_INFO_BTF=y (可选,2022-04-17增加)

Expand Down
2 changes: 1 addition & 1 deletion cli/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ func init() {
//rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
rootCmd.PersistentFlags().BoolVarP(&globalFlags.Debug, "debug", "d", false, "enable debug logging")
rootCmd.PersistentFlags().BoolVar(&globalFlags.IsHex, "hex", false, "print byte strings as hex encoded strings")
rootCmd.PersistentFlags().Uint64VarP(&globalFlags.Pid, "pid", "p", defaultPid, "if target_pid is 0 then we target all pids")
rootCmd.PersistentFlags().Uint64VarP(&globalFlags.Pid, "pid", "p", defaultPid, "if pid is 0 then we target all pids")
}