linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] selftests: Use -isystem instead of -I to include headers
@ 2022-02-14 16:07 Muhammad Usama Anjum
  2022-02-14 19:25 ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Muhammad Usama Anjum @ 2022-02-14 16:07 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Muhammad Usama Anjum, kernel, sherry.yang, keescook,
	linux-kselftest, linux-kernel

Selftests need kernel headers and glibc for compilation. In compilation
of selftests, uapi headers from kernel source are used instead of
default ones while glibc has already been compiled with different header
files installed in the operating system. So there can be redefination
warnings from compiler. These warnings can be suppressed by using
-isystem to include the uapi headers.

Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
---
Changes in V2:
Remove debug code
---
 tools/testing/selftests/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/Makefile b/tools/testing/selftests/Makefile
index 4eda7c7c15694..06cc683f81b1a 100644
--- a/tools/testing/selftests/Makefile
+++ b/tools/testing/selftests/Makefile
@@ -130,11 +130,11 @@ ifneq ($(KBUILD_OUTPUT),)
   # $(realpath ...) resolves symlinks
   abs_objtree := $(realpath $(abs_objtree))
   BUILD := $(abs_objtree)/kselftest
-  KHDR_INCLUDES := -I${abs_objtree}/usr/include
+  KHDR_INCLUDES := -isystem ${abs_objtree}/usr/include
 else
   BUILD := $(CURDIR)
   abs_srctree := $(shell cd $(top_srcdir) && pwd)
-  KHDR_INCLUDES := -I${abs_srctree}/usr/include
+  KHDR_INCLUDES := -isystem ${abs_srctree}/usr/include
   DEFAULT_INSTALL_HDR_PATH := 1
 endif
 
-- 
2.30.2


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

* Re: [PATCH V2] selftests: Use -isystem instead of -I to include headers
  2022-02-14 16:07 [PATCH V2] selftests: Use -isystem instead of -I to include headers Muhammad Usama Anjum
@ 2022-02-14 19:25 ` Kees Cook
  2022-02-14 21:16   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2022-02-14 19:25 UTC (permalink / raw)
  To: Muhammad Usama Anjum
  Cc: Shuah Khan, kernel, sherry.yang, linux-kselftest, linux-kernel

On Mon, Feb 14, 2022 at 09:07:56PM +0500, Muhammad Usama Anjum wrote:
> Selftests need kernel headers and glibc for compilation. In compilation
> of selftests, uapi headers from kernel source are used instead of
> default ones while glibc has already been compiled with different header
> files installed in the operating system. So there can be redefination
> warnings from compiler. These warnings can be suppressed by using
> -isystem to include the uapi headers.
> 
> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-- 
Kees Cook

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

* Re: [PATCH V2] selftests: Use -isystem instead of -I to include headers
  2022-02-14 19:25 ` Kees Cook
@ 2022-02-14 21:16   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2022-02-14 21:16 UTC (permalink / raw)
  To: Kees Cook, Muhammad Usama Anjum, Andrew Morton
  Cc: Shuah Khan, kernel, sherry.yang, linux-kselftest, linux-kernel,
	Shuah Khan

On 2/14/22 12:25 PM, Kees Cook wrote:
> On Mon, Feb 14, 2022 at 09:07:56PM +0500, Muhammad Usama Anjum wrote:
>> Selftests need kernel headers and glibc for compilation. In compilation
>> of selftests, uapi headers from kernel source are used instead of
>> default ones while glibc has already been compiled with different header
>> files installed in the operating system. So there can be redefination

Spelling - redefinition

>> warnings from compiler. These warnings can be suppressed by using
>> -isystem to include the uapi headers.
>>
>> Signed-off-by: Muhammad Usama Anjum <usama.anjum@collabora.com>
> 
> Reviewed-by: Kees Cook <keescook@chromium.org>
> 

Looks good to me. With the above minor type fixed:

Reviewed-by: Shuah Khan <skhan@linuxfoundation.org>

This one depends on an earlier patch that added that added KHDR_INCLUDES
which is in Andrew's

https://ozlabs.org/~akpm/mmotm/broken-out/selftests-add-and-export-a-kernel-uapi-headers-path.patch

Andrew, would you like to take this through your tree?

thanks,
-- Shuah

Would you like to apply this on top of th

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

end of thread, other threads:[~2022-02-14 21:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-14 16:07 [PATCH V2] selftests: Use -isystem instead of -I to include headers Muhammad Usama Anjum
2022-02-14 19:25 ` Kees Cook
2022-02-14 21:16   ` Shuah Khan

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