Skip to content

Commit

Permalink
Removing compilation changes
Browse files Browse the repository at this point in the history
Signed-off-by: Amit Schendel <amitschendel@gmail.com>
  • Loading branch information
amitschendel committed Oct 20, 2024
1 parent 64c3f2c commit 002255c
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 72 deletions.
21 changes: 6 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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 \
Expand All @@ -141,4 +132,4 @@ legal:
@./legal/add-non-go.sh legal/non-go-dependencies.json LICENSES

codespell:
@codespell
@codespell
29 changes: 4 additions & 25 deletions support/ebpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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

Expand 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 $@
Expand All @@ -108,4 +87,4 @@ bloatcheck: $(TRACER_NAME)
python3 bloat-o-meter $(TRACER_NAME).baseline $(TRACER_NAME)

clean:
rm -f *.o
rm -f *.o
3 changes: 1 addition & 2 deletions support/support_amd64.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 1 addition & 2 deletions support/support_arm64.go
Original file line number Diff line number Diff line change
@@ -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
Expand Down
14 changes: 0 additions & 14 deletions support/support_external_amd64.go

This file was deleted.

14 changes: 0 additions & 14 deletions support/support_external_arm64.go

This file was deleted.

0 comments on commit 002255c

Please sign in to comment.