Skip to content

cmd/bpf2go: Use BPF2GO_CFLAGS instead of BPF2GO_FLAGS #1796

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

Merged
merged 2 commits into from
Jun 10, 2025
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 @@ -63,7 +63,7 @@ container-all:
-v "${REPODIR}":/ebpf -w /ebpf --env MAKEFLAGS \
--env HOME="/tmp" \
--env BPF2GO_CC="$(CLANG)" \
--env BPF2GO_FLAGS="-fdebug-prefix-map=/ebpf=. $(CFLAGS)" \
--env BPF2GO_CFLAGS="$(CFLAGS)" \
"${IMAGE}:${VERSION}" \
make all

Expand All @@ -73,7 +73,7 @@ container-shell:
${CONTAINER_ENGINE} run --rm -ti \
-v "${REPODIR}":/ebpf -w /ebpf \
--env BPF2GO_CC="$(CLANG)" \
--env BPF2GO_FLAGS="-fdebug-prefix-map=/ebpf=. $(CFLAGS)" \
--env BPF2GO_CFLAGS="$(CFLAGS)" \
"${IMAGE}:${VERSION}"

clean:
Expand Down
4 changes: 2 additions & 2 deletions cmd/bpf2go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ endian systems, respectively.
You can use environment variables to affect all bpf2go invocations
across a project, e.g. to set specific C flags:

BPF2GO_FLAGS="-O2 -g -Wall -Werror $(CFLAGS)" go generate ./...
BPF2GO_CFLAGS="-O2 -g -Wall -Werror $(CFLAGS)" go generate ./...

Alternatively, by exporting `$BPF2GO_FLAGS` from your build system, you can
Alternatively, by exporting `$BPF2GO_CFLAGS` from your build system, you can
control all builds from a single location.

Most bpf2go arguments can be controlled this way. See `bpf2go -h` for an
Expand Down
Loading