Skip to content

Commit

Permalink
selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from …
Browse files Browse the repository at this point in the history
…environment

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: 1d0dc85 ("selftests: drv-net: add checksum tests")
Signed-off-by: Jan Stancek <[email protected]>
Acked-by: Matthieu Baerts (NGI0) <[email protected]>
Reviewed-by: Hangbin Liu <[email protected]>
Signed-off-by: NipaLocal <nipa@local>
  • Loading branch information
jstancek authored and NipaLocal committed Jan 26, 2025
1 parent 29e664b commit 2068efd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tools/testing/selftests/net/lib/Makefile
Original file line number Diff line number Diff line change
@@ -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../../
Expand Down
2 changes: 1 addition & 1 deletion tools/testing/selftests/net/openvswitch/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2068efd

Please sign in to comment.