tools/bootconfig: allow overriding CFLAGS and LDFLAGS
Subsystems (2)
cover tools/bootconfig: allow overriding CFLAGS and LDFLAGS
Allow the user to override the CFLAGS and LDFLAGS similar to what's currently done on other kernel tools. These changes allows bootconfig to be compiled with the hardened compiler and linker flags.
Brian Masney (2):
tools/bootconfig: allow overriding CFLAGS assignment tools/bootconfig: specify LDFLAGS as an argument to CC
tools/bootconfig/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 1 line
2.47.0
PATCH 1/2 tools/bootconfig: allow overriding CFLAGS assignment
Allow overriding the CFLAGS assignment so that the user can pass in an outside value.
--- tools/bootconfig/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bootconfig/Makefile +1 -1
@@ -10,7 +10,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree))) endif LIBSRC = $(srctree)/lib/bootconfig.c $(srctree)/include/linux/bootconfig.h -CFLAGS = -Wall -g -I$(CURDIR)/include +override CFLAGS += -Wall -g -I$(CURDIR)/include ALL_TARGETS := bootconfig ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS))
Signature · 1 line
2.47.0
PATCH 2/2 tools/bootconfig: specify LDFLAGS as an argument to CC
In reply to Brian MasneyExplicitly specify LDFLAGS as an argument to CC so that this can be overridden by the user.
--- tools/bootconfig/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/bootconfig/Makefile +1 -1
@@ -18,7 +18,7 @@ ALL_PROGRAMS := $(patsubst %,$(OUTPUT)%,$(ALL_TARGETS)) all: $(ALL_PROGRAMS) test $(OUTPUT)bootconfig: main.c include/linux/bootconfig.h $(LIBSRC) - $(CC) $(filter %.c,$^) $(CFLAGS) -o $@ + $(CC) $(filter %.c,$^) $(CFLAGS) $(LDFLAGS) -o $@ test: $(ALL_PROGRAMS) test-bootconfig.sh ./test-bootconfig.sh $(OUTPUT)
Signature · 1 line
2.47.0
Masami Hiramatsu (Google)
maintainerQuoted 8 lines · On Fri, 28 Mar 2025 14:38:56 -0400 Brian Masney <[email protected]> wrote:
Allow the user to override the CFLAGS and LDFLAGS similar to what's currently done on other kernel tools. These changes allows bootconfig to be compiled with the hardened compiler and linker flags.
Brian Masney (2):
tools/bootconfig: allow overriding CFLAGS assignmenttools/bootconfig: specify LDFLAGS as an argument to CC
Both looks good to me. Let me pick those up.
Thanks!
Quoted 6 lines
tools/bootconfig/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Signature · 1 line
2.47.0
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Hi Masami,
Quoted 7 lines · Masami Hiramatsu
Quoted 4 lines · On Fri, 28 Mar 2025 14:38:56 -0400 Brian Masney <[email protected]> wrote:
Allow the user to override the CFLAGS and LDFLAGS similar to what's currently done on other kernel tools. These changes allows bootconfig to be compiled with the hardened compiler and linker flags.
Quoted 6 lines
Quoted 4 lines
Brian Masney (2):
tools/bootconfig: allow overriding CFLAGS assignmenttools/bootconfig: specify LDFLAGS as an argument to CCBoth looks good to me. Let me pick those up.
Should these show up in linux-next by now? I see them in your tree at:
https://web.git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git/log/?h=bootconfig/tools
But not in the for-next branch.
Thanks,
Brian
Masami Hiramatsu (Google)
maintainerQuoted 7 lines · On Mon, 31 Mar 2025 21:23:37 +0900 Masami Hiramatsu (Google)…
Quoted 4 lines · On Fri, 28 Mar 2025 14:38:56 -0400 Brian Masney <[email protected]> wrote:
Allow the user to override the CFLAGS and LDFLAGS similar to what's currently done on other kernel tools. These changes allows bootconfig to be compiled with the hardened compiler and linker flags.
Quoted 7 lines
Quoted 4 lines
Brian Masney (2):
tools/bootconfig: allow overriding CFLAGS assignmenttools/bootconfig: specify LDFLAGS as an argument to CCBoth looks good to me. Let me pick those up.
Sorry, somehow I missed these patches. I confirmed
tools/bootconfig$ make LDFLAGS=-static
passed the tests and it is statically linked! :)
tools/bootconfig$ file bootconfig
bootconfig: ELF 64-bit LSB executable, x86-64, version 1 (GNU/Linux), statically linked, BuildID[sha1]=88323308c8d2cc45d1985ef94751bfd60199b32b, for GNU/Linux 3.2.0, with debug_info, not stripped
Thanks!
Quoted 12 lines
Thanks!
Quoted 6 lines
tools/bootconfig/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)Signature · 1 line
2.47.0Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>
Signature · 1 line
Masami Hiramatsu (Google) <[email protected]>