mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] kbuild: normalize paths in quiet compile output
@ 2026-06-08  7:00 Yang Wang
  2026-06-08 22:08 ` Nathan Chancellor
  0 siblings, 1 reply; 3+ messages in thread
From: Yang Wang @ 2026-06-08  7:00 UTC (permalink / raw)
  To: linux-kbuild, linux-kernel, amd-gfx; +Cc: nathan, nsc

Composite objects may contain relative components in their member object
paths. This can make quiet compile output include noisy dot-dot components,
for example:

  CC [M]  drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_module.o

Use the existing normalize_path helper for quiet C and assembly compile
output so the same target is printed as:

  CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_module.o

The actual compile commands still use $@, so object paths, dependency
tracking and generated files are unchanged.

Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
---
 scripts/Makefile.lib | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 28a1c08e3b22..7d1589d993a8 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -239,7 +239,7 @@ ifdef CONFIG_LTO_CLANG
 cmd_ld_single = $(if $(objtool-enabled)$(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-target) $@)
 endif
 
-quiet_cmd_cc_o_c = CC $(quiet_modtag)  $@
+quiet_cmd_cc_o_c = CC $(quiet_modtag)  $(call normalize_path,$@)
       cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< \
 		$(cmd_ld_single) \
 		$(cmd_objtool)
@@ -254,7 +254,7 @@ define rule_cc_o_c
 	$(call cmd,warn_shared_object)
 endef
 
-quiet_cmd_as_o_S = AS $(quiet_modtag)  $@
+quiet_cmd_as_o_S = AS $(quiet_modtag)  $(call normalize_path,$@)
       cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool)
 
 define rule_as_o_S
-- 
2.47.3


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

* Re: [PATCH] kbuild: normalize paths in quiet compile output
  2026-06-08  7:00 [PATCH] kbuild: normalize paths in quiet compile output Yang Wang
@ 2026-06-08 22:08 ` Nathan Chancellor
  2026-06-09  1:28   ` Wang, Yang(Kevin)
  0 siblings, 1 reply; 3+ messages in thread
From: Nathan Chancellor @ 2026-06-08 22:08 UTC (permalink / raw)
  To: Yang Wang; +Cc: linux-kbuild, linux-kernel, amd-gfx, nsc

Hi Yang,

On Mon, Jun 08, 2026 at 03:00:39PM +0800, Yang Wang wrote:
> Composite objects may contain relative components in their member object
> paths. This can make quiet compile output include noisy dot-dot components,
> for example:
> 
>   CC [M]  drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_module.o
> 
> Use the existing normalize_path helper for quiet C and assembly compile
> output so the same target is printed as:
> 
>   CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_module.o
> 
> The actual compile commands still use $@, so object paths, dependency
> tracking and generated files are unchanged.
> 
> Signed-off-by: Yang Wang <kevinyang.wang@amd.com>

While I agree that the dots are ugly, I do not want to take this change
because it makes it harder to figure out how to build these .o files
individually. For example:

  $ make -kj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- mrproper allmodconfig drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_module.o
  ...
    CC [M]  drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_module.o

works for building this file individually but the normalized path
produced by this patch

  $ make -kj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux- mrproper allmodconfig drivers/gpu/drm/amd/amdkfd/kfd_module.o
  ...
    CC      drivers/gpu/drm/amd/amdkfd/kfd_module.o
  In file included from drivers/gpu/drm/amd/amdkfd/kfd_module.c:26:
  drivers/gpu/drm/amd/amdkfd/kfd_priv.h:46:10: fatal error: kgd_kfd_interface.h: No such file or directory
     46 | #include <kgd_kfd_interface.h>
        |          ^~~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  make[7]: *** [scripts/Makefile.build:289: drivers/gpu/drm/amd/amdkfd/kfd_module.o] Error 1

does not.

> ---
>  scripts/Makefile.lib | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 28a1c08e3b22..7d1589d993a8 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -239,7 +239,7 @@ ifdef CONFIG_LTO_CLANG
>  cmd_ld_single = $(if $(objtool-enabled)$(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-target) $@)
>  endif
>  
> -quiet_cmd_cc_o_c = CC $(quiet_modtag)  $@
> +quiet_cmd_cc_o_c = CC $(quiet_modtag)  $(call normalize_path,$@)
>        cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< \
>  		$(cmd_ld_single) \
>  		$(cmd_objtool)
> @@ -254,7 +254,7 @@ define rule_cc_o_c
>  	$(call cmd,warn_shared_object)
>  endef
>  
> -quiet_cmd_as_o_S = AS $(quiet_modtag)  $@
> +quiet_cmd_as_o_S = AS $(quiet_modtag)  $(call normalize_path,$@)
>        cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool)
>  
>  define rule_as_o_S
> -- 
> 2.47.3
> 

-- 
Cheers,
Nathan

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

* RE: [PATCH] kbuild: normalize paths in quiet compile output
  2026-06-08 22:08 ` Nathan Chancellor
