Skip to contentSkip to conversation

selftests/landlock: Fix build with non-default pthread linking

PATCH In review Mickaël Salaün 2 participants 2 messages Jan 15, 2025 – Jan 17, 2025

Subsystems (3)
lore
Share & tools
lore

Mickaël Salaün

author maintainer
#0 lore raw

PATCH 1/1 selftests/landlock: Fix build with non-default pthread linking

Old toolchains require explicit -lpthread (e.g. on Debian 11).

Cc Günther Noack <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Tahera Fahimi <[email protected]>
Fixes c8994965013e ("selftests/landlock: Test signal scoping for threads")
---
 tools/testing/selftests/landlock/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/landlock/Makefile +2 -2
index 348e2dbdb4e0..480f13e77fcc 100644
@@ -13,11 +13,11 @@ TEST_GEN_PROGS := $(src_test:.c=)
 TEST_GEN_PROGS_EXTENDED := true
 
 # Short targets:
-$(TEST_GEN_PROGS): LDLIBS += -lcap
+$(TEST_GEN_PROGS): LDLIBS += -lcap -lpthread
 $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
 
 include ../lib.mk
 
 # Targets with $(OUTPUT)/ prefix:
-$(TEST_GEN_PROGS): LDLIBS += -lcap
+$(TEST_GEN_PROGS): LDLIBS += -lcap -lpthread
 $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 32 lines · Mickaël Salaün

Old toolchains require explicit -lpthread (e.g. on Debian 11).

Cc Günther Noack <[email protected]>
Cc Nathan Chancellor <[email protected]>
Cc Tahera Fahimi <[email protected]>
Fixes c8994965013e ("selftests/landlock: Test signal scoping for threads")
---
 tools/testing/selftests/landlock/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/testing/selftests/landlock/Makefile +2 -2
index 348e2dbdb4e0..480f13e77fcc 100644
@@ -13,11 +13,11 @@ TEST_GEN_PROGS := $(src_test:.c=)
 TEST_GEN_PROGS_EXTENDED := true
 
 # Short targets:
-$(TEST_GEN_PROGS): LDLIBS += -lcap
+$(TEST_GEN_PROGS): LDLIBS += -lcap -lpthread
 $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
 
 include ../lib.mk
 
 # Targets with $(OUTPUT)/ prefix:
-$(TEST_GEN_PROGS): LDLIBS += -lcap
+$(TEST_GEN_PROGS): LDLIBS += -lcap -lpthread
 $(TEST_GEN_PROGS_EXTENDED): LDFLAGS += -static
Signature · 1 line
2.48.1