[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250107170110.2819685-1-kevin.brodsky@arm.com>
Date: Tue, 7 Jan 2025 17:01:10 +0000
From: Kevin Brodsky <kevin.brodsky@....com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org,
Kevin Brodsky <kevin.brodsky@....com>,
Ryan Roberts <ryan.roberts@....com>,
aruna.ramakrishna@...cle.com,
catalin.marinas@....com,
dave.hansen@...ux.intel.com,
joey.gouly@....com,
keith.lucas@...cle.com,
shuah@...nel.org,
linux-arm-kernel@...ts.infradead.org,
linux-kselftest@...r.kernel.org,
linux-mm@...ck.org,
x86@...nel.org
Subject: [PATCH] selftests/mm: silence unused-result warnings
Switching to -O2 when building the mm tests has the unexpected side
effect of triggering many unused-result warnings on certain distros
like Ubuntu, where GCC is configured so that -O2 implies
-D_FORTIFY_SOURCE.
Explicitly disable FORTIFY_SOURCE to avoid those warnings. This has
no effect on upstream toolchains where FORTIFY_SOURCE is not
implicitly enabled.
Suggested-by: Ryan Roberts <ryan.roberts@....com>
Signed-off-by: Kevin Brodsky <kevin.brodsky@....com>
---
Hi Andrew,
Could you please take this fixup patch for "selftests/mm: Build with
-O2" in mm-unstable? Ryan found that building the mm kselftests on
Ubuntu yields a bunch of warnings, this patch suppresses them.
Cheers,
- Kevin
Cc: aruna.ramakrishna@...cle.com
Cc: catalin.marinas@....com
Cc: dave.hansen@...ux.intel.com
Cc: joey.gouly@....com
Cc: keith.lucas@...cle.com
Cc: shuah@...nel.org
Cc: linux-arm-kernel@...ts.infradead.org
Cc: linux-kselftest@...r.kernel.org
Cc: linux-mm@...ck.org
Cc: x86@...nel.org
---
tools/testing/selftests/mm/Makefile | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile
index fce194a92cad..d633d6b6a6e1 100644
--- a/tools/testing/selftests/mm/Makefile
+++ b/tools/testing/selftests/mm/Makefile
@@ -36,6 +36,13 @@ MAKEFLAGS += --no-builtin-rules
CFLAGS = -Wall -O2 -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
LDLIBS = -lrt -lpthread -lm
+# Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is
+# automatically enabled at -O1 or above. This triggers various unused-result
+# warnings where functions such as read() or write() are called and their
+# return value is not checked. Disable _FORTIFY_SOURCE to silence those
+# warnings.
+CFLAGS += -U_FORTIFY_SOURCE
+
KDIR ?= /lib/modules/$(shell uname -r)/build
ifneq (,$(wildcard $(KDIR)/Module.symvers))
ifneq (,$(wildcard $(KDIR)/include/linux/page_frag_cache.h))
--
2.47.0
Powered by blists - more mailing lists