Skip to contentSkip to conversation

selftests-centralize-d_gnu_source=-to-cflags-in-libmk.patch removed from -mm tree

merged Andrew Morton 1 participant 1 message Jun 26, 2024

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: selftests: centralize -D_GNU_SOURCE= to CFLAGS in lib.mk
has been removed from the -mm tree. Its filename was
selftests-centralize-d_gnu_source=-to-cflags-in-libmk.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Edward Liaw <[email protected]>
Subject: selftests: centralize -D_GNU_SOURCE= to CFLAGS in lib.mk
Date: Tue, 25 Jun 2024 22:34:45 +0000

Centralize the _GNU_SOURCE definition to CFLAGS in lib.mk. Remove redundant defines from Makefiles that import lib.mk. Convert any usage of "#define _GNU_SOURCE 1" to "#define _GNU_SOURCE".

This uses the form "-D_GNU_SOURCE=", which is equivalent to "#define _GNU_SOURCE".

Otherwise using "-D_GNU_SOURCE" is equivalent to "-D_GNU_SOURCE=1" and "#define _GNU_SOURCE 1", which is less commonly seen in source code and would require many changes in selftests to avoid redefinition warnings.

Cc Albert Ou <[email protected]>
Cc André Almeida <[email protected]>
Cc Darren Hart <[email protected]>
Cc Dave Hansen <[email protected]>
Cc Davidlohr Bueso <[email protected]>
Cc David S. Miller <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Eric W. Biederman <[email protected]>
Cc Fenghua Yu <[email protected]>
Cc Ingo Molnar <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Jarkko Sakkinen <[email protected]>
Cc Jason Gunthorpe <[email protected]>
Cc Kees Cook <[email protected]>
Cc Kevin Tian <[email protected]>
Cc Muhammad Usama Anjum <[email protected]>
Cc Palmer Dabbelt <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Paolo Bonzini <[email protected]>
Cc Paul Walmsley <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Reinette Chatre <[email protected]>
Cc Sean Christopherson <[email protected]>
Cc Shuah Khan <[email protected]>
Cc Thomas Gleixner <[email protected]>

---

 tools/testing/selftests/exec/Makefile             |    1 -
 tools/testing/selftests/futex/functional/Makefile |    2 +-
 tools/testing/selftests/intel_pstate/Makefile     |    2 +-
 tools/testing/selftests/iommu/Makefile            |    2 --
 tools/testing/selftests/kvm/Makefile              |    2 +-
 tools/testing/selftests/lib.mk                    |    3 +++
 tools/testing/selftests/mm/thuge-gen.c            |    2 +-
 tools/testing/selftests/net/Makefile              |    2 +-
 tools/testing/selftests/net/tcp_ao/Makefile       |    2 +-
 tools/testing/selftests/proc/Makefile             |    1 -
 tools/testing/selftests/resctrl/Makefile          |    2 +-
 tools/testing/selftests/ring-buffer/Makefile      |    1 -
 tools/testing/selftests/riscv/mm/Makefile         |    2 +-
 tools/testing/selftests/sgx/Makefile              |    2 +-
 tools/testing/selftests/tmpfs/Makefile            |    1 -
 15 files changed, 12 insertions(+), 15 deletions(-)
tools/testing/selftests/exec/Makefile renamed from tools/testing/selftests/exec/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +0 -1
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 CFLAGS = -Wall
 CFLAGS += -Wno-nonnull
-CFLAGS += -D_GNU_SOURCE
 
 TEST_PROGS := binfmt_script.py
 TEST_GEN_PROGS := execveat load_address_4096 load_address_2097152 load_address_16777216 non-regular
tools/testing/selftests/futex/functional/Makefile renamed from tools/testing/selftests/futex/functional/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 INCLUDES := -I../include -I../../ $(KHDR_INCLUDES)
-CFLAGS := $(CFLAGS) -g -O2 -Wall -D_GNU_SOURCE= -pthread $(INCLUDES) $(KHDR_INCLUDES)
+CFLAGS := $(CFLAGS) -g -O2 -Wall -pthread $(INCLUDES) $(KHDR_INCLUDES)
 LDLIBS := -lpthread -lrt
 
 LOCAL_HDRS := \
tools/testing/selftests/intel_pstate/Makefile renamed from tools/testing/selftests/intel_pstate/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
-CFLAGS := $(CFLAGS) -Wall -D_GNU_SOURCE
+CFLAGS := $(CFLAGS) -Wall
 LDLIBS += -lm
 
 ARCH ?= $(shell uname -m 2>/dev/null || echo not)
tools/testing/selftests/iommu/Makefile renamed from tools/testing/selftests/iommu/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +0 -2
@@ -2,8 +2,6 @@
 CFLAGS += -Wall -O2 -Wno-unused-function
 CFLAGS += $(KHDR_INCLUDES)
 
-CFLAGS += -D_GNU_SOURCE
-
 TEST_GEN_PROGS :=
 TEST_GEN_PROGS += iommufd
 TEST_GEN_PROGS += iommufd_fail_nth
tools/testing/selftests/kvm/Makefile renamed from tools/testing/selftests/kvm/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -231,7 +231,7 @@ LINUX_TOOL_ARCH_INCLUDE = $(top_srcdir)/
 endif
 CFLAGS += -Wall -Wstrict-prototypes -Wuninitialized -O2 -g -std=gnu99 \
 	-Wno-gnu-variable-sized-type-not-at-end -MD -MP -DCONFIG_64BIT \
