linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS
@ 2025-03-28 18:38 Brian Masney
  2025-03-28 18:38 ` [PATCH 1/2] tools/bootconfig: allow overriding CFLAGS assignment Brian Masney
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Brian Masney @ 2025-03-28 18:38 UTC (permalink / raw)
  To: mhiramat; +Cc: linux-kernel, linux-trace-kernel, aruiz

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(-)

-- 
2.47.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] tools/bootconfig: allow overriding CFLAGS assignment
  2025-03-28 18:38 [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Brian Masney
@ 2025-03-28 18:38 ` Brian Masney
  2025-03-28 18:38 ` [PATCH 2/2] tools/bootconfig: specify LDFLAGS as an argument to CC Brian Masney
  2025-03-31 12:23 ` [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Masami Hiramatsu
  2 siblings, 0 replies; 6+ messages in thread
From: Brian Masney @ 2025-03-28 18:38 UTC (permalink / raw)
  To: mhiramat; +Cc: linux-kernel, linux-trace-kernel, aruiz

Allow overriding the CFLAGS assignment so that the user can pass in
an outside value.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 tools/bootconfig/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bootconfig/Makefile b/tools/bootconfig/Makefile
index 566c3e0ee561..d2713902ca5c 100644
--- a/tools/bootconfig/Makefile
+++ b/tools/bootconfig/Makefile
@@ -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))
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] tools/bootconfig: specify LDFLAGS as an argument to CC
  2025-03-28 18:38 [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Brian Masney
  2025-03-28 18:38 ` [PATCH 1/2] tools/bootconfig: allow overriding CFLAGS assignment Brian Masney
@ 2025-03-28 18:38 ` Brian Masney
  2025-03-31 12:23 ` [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Masami Hiramatsu
  2 siblings, 0 replies; 6+ messages in thread
From: Brian Masney @ 2025-03-28 18:38 UTC (permalink / raw)
  To: mhiramat; +Cc: linux-kernel, linux-trace-kernel, aruiz

Explicitly specify LDFLAGS as an argument to CC so that this can be
overridden by the user.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
 tools/bootconfig/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bootconfig/Makefile b/tools/bootconfig/Makefile
index d2713902ca5c..90eb47c9d8de 100644
--- a/tools/bootconfig/Makefile
+++ b/tools/bootconfig/Makefile
@@ -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)
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS
  2025-03-28 18:38 [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Brian Masney
  2025-03-28 18:38 ` [PATCH 1/2] tools/bootconfig: allow overriding CFLAGS assignment Brian Masney
  2025-03-28 18:38 ` [PATCH 2/2] tools/bootconfig: specify LDFLAGS as an argument to CC Brian Masney
@ 2025-03-31 12:23 ` Masami Hiramatsu
  2025-04-10 15:36   ` Brian Masney
  2025-05-16  2:25   ` Masami Hiramatsu
  2 siblings, 2 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2025-03-31 12:23 UTC (permalink / raw)
  To: Brian Masney; +Cc: linux-kernel, linux-trace-kernel, aruiz

On Fri, 28 Mar 2025 14:38:56 -0400
Brian Masney <bmasney@redhat.com> 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 assignment
>   tools/bootconfig: specify LDFLAGS as an argument to CC
> 

Both looks good to me. Let me pick those up.

Thanks!

>  tools/bootconfig/Makefile | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> -- 
> 2.47.0
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS
  2025-03-31 12:23 ` [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Masami Hiramatsu
@ 2025-04-10 15:36   ` Brian Masney
  2025-05-16  2:25   ` Masami Hiramatsu
  1 sibling, 0 replies; 6+ messages in thread
From: Brian Masney @ 2025-04-10 15:36 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: linux-kernel, linux-trace-kernel, aruiz

Hi Masami,

On Mon, Mar 31, 2025 at 8:23 AM Masami Hiramatsu <mhiramat@kernel.org> wrote:
> On Fri, 28 Mar 2025 14:38:56 -0400
> Brian Masney <bmasney@redhat.com> 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 assignment
> >   tools/bootconfig: specify LDFLAGS as an argument to CC
> >
>
> Both 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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS
  2025-03-31 12:23 ` [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Masami Hiramatsu
  2025-04-10 15:36   ` Brian Masney
@ 2025-05-16  2:25   ` Masami Hiramatsu
  1 sibling, 0 replies; 6+ messages in thread
From: Masami Hiramatsu @ 2025-05-16  2:25 UTC (permalink / raw)
  To: Masami Hiramatsu; +Cc: Brian Masney, linux-kernel, linux-trace-kernel, aruiz

On Mon, 31 Mar 2025 21:23:37 +0900
Masami Hiramatsu (Google) <mhiramat@kernel.org> wrote:

> On Fri, 28 Mar 2025 14:38:56 -0400
> Brian Masney <bmasney@redhat.com> 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 assignment
> >   tools/bootconfig: specify LDFLAGS as an argument to CC
> > 
> 
> Both 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!

> Thanks!
> 
> >  tools/bootconfig/Makefile | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > -- 
> > 2.47.0
> > 
> 
> 
> -- 
> Masami Hiramatsu (Google) <mhiramat@kernel.org>


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-05-16  2:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-28 18:38 [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Brian Masney
2025-03-28 18:38 ` [PATCH 1/2] tools/bootconfig: allow overriding CFLAGS assignment Brian Masney
2025-03-28 18:38 ` [PATCH 2/2] tools/bootconfig: specify LDFLAGS as an argument to CC Brian Masney
2025-03-31 12:23 ` [PATCH 0/2] tools/bootconfig: allow overriding CFLAGS and LDFLAGS Masami Hiramatsu
2025-04-10 15:36   ` Brian Masney
2025-05-16  2:25   ` Masami Hiramatsu

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).