Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] selftests/resctrl: fix clang build failure: use LOCAL_HDRS
@ 2024-05-03  2:17 John Hubbard
  2024-05-03 18:39 ` Reinette Chatre
  0 siblings, 1 reply; 3+ messages in thread
From: John Hubbard @ 2024-05-03  2:17 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Fenghua Yu, Reinette Chatre, Valentin Obst, linux-kselftest, LKML,
	llvm, John Hubbard, Ilpo Järvinen

First of all, in order to build with clang at all, one must first apply
Valentin Obst's build fix for LLVM [1]. Once that is done, then when
building with clang, via:

    make LLVM=1 -C tools/testing/selftests

...the following error occurs:

   clang: error: cannot specify -o when generating multiple output files

This is because clang, unlike gcc, won't accept invocations of this
form:

    clang file1.c header2.h

Fix this by using selftests/lib.mk facilities for tracking local header
file dependencies: add them to LOCAL_HDRS, leaving only the .c files to
be passed to the compiler.

[1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/

Fixes: 8e289f454289 ("selftests/resctrl: Add resctrl.h into build deps")
Cc: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: John Hubbard <jhubbard@nvidia.com>
---
 tools/testing/selftests/resctrl/Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/resctrl/Makefile b/tools/testing/selftests/resctrl/Makefile
index 2deac2031de9..021863f86053 100644
--- a/tools/testing/selftests/resctrl/Makefile
+++ b/tools/testing/selftests/resctrl/Makefile
@@ -5,6 +5,8 @@ CFLAGS += $(KHDR_INCLUDES)
 
 TEST_GEN_PROGS := resctrl_tests
 
+LOCAL_HDRS += $(wildcard *.h)
+
 include ../lib.mk
 
-$(OUTPUT)/resctrl_tests: $(wildcard *.[ch])
+$(OUTPUT)/resctrl_tests: $(wildcard *.c)

base-commit: f03359bca01bf4372cf2c118cd9a987a5951b1c8
prerequisite-patch-id: b901ece2a5b78503e2fb5480f20e304d36a0ea27
-- 
2.45.0


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

* Re: [PATCH] selftests/resctrl: fix clang build failure: use LOCAL_HDRS
  2024-05-03  2:17 [PATCH] selftests/resctrl: fix clang build failure: use LOCAL_HDRS John Hubbard
@ 2024-05-03 18:39 ` Reinette Chatre
  2024-05-03 19:26   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Reinette Chatre @ 2024-05-03 18:39 UTC (permalink / raw)
  To: John Hubbard, Shuah Khan
  Cc: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Fenghua Yu, Valentin Obst, linux-kselftest, LKML, llvm,
	Ilpo Järvinen



On 5/2/2024 7:17 PM, John Hubbard wrote:
> First of all, in order to build with clang at all, one must first apply
> Valentin Obst's build fix for LLVM [1]. Once that is done, then when
> building with clang, via:
> 
>     make LLVM=1 -C tools/testing/selftests
> 
> ...the following error occurs:
> 
>    clang: error: cannot specify -o when generating multiple output files
> 
> This is because clang, unlike gcc, won't accept invocations of this
> form:
> 
>     clang file1.c header2.h
> 
> Fix this by using selftests/lib.mk facilities for tracking local header
> file dependencies: add them to LOCAL_HDRS, leaving only the .c files to
> be passed to the compiler.
> 
> [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/
> 
> Fixes: 8e289f454289 ("selftests/resctrl: Add resctrl.h into build deps")
> Cc: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
> ---

Thank you.

Acked-by: Reinette Chatre <reinette.chatre@intel.com>

Reinette


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

* Re: [PATCH] selftests/resctrl: fix clang build failure: use LOCAL_HDRS
  2024-05-03 18:39 ` Reinette Chatre
@ 2024-05-03 19:26   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2024-05-03 19:26 UTC (permalink / raw)
  To: Reinette Chatre, John Hubbard, Shuah Khan
  Cc: Nathan Chancellor, Nick Desaulniers, Bill Wendling, Justin Stitt,
	Fenghua Yu, Valentin Obst, linux-kselftest, LKML, llvm,
	Ilpo Järvinen, Shuah Khan

On 5/3/24 12:39, Reinette Chatre wrote:
> 
> 
> On 5/2/2024 7:17 PM, John Hubbard wrote:
>> First of all, in order to build with clang at all, one must first apply
>> Valentin Obst's build fix for LLVM [1]. Once that is done, then when
>> building with clang, via:
>>
>>      make LLVM=1 -C tools/testing/selftests
>>
>> ...the following error occurs:
>>
>>     clang: error: cannot specify -o when generating multiple output files
>>
>> This is because clang, unlike gcc, won't accept invocations of this
>> form:
>>
>>      clang file1.c header2.h
>>
>> Fix this by using selftests/lib.mk facilities for tracking local header
>> file dependencies: add them to LOCAL_HDRS, leaving only the .c files to
>> be passed to the compiler.
>>
>> [1] https://lore.kernel.org/all/20240329-selftests-libmk-llvm-rfc-v1-1-2f9ed7d1c49f@valentinobst.de/
>>
>> Fixes: 8e289f454289 ("selftests/resctrl: Add resctrl.h into build deps")
>> Cc: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
>> Signed-off-by: John Hubbard <jhubbard@nvidia.com>
>> ---
> 
> Thank you.
> 
> Acked-by: Reinette Chatre <reinette.chatre@intel.com>
> 
> Reinette
> 

Thank you. Applied to linux-kselftest next for Linux 6.10-rc1

thanks,
-- Shuah

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

end of thread, other threads:[~2024-05-03 19:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-03  2:17 [PATCH] selftests/resctrl: fix clang build failure: use LOCAL_HDRS John Hubbard
2024-05-03 18:39 ` Reinette Chatre
2024-05-03 19:26   ` Shuah Khan

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