Skip to content

Commit d9eb5a1

Browse files
kevin-brodsky-armgregkh
authored andcommitted
selftests/mm: build with -O2
commit 4603618 upstream. The mm kselftests are currently built with no optimisation (-O0). It's unclear why, and besides being obviously suboptimal, this also prevents the pkeys tests from working as intended. Let's build all the tests with -O2. [kevin.brodsky@arm.com: silence unused-result warnings] Link: https://lkml.kernel.org/r/20250107170110.2819685-1-kevin.brodsky@arm.com Link: https://lkml.kernel.org/r/20241209095019.1732120-6-kevin.brodsky@arm.com Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Cc: Aruna Ramakrishna <aruna.ramakrishna@oracle.com> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: Joey Gouly <joey.gouly@arm.com> Cc: Keith Lucas <keith.lucas@oracle.com> Cc: Ryan Roberts <ryan.roberts@arm.com> Cc: Shuah Khan <shuah@kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent fb259e6 commit d9eb5a1

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tools/testing/selftests/mm/Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,16 @@ endif
3333
# LDLIBS.
3434
MAKEFLAGS += --no-builtin-rules
3535

36-
CFLAGS = -Wall -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
36+
CFLAGS = -Wall -O2 -I $(top_srcdir) $(EXTRA_CFLAGS) $(KHDR_INCLUDES) $(TOOLS_INCLUDES)
3737
LDLIBS = -lrt -lpthread -lm
3838

39+
# Some distributions (such as Ubuntu) configure GCC so that _FORTIFY_SOURCE is
40+
# automatically enabled at -O1 or above. This triggers various unused-result
41+
# warnings where functions such as read() or write() are called and their
42+
# return value is not checked. Disable _FORTIFY_SOURCE to silence those
43+
# warnings.
44+
CFLAGS += -U_FORTIFY_SOURCE
45+
3946
KDIR ?= /lib/modules/$(shell uname -r)/build
4047
ifneq (,$(wildcard $(KDIR)/Module.symvers))
4148
ifneq (,$(wildcard $(KDIR)/include/linux/page_frag_cache.h))

0 commit comments

Comments
 (0)