netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/net/tcp-ao: Use LDLIBS instead of LDFLAGS
@ 2024-01-10 21:34 Dmitry Safonov
  2024-01-11 14:42 ` Paolo Abeni
  2024-01-12  0:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Dmitry Safonov @ 2024-01-10 21:34 UTC (permalink / raw)
  To: David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan
  Cc: Dmitry Safonov, netdev, linux-kselftest, linux-kernel,
	kernel test robot, Dmitry Safonov

The rules to link selftests are:

> $(OUTPUT)/%_ipv4: %.c
> 	$(LINK.c) $^ $(LDLIBS) -o $@
>
> $(OUTPUT)/%_ipv6: %.c
> 	$(LINK.c) -DIPV6_TEST $^ $(LDLIBS) -o $@

The intel test robot uses only selftest's Makefile, not the top linux
Makefile:

> make W=1 O=/tmp/kselftest -C tools/testing/selftests

So, $(LINK.c) is determined by environment, rather than by kernel
Makefiles. On my machine (as well as other people that ran tcp-ao
selftests) GNU/Make implicit definition does use $(LDFLAGS):

> [dima@Mindolluin ~]$ make -p -f/dev/null | grep '^LINK.c\>'
> make: *** No targets.  Stop.
> LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)

But, according to build robot report, it's not the case for them.
While I could just avoid using pre-defined $(LINK.c), it's also used by
selftests/lib.mk by default.

Anyways, according to GNU/Make documentation [1], I should have used
$(LDLIBS) instead of $(LDFLAGS) in the first place, so let's just do it:

> LDFLAGS
>     Extra flags to give to compilers when they are supposed to invoke
>     the linker, ‘ld’, such as -L. Libraries (-lfoo) should be added
>     to the LDLIBS variable instead.
> LDLIBS
>     Library flags or names given to compilers when they are supposed
>     to invoke the linker, ‘ld’. LOADLIBES is a deprecated (but still
>     supported) alternative to LDLIBS. Non-library linker flags, such
>     as -L, should go in the LDFLAGS variable.

[1]: https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html

Fixes: cfbab37b3da0 ("selftests/net: Add TCP-AO library")
Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202401011151.veyYTJzq-lkp@intel.com/
Signed-off-by: Dmitry Safonov <dima@arista.com>
---
 tools/testing/selftests/net/tcp_ao/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/tcp_ao/Makefile b/tools/testing/selftests/net/tcp_ao/Makefile
index 8e60bae67aa9..522d991e310e 100644
--- a/tools/testing/selftests/net/tcp_ao/Makefile
+++ b/tools/testing/selftests/net/tcp_ao/Makefile
@@ -52,5 +52,5 @@ $(OUTPUT)/%_ipv6: %.c
 
 $(OUTPUT)/icmps-accept_ipv4: CFLAGS+= -DTEST_ICMPS_ACCEPT
 $(OUTPUT)/icmps-accept_ipv6: CFLAGS+= -DTEST_ICMPS_ACCEPT
-$(OUTPUT)/bench-lookups_ipv4: LDFLAGS+= -lm
-$(OUTPUT)/bench-lookups_ipv6: LDFLAGS+= -lm
+$(OUTPUT)/bench-lookups_ipv4: LDLIBS+= -lm
+$(OUTPUT)/bench-lookups_ipv6: LDLIBS+= -lm

---
base-commit: 8cb47d7cd090a690c1785385b2f3d407d4a53ad0
change-id: 20240110-tcp_ao-selftests-makefile-3dafb1e96df8

Best regards,
-- 
Dmitry Safonov <dima@arista.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/net/tcp-ao: Use LDLIBS instead of LDFLAGS
  2024-01-10 21:34 [PATCH] selftests/net/tcp-ao: Use LDLIBS instead of LDFLAGS Dmitry Safonov
@ 2024-01-11 14:42 ` Paolo Abeni
  2024-01-12  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2024-01-11 14:42 UTC (permalink / raw)
  To: Dmitry Safonov, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Shuah Khan
  Cc: netdev, linux-kselftest, linux-kernel, kernel test robot, Dmitry Safonov

On Wed, 2024-01-10 at 21:34 +0000, Dmitry Safonov wrote:
> The rules to link selftests are:
> 
> > $(OUTPUT)/%_ipv4: %.c
> > 	$(LINK.c) $^ $(LDLIBS) -o $@
> > 
> > $(OUTPUT)/%_ipv6: %.c
> > 	$(LINK.c) -DIPV6_TEST $^ $(LDLIBS) -o $@
> 
> The intel test robot uses only selftest's Makefile, not the top linux
> Makefile:
> 
> > make W=1 O=/tmp/kselftest -C tools/testing/selftests
> 
> So, $(LINK.c) is determined by environment, rather than by kernel
> Makefiles. On my machine (as well as other people that ran tcp-ao
> selftests) GNU/Make implicit definition does use $(LDFLAGS):
> 
> > [dima@Mindolluin ~]$ make -p -f/dev/null | grep '^LINK.c\>'
> > make: *** No targets.  Stop.
> > LINK.c = $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH)
> 
> But, according to build robot report, it's not the case for them.
> While I could just avoid using pre-defined $(LINK.c), it's also used by
> selftests/lib.mk by default.
> 
> Anyways, according to GNU/Make documentation [1], I should have used
> $(LDLIBS) instead of $(LDFLAGS) in the first place, so let's just do it:
> 
> > LDFLAGS
> >     Extra flags to give to compilers when they are supposed to invoke
> >     the linker, ‘ld’, such as -L. Libraries (-lfoo) should be added
> >     to the LDLIBS variable instead.
> > LDLIBS
> >     Library flags or names given to compilers when they are supposed
> >     to invoke the linker, ‘ld’. LOADLIBES is a deprecated (but still
> >     supported) alternative to LDLIBS. Non-library linker flags, such
> >     as -L, should go in the LDFLAGS variable.
> 
> [1]: https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html
> 
> Fixes: cfbab37b3da0 ("selftests/net: Add TCP-AO library")
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202401011151.veyYTJzq-lkp@intel.com/
> Signed-off-by: Dmitry Safonov <dima@arista.com>

Acked-by: Paolo Abeni <pabeni@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] selftests/net/tcp-ao: Use LDLIBS instead of LDFLAGS
  2024-01-10 21:34 [PATCH] selftests/net/tcp-ao: Use LDLIBS instead of LDFLAGS Dmitry Safonov
  2024-01-11 14:42 ` Paolo Abeni
@ 2024-01-12  0:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-12  0:40 UTC (permalink / raw)
  To: Dmitry Safonov
  Cc: davem, edumazet, kuba, pabeni, shuah, netdev, linux-kselftest,
	linux-kernel, lkp, 0x7f454c46

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 10 Jan 2024 21:34:10 +0000 you wrote:
> The rules to link selftests are:
> 
> > $(OUTPUT)/%_ipv4: %.c
> > 	$(LINK.c) $^ $(LDLIBS) -o $@
> >
> > $(OUTPUT)/%_ipv6: %.c
> > 	$(LINK.c) -DIPV6_TEST $^ $(LDLIBS) -o $@
> 
> [...]

Here is the summary with links:
  - selftests/net/tcp-ao: Use LDLIBS instead of LDFLAGS
    https://git.kernel.org/netdev/net/c/e689a8769698

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-01-12  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-10 21:34 [PATCH] selftests/net/tcp-ao: Use LDLIBS instead of LDFLAGS Dmitry Safonov
2024-01-11 14:42 ` Paolo Abeni
2024-01-12  0:40 ` patchwork-bot+netdevbpf

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).