* [PATCH net] selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from environment
@ 2025-01-23 12:38 Jan Stancek
2025-01-23 12:51 ` Matthieu Baerts
0 siblings, 1 reply; 5+ messages in thread
From: Jan Stancek @ 2025-01-23 12:38 UTC (permalink / raw)
To: netdev
Cc: jstancek, pshelar, matttbe, kuba, davem, edumazet, pabeni,
liuhangbin, linux-kselftest
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>
---
tools/testing/selftests/net/lib/Makefile | 2 +-
tools/testing/selftests/net/openvswitch/Makefile | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/net/lib/Makefile b/tools/testing/selftests/net/lib/Makefile
index 18b9443454a9..578de40cc5e3 100644
--- a/tools/testing/selftests/net/lib/Makefile
+++ b/tools/testing/selftests/net/lib/Makefile
@@ -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../../
diff --git a/tools/testing/selftests/net/openvswitch/Makefile b/tools/testing/selftests/net/openvswitch/Makefile
index 2f1508abc826..1567a549ba34 100644
--- a/tools/testing/selftests/net/openvswitch/Makefile
+++ b/tools/testing/selftests/net/openvswitch/Makefile
@@ -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
--
2.43.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH net] selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from environment
2025-01-23 12:38 [PATCH net] selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from environment Jan Stancek
@ 2025-01-23 12:51 ` Matthieu Baerts
2025-01-26 2:03 ` Hangbin Liu
2025-01-27 23:04 ` Jakub Kicinski
0 siblings, 2 replies; 5+ messages in thread
From: Matthieu Baerts @ 2025-01-23 12:51 UTC (permalink / raw)
To: Jan Stancek
Cc: pshelar, kuba, davem, edumazet, pabeni, liuhangbin,
linux-kselftest, netdev
Hi Jan,
On 23/01/2025 13:38, Jan Stancek wrote:
> 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
Thank you for the fix!
> 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")
Note that this commit is only for the Makefile in 'lib', not in
'openvswitch', but I guess there is no need to backport that all along.
Maybe the two modifications should be split, but I guess that's fine here.
> Signed-off-by: Jan Stancek <jstancek@redhat.com>
> ---
> tools/testing/selftests/net/lib/Makefile | 2 +-
> tools/testing/selftests/net/openvswitch/Makefile | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/net/lib/Makefile b/tools/testing/selftests/net/lib/Makefile
> index 18b9443454a9..578de40cc5e3 100644
> --- a/tools/testing/selftests/net/lib/Makefile
> +++ b/tools/testing/selftests/net/lib/Makefile
> @@ -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
(small detail: I guess the double whitespaces after the '=' were there
to keep the alignment with the next line, so probably there should be
only one now, but I don't think this alone is enough to ask for a v2!)
Apart from that:
Acked-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
> CFLAGS += -I../../../../../usr/include/ $(KHDR_INCLUDES)
> # Additional include paths needed by kselftest.h
> CFLAGS += -I../../
> diff --git a/tools/testing/selftests/net/openvswitch/Makefile b/tools/testing/selftests/net/openvswitch/Makefile
> index 2f1508abc826..1567a549ba34 100644
> --- a/tools/testing/selftests/net/openvswitch/Makefile
> +++ b/tools/testing/selftests/net/openvswitch/Makefile
> @@ -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
>
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from environment
2025-01-23 12:51 ` Matthieu Baerts
@ 2025-01-26 2:03 ` Hangbin Liu
2025-01-27 14:50 ` Matthieu Baerts
2025-01-27 23:04 ` Jakub Kicinski
1 sibling, 1 reply; 5+ messages in thread
From: Hangbin Liu @ 2025-01-26 2:03 UTC (permalink / raw)
To: Matthieu Baerts
Cc: Jan Stancek, pshelar, kuba, davem, edumazet, pabeni,
linux-kselftest, netdev
On Thu, Jan 23, 2025 at 01:51:27PM +0100, Matthieu Baerts wrote:
> > 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")
>
> Note that this commit is only for the Makefile in 'lib', not in
> 'openvswitch', but I guess there is no need to backport that all along.
> Maybe the two modifications should be split, but I guess that's fine here.
Maybe we can also add
Fixes: 25f16c873fb1 ("selftests: add openvswitch selftest suite")
Reviewed-by: Hangbin Liu <liuhangbin@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from environment
2025-01-26 2:03 ` Hangbin Liu
@ 2025-01-27 14:50 ` Matthieu Baerts
0 siblings, 0 replies; 5+ messages in thread
From: Matthieu Baerts @ 2025-01-27 14:50 UTC (permalink / raw)
To: Hangbin Liu
Cc: Jan Stancek, pshelar, kuba, davem, edumazet, pabeni,
linux-kselftest, netdev
Hi Hangbin,
On 26/01/2025 03:03, Hangbin Liu wrote:
> On Thu, Jan 23, 2025 at 01:51:27PM +0100, Matthieu Baerts wrote:
>>> 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")
>>
>> Note that this commit is only for the Makefile in 'lib', not in
>> 'openvswitch', but I guess there is no need to backport that all along.
>> Maybe the two modifications should be split, but I guess that's fine here.
>
> Maybe we can also add
>
> Fixes: 25f16c873fb1 ("selftests: add openvswitch selftest suite")
I don't think it is needed. If it is, probably best to split the patch
in two then.
Cheers,
Matt
--
Sponsored by the NGI0 Core fund.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net] selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from environment
2025-01-23 12:51 ` Matthieu Baerts
2025-01-26 2:03 ` Hangbin Liu
@ 2025-01-27 23:04 ` Jakub Kicinski
1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2025-01-27 23:04 UTC (permalink / raw)
To: Matthieu Baerts, Jan Stancek
Cc: pshelar, davem, edumazet, pabeni, liuhangbin, linux-kselftest,
netdev
On Thu, 23 Jan 2025 13:51:27 +0100 Matthieu Baerts wrote:
> > -CFLAGS = -Wall -Wl,--no-as-needed -O2 -g
> > +CFLAGS += -Wall -Wl,--no-as-needed -O2 -g
>
> (small detail: I guess the double whitespaces after the '=' were there
> to keep the alignment with the next line, so probably there should be
> only one now, but I don't think this alone is enough to ask for a v2!)
Adjusted when applying in both patches, so the bot will probably not
respond.
Thanks for these fixes!
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-01-27 23:04 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-23 12:38 [PATCH net] selftests: net/{lib,openvswitch}: extend CFLAGS to keep options from environment Jan Stancek
2025-01-23 12:51 ` Matthieu Baerts
2025-01-26 2:03 ` Hangbin Liu
2025-01-27 14:50 ` Matthieu Baerts
2025-01-27 23:04 ` Jakub Kicinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).