]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from environment
authorJan Stancek <jstancek@redhat.com>
Thu, 23 Jan 2025 12:38:51 +0000 (13:38 +0100)
committerJakub Kicinski <kuba@kernel.org>
Mon, 27 Jan 2025 22:45:27 +0000 (14:45 -0800)
Package build environments like Fedora rpmbuild introduced hardening
options (e.g. -pie -Wl,-z,now) by passing a -spec option to CFLAGS
and LDFLAGS.

Some Makefiles currently override CFLAGS but not LDFLAGS, which leads
to a mismatch and build failure, for example:
  /usr/bin/ld: /tmp/ccd2apay.o: relocation R_X86_64_32 against
    `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
  /usr/bin/ld: failed to set dynamic section sizes: bad value
  collect2: error: ld returned 1 exit status
  make[1]: *** [../../lib.mk:222: tools/testing/selftests/net/lib/csum] Error 1

openvswitch/Makefile CFLAGS currently do not appear to be used, but
fix it anyway for the case when new tests are introduced in future.

Fixes: 1d0dc857b5d8 ("selftests: drv-net: add checksum tests")
Signed-off-by: Jan Stancek <jstancek@redhat.com>
Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
Link: https://patch.msgid.link/3d173603ee258f419d0403363765c9f9494ff79a.1737635092.git.jstancek@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/selftests/net/lib/Makefile
tools/testing/selftests/net/openvswitch/Makefile

index 18b9443454a9e83c7e2f808b7bf2af1f1a450acb..bc6b6762baf3ef068a0a0bcab7ec32fd88bdd9f9 100644 (file)
@@ -1,6 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 
-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../../
index 2f1508abc826b70933832b4ac43731b67a822f45..3fd1da2ec07d54cfa96f8cdded633e09e0a8e5ab 100644 (file)
@@ -2,7 +2,7 @@
 
 top_srcdir = ../../../../..
 
-CFLAGS  -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
+CFLAGS += -Wall -Wl,--no-as-needed -O2 -g -I$(top_srcdir)/usr/include $(KHDR_INCLUDES)
 
 TEST_PROGS := openvswitch.sh