@ 2026-06-09  1:28   ` Wang, Yang(Kevin)
  0 siblings, 0 replies; 3+ messages in thread
From: Wang, Yang(Kevin) @ 2026-06-09  1:28 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: linux-kbuild, linux-kernel, amd-gfx, nsc

AMD General

> -----Original Message-----
> From: Nathan Chancellor <nathan@kernel.org>
> Sent: Tuesday, June 9, 2026 6:09 AM
> To: Wang, Yang(Kevin) <KevinYang.Wang@amd.com>
> Cc: linux-kbuild@vger.kernel.org; linux-kernel@vger.kernel.org; amd-
> gfx@lists.freedesktop.org; nsc@kernel.org
> Subject: Re: [PATCH] kbuild: normalize paths in quiet compile output
>
> Hi Yang,
>
> On Mon, Jun 08, 2026 at 03:00:39PM +0800, Yang Wang wrote:
> > Composite objects may contain relative components in their member
> > object paths. This can make quiet compile output include noisy dot-dot
> > components, for example:
> >
> >   CC [M]  drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_module.o
> >
> > Use the existing normalize_path helper for quiet C and assembly
> > compile output so the same target is printed as:
> >
> >   CC [M]  drivers/gpu/drm/amd/amdkfd/kfd_module.o
> >
> > The actual compile commands still use $@, so object paths, dependency
> > tracking and generated files are unchanged.
> >
> > Signed-off-by: Yang Wang <kevinyang.wang@amd.com>
>
> While I agree that the dots are ugly, I do not want to take this change because
> it makes it harder to figure out how to build these .o files individually. For
> example:

Got it, thanks for the testing and explanation. I see the problem with direct single-file builds now.

Best Regards,
Kevin
>
>   $ make -kj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux-
> mrproper allmodconfig
> drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_module.o
>   ...
>     CC [M]  drivers/gpu/drm/amd/amdgpu/../amdkfd/kfd_module.o
>
> works for building this file individually but the normalized path produced by
> this patch
>
>   $ make -kj"$(nproc)" ARCH=x86_64 CROSS_COMPILE=x86_64-linux-
> mrproper allmodconfig drivers/gpu/drm/amd/amdkfd/kfd_module.o
>   ...
>     CC      drivers/gpu/drm/amd/amdkfd/kfd_module.o
>   In file included from drivers/gpu/drm/amd/amdkfd/kfd_module.c:26:
>   drivers/gpu/drm/amd/amdkfd/kfd_priv.h:46:10: fatal error:
> kgd_kfd_interface.h: No such file or directory
>      46 | #include <kgd_kfd_interface.h>
>         |          ^~~~~~~~~~~~~~~~~~~~~
>   compilation terminated.
>   make[7]: *** [scripts/Makefile.build:289:
> drivers/gpu/drm/amd/amdkfd/kfd_module.o] Error 1
>
> does not.
>
> > ---
> >  scripts/Makefile.lib | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index
> > 28a1c08e3b22..7d1589d993a8 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -239,7 +239,7 @@ ifdef CONFIG_LTO_CLANG  cmd_ld_single = $(if
> > $(objtool-enabled)$(is-single-obj-m), ; $(LD) $(ld_flags) -r -o
> > $(tmp-target) $@; mv $(tmp-target) $@)  endif
> >
> > -quiet_cmd_cc_o_c = CC $(quiet_modtag)  $@
> > +quiet_cmd_cc_o_c = CC $(quiet_modtag)  $(call normalize_path,$@)
> >        cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< \
> >             $(cmd_ld_single) \
> >             $(cmd_objtool)
> > @@ -254,7 +254,7 @@ define rule_cc_o_c
> >     $(call cmd,warn_shared_object)
> >  endef
> >
> > -quiet_cmd_as_o_S = AS $(quiet_modtag)  $@
> > +quiet_cmd_as_o_S = AS $(quiet_modtag)  $(call normalize_path,$@)
> >        cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool)
> >
> >  define rule_as_o_S
> > --
> > 2.47.3
> >
>
> --
> Cheers,
> Nathan

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

end of thread, other threads:[~2026-06-09  1:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-08  7:00 [PATCH] kbuild: normalize paths in quiet compile output Yang Wang
2026-06-08 22:08 ` Nathan Chancellor
2026-06-09  1:28   ` Wang, Yang(Kevin)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®