From nobody Wed Dec 17 14:13:54 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D0C4C624B4 for ; Sat, 25 Nov 2023 08:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231782AbjKYInL (ORCPT ); Sat, 25 Nov 2023 03:43:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229550AbjKYInF (ORCPT ); Sat, 25 Nov 2023 03:43:05 -0500 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B5C4093 for ; Sat, 25 Nov 2023 00:43:11 -0800 (PST) Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-1cfb3ee8bc7so2948795ad.1 for ; Sat, 25 Nov 2023 00:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1700901791; x=1701506591; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=NPPxIVkRMPlLUxZMsEygBEBjgDTLIaOmfxI6JWnloIc=; b=pRBffyQrCwf4oKhvTAqwDsql81Gi1ZUG1TrWWb6Th9wByymCvZ4X4bzpp/9PDyFHGb JmdQhjCkn7EtugvsHui0i2ssEtCDYTd8z1fElK0aM/ar8YXaqvCuXiGIlud47tTtebc/ E3CA4FM2z4dZmUjPX8X1wtv+VyAfON7Zm3JDIQZEoQ3JQf8+S7RgUq9/BMI8BTUB0oRj kUfC7HIugLwA/ZSj+ifnjYyeBQxHnKX6pMeLK394C9+iS1BFK/W3kafNRnEBwK4ThjeY /ofKbPaRIuRdqkfj24IYDyXAbJkKu08h6EhVO27TDEzpTNj9N6hTphqY893bNlUtGjMB /WEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700901791; x=1701506591; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=NPPxIVkRMPlLUxZMsEygBEBjgDTLIaOmfxI6JWnloIc=; b=iRFiLI2u6UWDRLLOuGTumkXo/+d5gG2sgG2OTDBqRKdEU+ZJpz0yFRboioUxgQB6No nROycaYeF45tOTnRlTd/4kO/L4q62X9sOrHHTeojiVOqvXKb0q8b9gSOt5aAEZauY+N+ aKOaf7UBb1AHAKkk4UePeZ/kqElcb0tAs2pAVh5Op8RpwguR3+WvcltuchzBSuP/ISw5 JYffFc4HPWhi9KO/6ZamxHJXhcYzi6pVykiLIcBKr+X+mLAXaWuq65hR44WVHmWAHDv3 4NVg8PiKlSD4sbKXyP00XWJd1GVwKnq9W3JGPJ1B74uorkv8agrHFlLyp9FuodKn9SOt BD2g== X-Gm-Message-State: AOJu0YxArIkOedCZiIHGANXChxZDYD3G2WOtEU+TMh1XOfgDdxCnkAMp PfQMhRQqwBoUD4V38LE3HvKvtQ== X-Google-Smtp-Source: AGHT+IEVVpVFIcUVQouFS95iWEttXau5YwBJgu8W9QjT7uKgsVIqZzxbtoETCuWtg/ws4lKe1JRV9g== X-Received: by 2002:a17:902:f68d:b0:1cf:6704:4340 with SMTP id l13-20020a170902f68d00b001cf67044340mr6468913plg.22.1700901791152; Sat, 25 Nov 2023 00:43:11 -0800 (PST) Received: from localhost ([157.82.205.15]) by smtp.gmail.com with UTF8SMTPSA id h12-20020a170902748c00b001c9d011581dsm4432500pll.164.2023.11.25.00.43.07 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Nov 2023 00:43:10 -0800 (PST) From: Akihiko Odaki Cc: Andrii Nakryiko , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Nick Terrell , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Akihiko Odaki Subject: [PATCH bpf-next v5 1/3] selftests/bpf: Choose pkg-config for the target Date: Sat, 25 Nov 2023 17:42:50 +0900 Message-ID: <20231125084253.85025-2-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231125084253.85025-1-akihiko.odaki@daynix.com> References: <20231125084253.85025-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" pkg-config is used to build sign-file executable. It should use the library for the target instead of the host as it is called during tests. Signed-off-by: Akihiko Odaki --- tools/testing/selftests/bpf/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests= /bpf/Makefile index 9c27b67bc7b1..94825ef813d5 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -18,7 +18,7 @@ else GENDIR :=3D $(abspath ../../../../include/generated) endif GENHDR :=3D $(GENDIR)/autoconf.h -HOSTPKG_CONFIG :=3D pkg-config +PKG_CONFIG ?=3D $(CROSS_COMPILE)pkg-config =20 ifneq ($(wildcard $(GENHDR)),) GENFLAGS :=3D -DHAVE_GENHDR @@ -219,9 +219,9 @@ $(OUTPUT)/urandom_read: urandom_read.c urandom_read_aux= .c $(OUTPUT)/liburandom_r =20 $(OUTPUT)/sign-file: ../../../../scripts/sign-file.c $(call msg,SIGN-FILE,,$@) - $(Q)$(CC) $(shell $(HOSTPKG_CONFIG) --cflags libcrypto 2> /dev/null) \ + $(Q)$(CC) $(shell $(PKG_CONFIG) --cflags libcrypto 2> /dev/null) \ $< -o $@ \ - $(shell $(HOSTPKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcryp= to) + $(shell $(PKG_CONFIG) --libs libcrypto 2> /dev/null || echo -lcrypto) =20 $(OUTPUT)/bpf_testmod.ko: $(VMLINUX_BTF) $(RESOLVE_BTFIDS) $(wildcard bpf_= testmod/Makefile bpf_testmod/*.[ch]) $(call msg,MOD,,$@) --=20 2.43.0 From nobody Wed Dec 17 14:13:54 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D2259C636BD for ; Sat, 25 Nov 2023 08:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231842AbjKYInR (ORCPT ); Sat, 25 Nov 2023 03:43:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231796AbjKYInK (ORCPT ); Sat, 25 Nov 2023 03:43:10 -0500 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00CC518B for ; Sat, 25 Nov 2023 00:43:16 -0800 (PST) Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-1cfa36bfe0cso9286925ad.1 for ; Sat, 25 Nov 2023 00:43:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1700901796; x=1701506596; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wItB+PKNO3hEPBQi2nWGljT56dVv5dpK/TMccffm1xE=; b=A7+eJJOHV4FYPhX3BvVFbgFr8IQz2aEf+nyW6RrsjFANP7WaeRG5j+/qc7OaqNZDVq VrDqPpjSiRL2yMnhJUh0S8SLlM0ARw5vihf4IGq9xmvTvXDWdea4R5xt4qT9XrXG/ULI FIqLzD4sObronjXYSMMdB0xzQVK4zKAsKJbpsxVy8zmYuuM5bCYMwqb4r1g+rismbrHW IlKcqrtS7kVuiQiWNTGHStVoJRrmNwxoJVcZn2NaxMy/LshngjGzqViabGer0aTxYYLM 2JTjvtOuPA1O3BgoRkplAQvf6jQZ/06T/6PefkxFhFNZ9HJzZWHy6HR92LwnaBzcOFSi OZqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700901796; x=1701506596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wItB+PKNO3hEPBQi2nWGljT56dVv5dpK/TMccffm1xE=; b=tXOc3oKH6XTg+WGogm+TyjkTAk0BS7Z3uLFGF3A0QDU8QEy57sKJzdvZ0KSNFmvFrf YCGjbzMlL46g+yFPgZJ5VlEMYZJIgu4fiexgs3TSpVUV35M1PCivkEwccOuvQs/FgAbF CQII/8ZRofQOQocmmivpN5tk8XwpO6N0dzM6t/HTsFx49YOMJ0kOlfMMmo79mxeog9As VQ8EhgiUeR8XR9I5E/2QGKG7hp81v2OUfBsRUQVlx0o2W6WBWGrKZY8TQt/gfaKBe32T xQVg2Fn1lADVsN10sSIWjyMUOougOA3ryfl/uvYqZHectRcV65t4RedLdk9x9u3apeAM 0+iA== X-Gm-Message-State: AOJu0YzjFKyE57htzQAaVZFpZ3fJcZhWwW9TTf9T78Hkqpqi2jqsAXH4 xplN+MXKQ9jIlF+m1EWItJCo1A== X-Google-Smtp-Source: AGHT+IFxiQz3BsHEBO78xSibjA97oPp4WKGwp+0jnIwsj/tgRFBbBaOp+jEnT/85fbLaPzY/Qm92DQ== X-Received: by 2002:a17:902:e88f:b0:1cf:6832:46c with SMTP id w15-20020a170902e88f00b001cf6832046cmr6577902plg.6.1700901796260; Sat, 25 Nov 2023 00:43:16 -0800 (PST) Received: from localhost ([157.82.205.15]) by smtp.gmail.com with UTF8SMTPSA id t8-20020a170902bc4800b001cc131c65besm4432871plz.168.2023.11.25.00.43.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Nov 2023 00:43:15 -0800 (PST) From: Akihiko Odaki Cc: Andrii Nakryiko , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Nick Terrell , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Akihiko Odaki Subject: [PATCH bpf-next v5 2/3] selftests/bpf: Override PKG_CONFIG for static builds Date: Sat, 25 Nov 2023 17:42:51 +0900 Message-ID: <20231125084253.85025-3-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231125084253.85025-1-akihiko.odaki@daynix.com> References: <20231125084253.85025-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" A library may need to depend on additional archive files for static builds so pkg-config should be instructed to list them. Signed-off-by: Akihiko Odaki --- tools/testing/selftests/bpf/README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/README.rst b/tools/testing/selftes= ts/bpf/README.rst index cb9b95702ac6..9af79c7a9b58 100644 --- a/tools/testing/selftests/bpf/README.rst +++ b/tools/testing/selftests/bpf/README.rst @@ -77,7 +77,7 @@ In case of linker errors when running selftests, try usin= g static linking: =20 .. code-block:: console =20 - $ LDLIBS=3D-static vmtest.sh + $ LDLIBS=3D-static PKG_CONFIG=3D'pkg-config --static' vmtest.sh =20 .. note:: Some distros may not support static linking. =20 --=20 2.43.0 From nobody Wed Dec 17 14:13:54 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E6EDCC636D0 for ; Sat, 25 Nov 2023 08:43:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231937AbjKYInc (ORCPT ); Sat, 25 Nov 2023 03:43:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231869AbjKYInT (ORCPT ); Sat, 25 Nov 2023 03:43:19 -0500 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 126F31987 for ; Sat, 25 Nov 2023 00:43:22 -0800 (PST) Received: by mail-pl1-x636.google.com with SMTP id d9443c01a7336-1ce656b9780so19348615ad.2 for ; Sat, 25 Nov 2023 00:43:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20230601.gappssmtp.com; s=20230601; t=1700901801; x=1701506601; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=U0MgZk1wjA7oN6wh0F/2QVcx7Di6tJCC9+3i36KMM74=; b=gZiEqYa8bHmIGeqQ8gKc1wQ9NjI0djpJqRsXlwIaF3uWwfg2r8MeSqg0OdbPCGO4tf pZL8KZoi7rgYvozNxXwCu/jDz6YJDzKFmxBOKjkRKDTpCbp/a2TglEWl5N1ifU7j8ZP+ vDfTaUBL56IfarFBUrvcieiDKqzyt5nJk7uk47fGthCx3hcTCRHOQOLvs+xAvLly5WUe ZBJT0/OhcReVmNR/7/GpFloS8RcI6mKUD+D+QoPbNGFfHKP1QiLe7dFXqNi9uVHJPNcw 5w+ZrxR1w4px3DUl7jM1dSaCN25q5vonmpEXU9PDXDfFnc4wCMEGZo3OymngIv+R2vgn UIfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700901801; x=1701506601; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=U0MgZk1wjA7oN6wh0F/2QVcx7Di6tJCC9+3i36KMM74=; b=bK3T0qX+VYm75OM4498JVhKo45ss/oV0sMMohEcr93gGJ9dLVRRmkke2II6ofPP1O1 7sRW6zf183WJNHpcfpX/cIWyb5APjy96dMjwDgRhEAfJUqJvEpgz3DF78bY2KqIFiJ5j +NrbSdig7g+nDFyavPzg3MUcWKo5X7U7zrD1N1uo6zzdmw9ILSkTcj2JPNLQcngQvnh6 Rc65WX7eYWQSFV3CYouaO/wNFYpdCDh2SyeuPMUpncoNvTrWCCS5zdg4C06Ak9YJ0qjl j2RC/7A300klynPvzlmz16dqFpIBjAVqC31mD4CjQiam01JK0Zl/s1KnLkSe/GF8zN4B kdnw== X-Gm-Message-State: AOJu0YzfC3aUsWF+gY1VS9gmhOdt/aV+1sfHWpJNV/CZ0uzksXeXac1S ArcqW7XAfVbkluGV19Au2MrpiA== X-Google-Smtp-Source: AGHT+IHaALqakfp4Ql5TcXmGo6Ln+y2ernCX4AymHrvtStelwdd1wSXPTd6Nn3zAPPadG0W0MisnBg== X-Received: by 2002:a17:902:cec3:b0:1cf:7cfc:c3b7 with SMTP id d3-20020a170902cec300b001cf7cfcc3b7mr5703205plg.10.1700901801375; Sat, 25 Nov 2023 00:43:21 -0800 (PST) Received: from localhost ([157.82.205.15]) by smtp.gmail.com with UTF8SMTPSA id a3-20020a170902ecc300b001cfba46e407sm260609plh.129.2023.11.25.00.43.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 25 Nov 2023 00:43:21 -0800 (PST) From: Akihiko Odaki Cc: Andrii Nakryiko , Mykola Lysenko , Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Nick Terrell , bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Akihiko Odaki Subject: [PATCH bpf-next v5 3/3] selftests/bpf: Use pkg-config for libelf Date: Sat, 25 Nov 2023 17:42:52 +0900 Message-ID: <20231125084253.85025-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231125084253.85025-1-akihiko.odaki@daynix.com> References: <20231125084253.85025-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When linking statically, libraries may require other dependencies to be included to ld flags. In particular, libelf may require libzstd. Use pkg-config to determine such dependencies. Signed-off-by: Akihiko Odaki --- tools/testing/selftests/bpf/Makefile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests= /bpf/Makefile index 94825ef813d5..617ae55c3bb5 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -29,13 +29,17 @@ SAN_CFLAGS ?=3D SAN_LDFLAGS ?=3D $(SAN_CFLAGS) RELEASE ?=3D OPT_FLAGS ?=3D $(if $(RELEASE),-O2,-O0) + +LIBELF_CFLAGS :=3D $(shell $(PKG_CONFIG) libelf --cflags 2>/dev/null) +LIBELF_LIBS :=3D $(shell $(PKG_CONFIG) libelf --libs 2>/dev/null || echo -= lelf) + CFLAGS +=3D -g $(OPT_FLAGS) -rdynamic \ -Wall -Werror \ - $(GENFLAGS) $(SAN_CFLAGS) \ + $(GENFLAGS) $(SAN_CFLAGS) $(LIBELF_CFLAGS) \ -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) LDFLAGS +=3D $(SAN_LDFLAGS) -LDLIBS +=3D -lelf -lz -lrt -lpthread +LDLIBS +=3D $(LIBELF_LIBS) -lz -lrt -lpthread =20 ifneq ($(LLVM),) # Silence some warnings when compiled with clang --=20 2.43.0