-	-D_GNU_SOURCE -fno-builtin-memcmp -fno-builtin-memcpy \
+	-fno-builtin-memcmp -fno-builtin-memcpy \
 	-fno-builtin-memset -fno-builtin-strnlen \
 	-fno-stack-protector -fno-PIE -I$(LINUX_TOOL_INCLUDE) \
 	-I$(LINUX_TOOL_ARCH_INCLUDE) -I$(LINUX_HDR_PATH) -Iinclude \
tools/testing/selftests/lib.mk renamed from tools/testing/selftests/lib.mk~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +3 -0
@@ -188,6 +188,9 @@ endef
 clean: $(if $(TEST_GEN_MODS_DIR),clean_mods_dir)
 	$(CLEAN)
 
+# Build with _GNU_SOURCE by default
+CFLAGS += -D_GNU_SOURCE=
+
 # Enables to extend CFLAGS and LDFLAGS from command line, e.g.
 # make USERCFLAGS=-Werror USERLDFLAGS=-static
 CFLAGS += $(USERCFLAGS)
tools/testing/selftests/mm/thuge-gen.c renamed from tools/testing/selftests/mm/thuge-gen.c~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -13,7 +13,7 @@
    sudo ipcs | awk '$1 == "0x00000000" {print $2}' | xargs -n1 sudo ipcrm -m
    (warning this will remove all if someone else uses them) */
 
-#define _GNU_SOURCE 1
+#define _GNU_SOURCE
 #include <sys/mman.h>
 #include <linux/mman.h>
 #include <stdlib.h>
tools/testing/selftests/net/Makefile renamed from tools/testing/selftests/net/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 # Makefile for net selftests
 
-CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
+CFLAGS +=  -Wall -Wl,--no-as-needed -O2 -g
 CFLAGS += -I../../../../usr/include/ $(KHDR_INCLUDES)
 # Additional include paths needed by kselftest.h
 CFLAGS += -I../
tools/testing/selftests/net/tcp_ao/Makefile renamed from tools/testing/selftests/net/tcp_ao/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -26,7 +26,7 @@ LIB	:= $(LIBDIR)/libaotst.a
 LDLIBS	+= $(LIB) -pthread
 LIBDEPS	:= lib/aolib.h Makefile
 
-CFLAGS	:= -Wall -O2 -g -D_GNU_SOURCE -fno-strict-aliasing
+CFLAGS	+= -Wall -O2 -g -fno-strict-aliasing
 CFLAGS	+= $(KHDR_INCLUDES)
 CFLAGS	+= -iquote ./lib/ -I ../../../../include/
 
tools/testing/selftests/proc/Makefile renamed from tools/testing/selftests/proc/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +0 -1
@@ -1,6 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -Wall -O2 -Wno-unused-function
-CFLAGS += -D_GNU_SOURCE
 LDFLAGS += -pthread
 
 TEST_GEN_PROGS :=
tools/testing/selftests/resctrl/Makefile renamed from tools/testing/selftests/resctrl/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
-CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE
+CFLAGS = -g -Wall -O2 -D_FORTIFY_SOURCE=2
 CFLAGS += $(KHDR_INCLUDES)
 
 TEST_GEN_PROGS := resctrl_tests
tools/testing/selftests/ring-buffer/Makefile renamed from tools/testing/selftests/ring-buffer/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +0 -1
@@ -1,7 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 CFLAGS += -Wl,-no-as-needed -Wall
 CFLAGS += $(KHDR_INCLUDES)
-CFLAGS += -D_GNU_SOURCE
 
 TEST_GEN_PROGS = map_test
 
tools/testing/selftests/riscv/mm/Makefile renamed from tools/testing/selftests/riscv/mm/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -3,7 +3,7 @@
 # Originally tools/testing/arm64/abi/Makefile
 
 # Additional include paths needed by kselftest.h and local headers
-CFLAGS += -D_GNU_SOURCE -std=gnu99 -I.
+CFLAGS += -std=gnu99 -I.
 
 TEST_GEN_FILES := mmap_default mmap_bottomup
 
tools/testing/selftests/sgx/Makefile renamed from tools/testing/selftests/sgx/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +1 -1
@@ -12,7 +12,7 @@ OBJCOPY := $(CROSS_COMPILE)objcopy
 endif
 
 INCLUDES := -I$(top_srcdir)/tools/include
-HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC
+HOST_CFLAGS := -Wall -Werror -g $(INCLUDES) -fPIC $(CFLAGS)
 HOST_LDFLAGS := -z noexecstack -lcrypto
 ENCL_CFLAGS += -Wall -Werror -static-pie -nostdlib -ffreestanding -fPIE \
 	       -fno-stack-protector -mrdrnd $(INCLUDES)
tools/testing/selftests/tmpfs/Makefile renamed from tools/testing/selftests/tmpfs/Makefile~selftests-centralize-d_gnu_source=-to-cflags-in-libmk +0 -1
@@ -1,6 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 CFLAGS += -Wall -O2
-CFLAGS += -D_GNU_SOURCE
 
 TEST_GEN_PROGS :=
 TEST_GEN_PROGS += bug-link-o-tmpfile

_

Patches currently in -mm which might be from [email protected] are