diff --git a/Makefile b/Makefile index 8723aa89..a039ba7c 100644 --- a/Makefile +++ b/Makefile @@ -32,14 +32,6 @@ export GOARCH = $(TARGET_ARCH) export CC = $(ARCH_PREFIX)gcc export OBJCOPY = $(ARCH_PREFIX)objcopy -# Add EXTERNAL flag support -ifdef EXTERNAL - export EXTERNAL - GO_TAGS := osusergo,netgo,external_trigger -else - GO_TAGS := osusergo,netgo -endif - BRANCH = $(shell git rev-parse --abbrev-ref HEAD | tr -d '-' | tr '[:upper:]' '[:lower:]') COMMIT_SHORT_SHA = $(shell git rev-parse --short=8 HEAD) @@ -52,11 +44,11 @@ LDFLAGS := -X go.opentelemetry.io/ebpf-profiler/vc.version=$(VERSION) \ -X go.opentelemetry.io/ebpf-profiler/vc.buildTimestamp=$(BUILD_TIMESTAMP) \ -extldflags=-static - -GO_FLAGS := -buildvcs=false -ldflags="$(LDFLAGS)" -tags $(GO_TAGS) - +GO_TAGS := osusergo,netgo EBPF_FLAGS := +GO_FLAGS := -buildvcs=false -ldflags="$(LDFLAGS)" + MAKEFLAGS += -j$(shell nproc) all: ebpf-profiler @@ -77,8 +69,7 @@ generate: go generate ./... ebpf: - $(MAKE) $(EBPF_FLAGS) -j$(shell nproc) -C support/ebpf EXTERNAL=external - $(MAKE) $(EBPF_FLAGS) -j$(shell nproc) -C support/ebpf + $(MAKE) $(EBPF_FLAGS) -C support/ebpf ebpf-profiler: generate ebpf go build $(GO_FLAGS) -tags $(GO_TAGS) @@ -129,7 +120,7 @@ docker-image: agent: docker run -v "$$PWD":/agent -it --rm --user $(shell id -u):$(shell id -g) profiling-agent \ - "make TARGET_ARCH=$(TARGET_ARCH) VERSION=$(VERSION) REVISION=$(REVISION) BUILD_TIMESTAMP=$(BUILD_TIMESTAMP) $(if $(EXTERNAL),EXTERNAL=external)" + "make TARGET_ARCH=$(TARGET_ARCH) VERSION=$(VERSION) REVISION=$(REVISION) BUILD_TIMESTAMP=$(BUILD_TIMESTAMP)" debug-agent: docker run -v "$$PWD":/agent -it --rm --user $(shell id -u):$(shell id -g) profiling-agent \ @@ -141,4 +132,4 @@ legal: @./legal/add-non-go.sh legal/non-go-dependencies.json LICENSES codespell: - @codespell + @codespell \ No newline at end of file diff --git a/support/ebpf/Makefile b/support/ebpf/Makefile index f852e1d5..e18e5aed 100644 --- a/support/ebpf/Makefile +++ b/support/ebpf/Makefile @@ -5,13 +5,6 @@ LLC ?= llc-16 DEBUG_FLAGS = -DOPTI_DEBUG -g -# Check if EXTERNAL flag is set -ifdef EXTERNAL - EXTERNAL_FLAG = -DEXTERNAL_TRIGGER -else - EXTERNAL_FLAG = -endif - # Detect native architecture and translate to GOARCH. NATIVE_ARCH := $(shell uname -m) ifeq ($(NATIVE_ARCH),x86_64) @@ -28,11 +21,7 @@ TARGET_ARCH ?= $(NATIVE_ARCH) # Valid values: release, debug BUILD_TYPE ?= release -ifdef EXTERNAL - TRACER_NAME ?= tracer.ebpf.$(BUILD_TYPE).$(EXTERNAL).$(TARGET_ARCH) -else - TRACER_NAME ?= tracer.ebpf.$(BUILD_TYPE).$(TARGET_ARCH) -endif +TRACER_NAME ?= tracer.ebpf.$(BUILD_TYPE).$(TARGET_ARCH) ifeq ($(TARGET_ARCH),arm64) TARGET_FLAGS = -target aarch64-linux-gnu @@ -55,15 +44,10 @@ FLAGS=$(TARGET_FLAGS) \ -Wno-unused-label \ -Wno-unused-parameter \ -Wno-sign-compare \ - -fno-stack-protector \ - $(EXTERNAL_FLAG) + -fno-stack-protector SRCS := $(wildcard *.ebpf.c) -ifdef EXTERNAL - OBJS := $(SRCS:.c=.$(BUILD_TYPE).$(EXTERNAL).$(TARGET_ARCH).o) -else - OBJS := $(SRCS:.c=.$(BUILD_TYPE).$(TARGET_ARCH).o) -endif +OBJS := $(SRCS:.c=.$(BUILD_TYPE).$(TARGET_ARCH).o) .DEFAULT_GOAL := all @@ -89,13 +73,8 @@ errors.h: ../../tools/errors-codegen/errors.json %.ebpf.c: errors.h ; -ifdef EXTERNAL -%.ebpf.$(BUILD_TYPE).$(EXTERNAL).$(TARGET_ARCH).o: %.ebpf.c - $(BPF_CLANG) $(FLAGS) -o $@ -else %.ebpf.$(BUILD_TYPE).$(TARGET_ARCH).o: %.ebpf.c $(BPF_CLANG) $(FLAGS) -o $@ -endif $(TRACER_NAME): $(OBJS) $(BPF_LINK) $^ -o - | $(LLC) -march=bpf -mcpu=v2 -filetype=obj -o $@ @@ -108,4 +87,4 @@ bloatcheck: $(TRACER_NAME) python3 bloat-o-meter $(TRACER_NAME).baseline $(TRACER_NAME) clean: - rm -f *.o + rm -f *.o \ No newline at end of file diff --git a/support/support_amd64.go b/support/support_amd64.go index cad7b96d..a2f18b46 100644 --- a/support/support_amd64.go +++ b/support/support_amd64.go @@ -1,5 +1,4 @@ -//go:build amd64 && !dummy && !external_trigger -// +build amd64,!dummy,!external_trigger +//go:build amd64 && !dummy // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 diff --git a/support/support_arm64.go b/support/support_arm64.go index 44b7d351..8a9fb137 100644 --- a/support/support_arm64.go +++ b/support/support_arm64.go @@ -1,5 +1,4 @@ -//go:build arm64 && !dummy && !external_trigger -// +build arm64,!dummy,!external_trigger +//go:build arm64 && !dummy // Copyright The OpenTelemetry Authors // SPDX-License-Identifier: Apache-2.0 diff --git a/support/support_external_amd64.go b/support/support_external_amd64.go deleted file mode 100644 index 5a5be86d..00000000 --- a/support/support_external_amd64.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build amd64 && !dummy && external_trigger -// +build amd64,!dummy,external_trigger - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package support // import "go.opentelemetry.io/ebpf-profiler/support" - -import ( - _ "embed" -) - -//go:embed ebpf/tracer.ebpf.release.external.amd64 -var tracerData []byte diff --git a/support/support_external_arm64.go b/support/support_external_arm64.go deleted file mode 100644 index ba8690e2..00000000 --- a/support/support_external_arm64.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build arm64 && !dummy && external_trigger -// +build arm64,!dummy,external_trigger - -// Copyright The OpenTelemetry Authors -// SPDX-License-Identifier: Apache-2.0 - -package support // import "go.opentelemetry.io/ebpf-profiler/support" - -import ( - _ "embed" -) - -//go:embed ebpf/tracer.ebpf.release.external.arm64 -var tracerData []byte