bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andrii@kernel.org>
To: <bpf@vger.kernel.org>, <netdev@vger.kernel.org>, <ast@fb.com>,
	<daniel@iogearbox.net>
Cc: <andrii@kernel.org>, <kernel-team@fb.com>, Yonghong Song <yhs@fb.com>
Subject: [PATCH v3 bpf-next 13/18] selftests/bpf: use -O0 instead of -Og in selftests builds
Date: Fri, 23 Apr 2021 11:13:43 -0700	[thread overview]
Message-ID: <20210423181348.1801389-14-andrii@kernel.org> (raw)
In-Reply-To: <20210423181348.1801389-1-andrii@kernel.org>

While -Og is designed to work well with debugger, it's still inferior to -O0
in terms of debuggability experience. It will cause some variables to still be
inlined, it will also prevent single-stepping some statements and otherwise
interfere with debugging experience. So switch to -O0 which turns off any
optimization and provides the best debugging experience.

Acked-by: Yonghong Song <yhs@fb.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
---
 tools/testing/selftests/bpf/Makefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index c5bcdb3d4b12..dd8061069b08 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -21,7 +21,7 @@ endif
 
 BPF_GCC		?= $(shell command -v bpf-gcc;)
 SAN_CFLAGS	?=
-CFLAGS += -g -Og -rdynamic -Wall $(GENFLAGS) $(SAN_CFLAGS)		\
+CFLAGS += -g -O0 -rdynamic -Wall $(GENFLAGS) $(SAN_CFLAGS)		\
 	  -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR)		\
 	  -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT)			\
 	  -Dbpf_prog_load=bpf_prog_test_load				\
@@ -205,7 +205,7 @@ $(DEFAULT_BPFTOOL): $(wildcard $(BPFTOOLDIR)/*.[ch] $(BPFTOOLDIR)/Makefile)    \
 		    $(HOST_BPFOBJ) | $(HOST_BUILD_DIR)/bpftool
 	$(Q)$(MAKE) $(submake_extras)  -C $(BPFTOOLDIR)			       \
 		    CC=$(HOSTCC) LD=$(HOSTLD)				       \
-		    EXTRA_CFLAGS='-g -Og'				       \
+		    EXTRA_CFLAGS='-g -O0'				       \
 		    OUTPUT=$(HOST_BUILD_DIR)/bpftool/			       \
 		    prefix= DESTDIR=$(HOST_SCRATCH_DIR)/ install
 
@@ -225,7 +225,7 @@ $(BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile)		       \
 	   ../../../include/uapi/linux/bpf.h                                   \
 	   | $(INCLUDE_DIR) $(BUILD_DIR)/libbpf
 	$(Q)$(MAKE) $(submake_extras) -C $(BPFDIR) OUTPUT=$(BUILD_DIR)/libbpf/ \
-		    EXTRA_CFLAGS='-g -Og'					       \
+		    EXTRA_CFLAGS='-g -O0'				       \
 		    DESTDIR=$(SCRATCH_DIR) prefix= all install_headers
 
 ifneq ($(BPFOBJ),$(HOST_BPFOBJ))
@@ -233,7 +233,7 @@ $(HOST_BPFOBJ): $(wildcard $(BPFDIR)/*.[ch] $(BPFDIR)/Makefile)                \
 	   ../../../include/uapi/linux/bpf.h                                   \
 	   | $(INCLUDE_DIR) $(HOST_BUILD_DIR)/libbpf
 	$(Q)$(MAKE) $(submake_extras) -C $(BPFDIR)                             \
-		    EXTRA_CFLAGS='-g -Og'					       \
+		    EXTRA_CFLAGS='-g -O0'				       \
 		    OUTPUT=$(HOST_BUILD_DIR)/libbpf/ CC=$(HOSTCC) LD=$(HOSTLD) \
 		    DESTDIR=$(HOST_SCRATCH_DIR)/ prefix= all install_headers
 endif
-- 
2.30.2


  parent reply	other threads:[~2021-04-23 18:14 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 18:13 [PATCH v3 bpf-next 00/18] BPF static linker: support externs Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 01/18] bpftool: support dumping BTF VAR's "extern" linkage Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 02/18] bpftool: dump more info about DATASEC members Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 03/18] libbpf: suppress compiler warning when using SEC() macro with externs Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 04/18] libbpf: mark BPF subprogs with hidden visibility as static for BPF verifier Andrii Nakryiko
2021-04-23 18:23   ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 05/18] libbpf: allow gaps in BPF program sections to support overriden weak functions Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 06/18] libbpf: refactor BTF map definition parsing Andrii Nakryiko
2021-04-23 18:36   ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 07/18] libbpf: factor out symtab and relos sanity checks Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 08/18] libbpf: make few internal helpers available outside of libbpf.c Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 09/18] libbpf: extend sanity checking ELF symbols with externs validation Andrii Nakryiko
2021-04-23 18:39   ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 10/18] libbpf: tighten BTF type ID rewriting with error checking Andrii Nakryiko
2021-04-23 18:40   ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 11/18] libbpf: add linker extern resolution support for functions and global variables Andrii Nakryiko
2021-04-23 18:46   ` Yonghong Song
2021-04-23 18:13 ` [PATCH v3 bpf-next 12/18] libbpf: support extern resolution for BTF-defined maps in .maps section Andrii Nakryiko
2021-04-23 18:49   ` Yonghong Song
2021-04-23 18:13 ` Andrii Nakryiko [this message]
2021-04-23 18:13 ` [PATCH v3 bpf-next 14/18] selftests/bpf: omit skeleton generation for multi-linked BPF object files Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 15/18] selftests/bpf: add function linking selftest Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 16/18] selftests/bpf: add global variables " Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 17/18] selftests/bpf: add map " Andrii Nakryiko
2021-04-23 18:53   ` Yonghong Song
2021-04-23 21:23     ` Alexei Starovoitov
2021-04-23 21:39       ` Andrii Nakryiko
2021-04-23 18:13 ` [PATCH v3 bpf-next 18/18] selftests/bpf: document latest Clang fix expectations for linking tests Andrii Nakryiko
2021-04-23 18:51   ` Yonghong Song

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210423181348.1801389-14-andrii@kernel.org \
    --to=andrii@kernel.org \
    --cc=ast@fb.com \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).