From patchwork Wed Aug 28 12:17:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Yikai X-Patchwork-Id: 13781198 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2056.outbound.protection.outlook.com [40.107.215.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 846C4175548; Wed, 28 Aug 2024 12:17:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724847466; cv=fail; b=r4RYnC4k74uprZor7ZIgx89Xos1i+naFO8uyPhTLCVdgw48HUspHwuvaP0bACcXzljKzYm/koH0kP/PNBN8U69+kS17Vv89jMS8E31P0N43T5hFPw08H3MaiTBCaS5nR0i5Iom/D5E2j6WHl/dGX0tieVx8zHx6f+zR+50WgAKg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724847466; c=relaxed/simple; bh=rthb12yFXM2v7iL/Ys6Qd2nCTvG//CmLL1n584d0sGI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=JvnLWJQOhbQXNdbij4G2qEFSWOv8DcMo7mqFdXZEmN1MNEjj76xBVjbYoWLPRdwKOG5qzpTa6Gs9okNcQLo5BTACQQHw4Ucpx8g/oLDibnUDqIezToab02d19FOFE+zl9x6afPgZTkQEuLjigqHlT34DsHunQwLm6Tf+J2bYCBY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=CjhpIdbB; arc=fail smtp.client-ip=40.107.215.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="CjhpIdbB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vNHAewkNV6uarUzP5VEBJyx5BC6eJNYO1mrBAkHJnW25Z+79obsYyMLEULYF8Hm1we/NhiL/c3/V7gk8qyuBlYjVKxrE159bF4V2VyJgJnTmvDKFj2PkZhiKME8hjMD2TxbUycTX+b1Uy9vzhR6klWkwUxUIGb03d0++5ayGAaSKycnr4fMejbXtpO08GtPpvbrC0iS9ijuHX+3As1utmcvurgsACRmulWEMSwcGcdg4lEg0x310wMJWAdlKGoKaSEk9eZz0Kzmj4Jy5Jd53uM4ER80VS7LcwuNapj5fARLHfCiCg/0iS0nXw/98xnNMZU+v+JdfiDzbRE7ZLWGQXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Kvz+0G8ygd1ni1yc4zoje01KS7SDsovLOoeqn67D3WY=; b=nK7cotM+Nx4ta7QaGD59kEWFv3CI72XbItLfNrQKuzGJ7h5MbeN42hPDg3gMUICoBBmXe6vedazHPw4WyvCne9d5vF5JRIM3OcEH1i84cchLA2N/geI9A/bPEoTA5akyODq5SB/qn47CQEX7uPPCccxh997Damig8hKv7OKsRH6+oNgWtcchtXNXNppe0B5t602ao1WFkh3Wd1LTdOpMuBMbswISBrE9fhhnhKsA0M2r0Gs4UVmyUqsRruODJ8Pc0OkuMOBTPz5KcQhYTZPkaqmebNEwppDaCrSb3cZSUiaZteHdhMssDwgEVZXL0mJ94wjxLz8n1NvOd7D6OUpbkg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Kvz+0G8ygd1ni1yc4zoje01KS7SDsovLOoeqn67D3WY=; b=CjhpIdbBx2eXRps+Kt3lv4epFy9EOCcaXu0uKF4Ro+TfqqK5copQdwOBACAGsjEFEnP2C8r0yUnuZRMRZKp5XpagL67OmSe0rZB/0zByRWAMvq51WvmI8XsndJmj3REVz/iJ9Bcgxy73btuERhC7PsHAWXgPErhX2IWx6OuxKicCxzjWWI40YuZNEwltN35IEWpWgl3FvQslOBEwUJ6g16QzqPeBc1tOYpRQla4xOnhuniHo0bLSIbVolHesoWC/X9HpL5bLuQfuADEgLT4dMCR9jwZUKAeyF78fr6QR/rcQh7r9eGo+5T24p6NyAUexNy8I1UxoJWWXbmsdWh7fgw== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEYPR06MB5913.apcprd06.prod.outlook.com (2603:1096:101:da::16) by KL1PR06MB5884.apcprd06.prod.outlook.com (2603:1096:820:dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.27; Wed, 28 Aug 2024 12:17:33 +0000 Received: from SEYPR06MB5913.apcprd06.prod.outlook.com ([fe80::f049:a716:8200:c4a1]) by SEYPR06MB5913.apcprd06.prod.outlook.com ([fe80::f049:a716:8200:c4a1%4]) with mapi id 15.20.7897.021; Wed, 28 Aug 2024 12:17:33 +0000 From: Lin Yikai To: andrii@kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, mykolal@fb.com, shuah@kernel.org, terrelln@fb.com, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, yikai.lin@vivo.com Subject: [PATCH bpf-next v2 1/2] selftests/bpf: Enable vmtest for cross-compile arm64 on x86_64 host, and fix some issues. Date: Wed, 28 Aug 2024 20:17:05 +0800 Message-Id: <20240828121706.1721287-2-yikai.lin@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828121706.1721287-1-yikai.lin@vivo.com> References: <20240828121706.1721287-1-yikai.lin@vivo.com> X-ClientProxiedBy: SGBP274CA0018.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::30) To SEYPR06MB5913.apcprd06.prod.outlook.com (2603:1096:101:da::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR06MB5913:EE_|KL1PR06MB5884:EE_ X-MS-Office365-Filtering-Correlation-Id: ddcda870-573d-47c1-6c2b-08dcc75b64c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: fAgii6wTWC6U9HNtWS6aWaAq9EVT6074FstxQwGP6LEGUEfr7+W7jCl2ZOPDnZeKDXa+sun+XojRZRTyPfO1ndn7gQrJjq2089r1YeHzRoPNEzOlQxf1mNBCrOC9ycyjgwVD70I9w5SOpzznhMh971S1yiUuWdkQ+qHcPOyj8JP3qLVWuLgZ/yjUfudp79qUlvFFs+XFUHuO6TF4s4D921OR74FiIPXgXkMnNoyWz/Pfgmtz+VfX75lmOMt1SUZOVEStbBLi88WgaL+EJNYoOy+lGPlxSKNiKSj73EIZ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vruSWBytG5GOCdCeHio= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEYPR06MB5913.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: kbrPEU7L6ECTXUQcwdDx/AKWOFvQeUa+yO4g1Jxq+HYWahd+zWeH2sAg74EmOIgxRIItFEiDfnHyytzB/9XJYaFnL9TUVb56Bqw8yH+dKTYm1mpAWhsLP3dl1UGIxZ3ZdBCev14opw1OuGPwbPVr/m6YhIB7CnV7Qw7gIgh/rUeHZw2CiICRrv1FEdVHZuvQ0EtgpZLdq8bt0vLPjzlTa9PuQGnFJE1TpooI49if5FAKynPI22zSuNrBvN3yEkN56+auq6xLlZWyhuz4hmrw21iw0Lz4m4ThJRb75+nmI/l8Wb+mlV241fhmfycGpDI/P6JQuAw1pg9rIyOr28quqWxUsSZVDNx6D5VGgOtCkpyrGw8uhmQc+v35ht+2Gv02Vn22iCenqJ17a5cg1yPnw3/RruEDq0pAhIk7/GYWY0RS/f/2GZUrpIdv9rLT/KrXEmgvYELMiLbsSyNuSTHBL9qwELC7MAwCkymDdtPwOUk/B9iTMiq/t22c7ecANTzmu4VJmGK1IJpls129x3f6N7gKLJDtufeS03PjrJ4ux1/VJa6Nf/X6OVs2cyo7/XizwyBwEgmynjaFD3AmCDSSV6/jN0tIl/MG38u4d4k3slU8E8YXrZFUZjJiPWMPjKgnZuvgx//boEHsapiASXcPISdX34ghhWKmtmhr3OswzxP6Hjhwr+DxZ2h9GbqkimbZjw5cebIJt4B/FhotR5JOuvjvTX30uAkWDUg59q8uUzeJlQpN0bx0JXzeIqG+xAC3WVW6bpaKdLGS8DJTD7ZmehMkKUdLJKqYpPgASDOr5GGS5bkCO2IFRHvbp3nUqBgBmK3aN0FJ6dS+TjEJkySPTk3p2OVfTf2lwOjdb7ZTmRNYDsaeDvSZWxEkpXHLHf/trwH2fE3S7xdZcKyT56cJg9jFZUwWc1LFB8F4Sezd/GUEZectyHPk3iq+B0N89uPaYGbRudSV69JKZOOG6PWZwjo3Zsg2FCfUyuMPfwSrNrFZemV4WY3h+8MtUOJA+HyJZ2vKyDxDTP5WGH5oZGKw6qRIKxprVb9Urj6lUK8n5uminEoedot5yetDBQKxonhdF39L6Bvv/uCgY8eJRLXY376a7LudQja8B/8l/4BNpgKjdY8LxjrHbyW/sqrN6G6y+LYGXl17o6imLwsQB/MgZaL0a8Ih4uSbX1fdg+vucpm/0mS8JUKuI5Nd8rC1aNFjvIhDuMB1saejomWatwsU4ZjpotFcW3odY4KkKaRTrhAwGRbRsD9hdegUu2CqrNrXCKmhZezSTRwc+dZaJv3V3twWBrAP/H3cvSZ2vjTI06Gr2B1KhhuZrktm5WTjYMuXlKBZDqV63zddThcnbTuZUqEayb/1Snc866VNVdBnq60YuwAyMkPOuPF2vTK/5pRT1TuywaDczNbQdREkhRAZOiYTIPPL8StyehhwJcdJmGzPifd05Di7vaDIGrHpuuxXevAw5ouTVBmNyh5NSRWYoVIx70aHsUzJrBNMWqDCLAfr7XLoWZLugzJYK2sdSfCJvu0OcBGPDXyXXA73evUS7nYvxS9hqae7wIjCTr4EzeG8iS1cUiUWL8cus3rBecGn X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: ddcda870-573d-47c1-6c2b-08dcc75b64c8 X-MS-Exchange-CrossTenant-AuthSource: SEYPR06MB5913.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 12:17:33.0493 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: iCADVOD92z3HAq7lp0ZJ1x/DIuhmK0LnmNBKVyWeRArumXpU3evsuBLSrUMJAAw3j3Nmh5RKECktwhqqONK49w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB5884 In Makefile, we use $(SRCARCH) to access target arch's uapi include. This allow us to obtain the definition of 'struct user_pt_regs' for "ptrace.h" header file. Thus, it is no longer necessary to execute "make headers_install". Signed-off-by: Lin Yikai --- tools/testing/selftests/bpf/Makefile | 6 +++++ tools/testing/selftests/bpf/README.rst | 11 +++++++- tools/testing/selftests/bpf/vmtest.sh | 37 +++++++++++++++++++++----- 3 files changed, 47 insertions(+), 7 deletions(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index c120617b64ad..3f0f9a171651 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -444,6 +444,7 @@ CLANG_TARGET_ARCH = --target=$(notdir $(CROSS_COMPILE:%-=%)) endif CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH)) + BPF_CFLAGS = -g -Wall -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \ -I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \ -I$(abspath $(OUTPUT)/../usr/include) \ @@ -452,6 +453,11 @@ BPF_CFLAGS = -g -Wall -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \ CLANG_CFLAGS = $(CLANG_SYS_INCLUDES) +ifneq ($(CROSS_COMPILE),) +src_uapi_dir := $(srctree)/arch/$(SRCARCH)/include/uapi +BPF_CFLAGS += -I$(src_uapi_dir) +endif + $(OUTPUT)/test_l4lb_noinline.o: BPF_CFLAGS += -fno-inline $(OUTPUT)/test_xdp_noinline.o: BPF_CFLAGS += -fno-inline diff --git a/tools/testing/selftests/bpf/README.rst b/tools/testing/selftests/bpf/README.rst index 9b974e425af3..41ab23bd3277 100644 --- a/tools/testing/selftests/bpf/README.rst +++ b/tools/testing/selftests/bpf/README.rst @@ -79,13 +79,22 @@ In case of linker errors when running selftests, try using static linking: $ LDLIBS=-static PKG_CONFIG='pkg-config --static' vmtest.sh +If you want to make corss-compile, such as compile arm64 on x86_64, you can try: + +.. code-block:: console + + $ export PATH=$PATH:{The corss-compile's path}/bin + $ export ARCH=arm64 + $ export CROSS_COMPILE=aarch64-linux-gnu- + $ LDLIBS=-static vmtest.sh + .. note:: Some distros may not support static linking. .. note:: The script uses pahole and clang based on host environment setting. If you want to change pahole and llvm, you can change `PATH` environment variable in the beginning of script. -.. note:: The script currently only supports x86_64 and s390x architectures. +.. note:: The script currently only supports x86_64, s390x and arm64 architectures. Additional information about selftest failures are documented here. diff --git a/tools/testing/selftests/bpf/vmtest.sh b/tools/testing/selftests/bpf/vmtest.sh index 65d14f3bbe30..c7461ed496ab 100755 --- a/tools/testing/selftests/bpf/vmtest.sh +++ b/tools/testing/selftests/bpf/vmtest.sh @@ -4,11 +4,11 @@ set -u set -e -# This script currently only works for x86_64 and s390x, as +# This script currently only works for x86_64, s390x and arm64, as # it is based on the VM image used by the BPF CI, which is # available only for these architectures. -ARCH="$(uname -m)" -case "${ARCH}" in +HOST_ARCH="$(uname -m)" +case "${HOST_ARCH}" in s390x) QEMU_BINARY=qemu-system-s390x QEMU_CONSOLE="ttyS1" @@ -32,13 +32,38 @@ aarch64) exit 1 ;; esac + +# process CROSS_COMPILE setting to enable cross-compilation +process_cross_compile() { + if [ -z "${CROSS_COMPILE+x}" ]; then + return + fi + case "$1" in + x86_64) + #Cross-compiling for arm64 on an x86_64 host + if [[ $CROSS_COMPILE == *aarch64* ]]; then + VM_ARCH=aarch64 + QEMU_CONSOLE="ttyAMA0,115200" + QEMU_BINARY=qemu-system-aarch64 + QEMU_FLAGS=(-M virt,gic-version=3 -cpu cortex-a57 -smp 8) + BZIMAGE="arch/arm64/boot/Image" + echo "Setting VM_ARCH from $HOST_ARCH to $VM_ARCH as specified by CROSS_COMPILE" + fi + ;; + esac +} + +VM_ARCH=${HOST_ARCH} +process_cross_compile "$VM_ARCH" + + DEFAULT_COMMAND="./test_progs" MOUNT_DIR="mnt" ROOTFS_IMAGE="root.img" OUTPUT_DIR="$HOME/.bpf_selftests" KCONFIG_REL_PATHS=("tools/testing/selftests/bpf/config" "tools/testing/selftests/bpf/config.vm" - "tools/testing/selftests/bpf/config.${ARCH}") + "tools/testing/selftests/bpf/config.${VM_ARCH}") INDEX_URL="https://raw.githubusercontent.com/libbpf/ci/master/INDEX" NUM_COMPILE_JOBS="$(nproc)" LOG_FILE_BASE="$(date +"bpf_selftests.%Y-%m-%d_%H-%M-%S")" @@ -109,7 +134,7 @@ newest_rootfs_version() { { for file in "${!URLS[@]}"; do - if [[ $file =~ ^"${ARCH}"/libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then + if [[ $file =~ ^"${VM_ARCH}"/libbpf-vmtest-rootfs-(.*)\.tar\.zst$ ]]; then echo "${BASH_REMATCH[1]}" fi done @@ -126,7 +151,7 @@ download_rootfs() exit 1 fi - download "${ARCH}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst" | + download "${VM_ARCH}/libbpf-vmtest-rootfs-$rootfsversion.tar.zst" | zstd -d | sudo tar -C "$dir" -x } From patchwork Wed Aug 28 12:17:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lin Yikai X-Patchwork-Id: 13781199 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2056.outbound.protection.outlook.com [40.107.215.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BE4F176259; Wed, 28 Aug 2024 12:17:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.56 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724847468; cv=fail; b=ePF4VQ0IT2keSshmumDcgD3nySeU3f7ssFqNrz5HV/RF9hLs51JDTA9qrWWdYphmEoejxUSx4+fM9AuAEcP3xJ/Bqe3O0buRa6yF4pQ5gwlRBwXvKWK+9Dz5LvWHw2PH54lqT5IxfEL5ewMbLiXw7htQj1CtAUxZsgNMg9Q9VcE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1724847468; c=relaxed/simple; bh=W7Pf/beh55LSkU7u5QFgUZgcOvsu6zYrFFs9audhap0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=gg2D+4fSOBu1Qr0M3yNj7kzESRWN6HCfI4lKSb40tVyAOJTI7KtyycxqXzf7L60QioXDn7ctlRwa8bB/lgqW9V/guzN/XmP4QsW193ReSRc9OxXaZOxE7Isq0kX3bsPCAmNcd+pvH403FC55g6cfEJIJTJkogLAK2iaSqdvdyTE= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=U2wlLubZ; arc=fail smtp.client-ip=40.107.215.56 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="U2wlLubZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LIxg9Nrg54BKbjtU3Jwt1J7/FNfjQp3gJY5hJm91P6ysSwDfutw3LkokncuqpM5iicMMeqMRXFzzpK7Y6oSqv01j4wI88tjzhPF09oogbKRoUh7XDTzYU2IYCyb2gYboPTzX1DnN20REDFMew1WoR6NVsLHKFFg1sJODeWdG1sa9YBNNs7BXp1omLlQ8NkLHisSHyBQbe7QNAkflzIJBMT92ufzerKDht55zVMzq2eyW9YcRO/EKvVPHloh6VJ41CnktuQrMHkghhQ6aLh3WdZqdEQYtm4yXMQ+ZbIXr6h633Oy0tqF3Dd9fyuE1PSbJWReSIc5HaIdwPJD7YTXjTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SHLIcIwjRUgWJ5T4eU7rRhy1/DMI61YC1bYUPUH9Dlc=; b=c7kXUZQsUC9RBX8lZRM0Ut1bjhB+uM2u9kOeimUscvZ+KP+59PklK017DLNz2Sua3DBP9YWQ+ZWBXS0O2fHd+joSelMT48AJyGYp49N3l0ySTFpjSa49b+5dT165EiqO5iUPS8oJ78ZF5+FXyPU9DnMBlmDn8SSJf8SFh0pX/lO44zhWWfnMatT/7AkGpk0FCAVvsKX8mryKfwmUXULW4SN5qZtV5JM5/yLhXfPZ/lqrl38cG7HSvvpCkag8Pu0qRzevOBiMiwYPlB2ZmXU5LcW7lPlCao+bkwgCfi3kaHbz8RPHixEa+rKXXvJUTrFjAuLkwOSPzA8msfCkvPEr9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SHLIcIwjRUgWJ5T4eU7rRhy1/DMI61YC1bYUPUH9Dlc=; b=U2wlLubZYcUO1ZpASpbFk3bFdyAUxfX9zoOmeUWYxSAyhSZQ4OYo+Vj4Zedxkdy9z/3w4a/XE1riYO/E3ObsV7iAPGEnc1B+M3fncZtz9GlI9F9rHqY2qvsoMWl6OUiUPkTO1LACofaWR1y/7txCJWUhrL4l6HBLkywTZR+M6HWDW2FfNei5GcjjDzQJZLvgb8lfPCWm0J3OBiZicHjyHNEkM+yiIou0I4XeIm5fUgU8/wC5ImNQ4uNmYgy46wUllku9HC7lbZjFjSuwZOXjB+/k2J2/KP539hAQD3WChDKHmUYwTaNgyQdE4dZBhZG/VQd3ZeE+X2DPNKMZM6TdzQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from SEYPR06MB5913.apcprd06.prod.outlook.com (2603:1096:101:da::16) by KL1PR06MB5884.apcprd06.prod.outlook.com (2603:1096:820:dd::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.27; Wed, 28 Aug 2024 12:17:39 +0000 Received: from SEYPR06MB5913.apcprd06.prod.outlook.com ([fe80::f049:a716:8200:c4a1]) by SEYPR06MB5913.apcprd06.prod.outlook.com ([fe80::f049:a716:8200:c4a1%4]) with mapi id 15.20.7897.021; Wed, 28 Aug 2024 12:17:39 +0000 From: Lin Yikai To: andrii@kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@fomichev.me, haoluo@google.com, jolsa@kernel.org, mykolal@fb.com, shuah@kernel.org, terrelln@fb.com, bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, opensource.kernel@vivo.com, yikai.lin@vivo.com Subject: [PATCH bpf-next v2 2/2] selftests/bpf: fix static cross-compile error for liblstd.a linking. Date: Wed, 28 Aug 2024 20:17:06 +0800 Message-Id: <20240828121706.1721287-3-yikai.lin@vivo.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240828121706.1721287-1-yikai.lin@vivo.com> References: <20240828121706.1721287-1-yikai.lin@vivo.com> X-ClientProxiedBy: SGBP274CA0018.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::30) To SEYPR06MB5913.apcprd06.prod.outlook.com (2603:1096:101:da::16) Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SEYPR06MB5913:EE_|KL1PR06MB5884:EE_ X-MS-Office365-Filtering-Correlation-Id: 11f7f8d6-0f34-49f2-4356-08dcc75b6867 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|7416014|366016|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 3wFNbtBiOfF6AX6dd1OPYrIOye/8DmrO5Jo6IOj8KX5mdstGKF5WLuPgzHE2Nuz4wm+VUgPZqgA4b/d4huR9rOEEwJi5iFTGH7H7KxCPqA1Veqj5QCuw1Eh/D4Tgu2Bm3nyWE/92/iBZz2fgw0goBnwjv1Va8ttcXmo9QEsp8/VTA/HYLRQpxOBwGa6nOtnexl79CInGttsHQDNX+KepoxLWe575a9+6ZQTq/6tKLbtGRIt4i6HqitoOGDJgnztFBDtEWipxcCXFmVpRZgYRTFXt749KsCmU9AYPYfTBSeZZY8lCl/XTHrQJHwlpQ+2ggflU9HSQZgOSs+maULoSoBXqn/p6rVVNC2BXxTWkTHbe/emEM07cEDjduuvbA18KbzZouh5lqDscdQQXBzrprEzj6UoIQH8dNTDX7/oYWir3jp22ezNKJ/Lkzs3NRxETvoA54fNaZ9UpwX6q39QpHjyu38T6KwUvaosSAYPImDc6f/R303EKHWv7SNUxyZ2qUkI32VxthdOwFsvRCaxcIU8QKnrHQRg6M79ku2FyxxRbFcjfNF8TjVhK3SNtogo14A21wKocVv4eURHdFIiplZRF4czk5y3Vl8+IW+MT9ivBICYmkPfCMH/754rYCTFx++EYqT6lCJ0f4wXBdJdzjVGEJDI5Pyyfrrlt88yggjBSJQjGb/WR9+PARBtnal4ytzloHRCbIHwE7c3D+tMaAvbk0xnfM+fCPuG6GhK9wsM4bC85tWOe61THIW/qThgbdYhSn0NMABreprqAWhBU1nATPzyoX85x28jrWvl9pvtiBuPofyFyVvvnBdecRZA/X93KECvBrRhWcsov8CEx2pvXI3dVJAAG+RrqX59Nj2l12PxNmXhRp5bZambM0nNvCRGVLPN2DF1SO0WGec2VNyFcTA9x1qKmK+JK4rCQlkFzQ8Shg0t7NnTnxqm+2YlLjojWOgLLFzNSeCLM7D4wGu/FJA4jzkyvRjAhzjtZYoST4sWFWZPZr+SOZQzIRB395hzI8F94bLrxFdUpaVwQvmyWXf6eIy9cqtZZSBXjYX1K0RBtcj+uu4I2wAZIgSvijoPA/+b/m3UOP5QOSSAylBdW2VBlGP8PdnCTqJXARKCAroHoV9277b7v0RU1/8Ti3quTWZp7LdXasDh1K0Z8sMmQxHLTVoViAGf4D3zG8vgyols8HzUb4i9GJLnnMiv5Vk1e6ve88ixWuU27aRhBusmxpQWJlS8aqzXE5ViZuJVuT/UY0B6ziW7QR2t0QtfEW47QEu4o1mkPoGplK2K7bSMLmNONwefWq+nanvgHX40Ri9amSeEBCMP9BmCIOm2YQg5RGK/4PBX9QgY0tRGbRi3uMZqXYgxWwq4d9/dM7YAUJY8OStjkk5mwuS2fNuouZISyflBsG0si8EEr3wgmbQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SEYPR06MB5913.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(7416014)(366016)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +DFHAUsPW2eG4DgGsxXhCFfqTpmUo3WrOnlRvxCg3kFMHP4vzNMgKaSqP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hurdp2Wq+4Fl7X9M1bk8B12kwwz3pL4Vkghqb0zRay/nKJIdjLAQgM009fvkUVLP9bhlCmNNSLcBW3Ip5Yo81jTF14hkBElNq1sjm231VRvkkYcv31fxlP8A11m+9noAgFMrZlUOqPOJEfe8rDJxPyURTcEn7rxFoTbpcPrd1HvFR+pXIUeUhYry2oREOi0+G8rw9ssaeOlClZO5ImZMyYP9ybNyMY+4XrBNILTpSNCrkUQPROPnw9gbAoQNhZ1Uo7OCuVmQnrnABrnpnfVmx/4pB9sjRfGGfuswjt6I0H6ujMKbG0eGOU6VJWrdqE9YmJy9YkfHM8VnJcm/wMw4oD30A7I3Pi4mRBrhsq2+lFFlLO21sBRlH+9LSMraZfZlVZrIf+NlQckaGXK8J6Uw0IhpT0tlexHoEyk47GENo7GvNPsc/uQGkoPGPzhXfIePvihmXgF0Pa/wxO3ZB3 X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11f7f8d6-0f34-49f2-4356-08dcc75b6867 X-MS-Exchange-CrossTenant-AuthSource: SEYPR06MB5913.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Aug 2024 12:17:39.0245 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: RowrE1P2spMgmXuwqd8vPV8yLF3GVZu7EQh4mikGEBrmLk2N3kCVfhrbseBaxQLwawtktpa2JXzjrVPEJdQC0g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB5884 Regard "LDLIBS += -lzstd" as a separate patch for static compile. To fix static cross-compile error like this: $LDLIBS=-static LDFLAGS=--sysroot=/aarch64-linux-gnu/libc ./vmtest.sh -s -- ./test_progs /aarch64-linux-gnu/bin/ld: aarch64-linux-gnu/libc/usr/lib/libelf.a(elf_compress.o): in function `__libelf_compress': (.text+0xec): undefined reference to `ZSTD_createCCtx' /aarch64-linux-gnu/bin/ld: (.text+0xf0): undefined reference to `ZSTD_createCCtx' ... Signed-off-by: Lin Yikai --- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile index 3f0f9a171651..17d75ac2f461 100644 --- a/tools/testing/selftests/bpf/Makefile +++ b/tools/testing/selftests/bpf/Makefile @@ -46,7 +46,7 @@ CFLAGS += -g $(OPT_FLAGS) -rdynamic \ -I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \ -I$(TOOLSINCDIR) -I$(APIDIR) -I$(OUTPUT) LDFLAGS += $(SAN_LDFLAGS) -LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread +LDLIBS += $(LIBELF_LIBS) -lz -lrt -lpthread -lzstd PCAP_CFLAGS := $(shell $(PKG_CONFIG) --cflags libpcap 2>/dev/null && echo "-DTRAFFIC_MONITOR=1") PCAP_LIBS := $(shell $(PKG_CONFIG) --libs libpcap 2>/dev/null)