From nobody Sun Feb 8 16:34:16 2026 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 678B9C001DE for ; Tue, 25 Jul 2023 09:24:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231557AbjGYJYU (ORCPT ); Tue, 25 Jul 2023 05:24:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231362AbjGYJYQ (ORCPT ); Tue, 25 Jul 2023 05:24:16 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F185F1A3 for ; Tue, 25 Jul 2023 02:24:14 -0700 (PDT) Received: from canpemm500001.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4R9BN229vQzNmjC; Tue, 25 Jul 2023 17:20:50 +0800 (CST) Received: from localhost.localdomain (10.175.103.91) by canpemm500001.china.huawei.com (7.192.104.163) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Tue, 25 Jul 2023 17:24:12 +0800 From: Xie XiuQi To: , , CC: , , , Subject: [PATCH] tools/mm: fix undefined reference to pthread_once Date: Tue, 25 Jul 2023 17:21:49 +0800 Message-ID: <20230725092149.443119-1-xiexiuqi@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.175.103.91] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To canpemm500001.china.huawei.com (7.192.104.163) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Commit 97d5f2e9ee12 ("tools api fs: More thread safety for global filesystem variables") introduces pthread_once, so the libpthread should be added at link time, or we'll meet the following compile error when 'make -C tools/mm': gcc -Wall -Wextra -I../lib/ -o page-types page-types.c ../lib/api/libapi.a ~/linux/tools/lib/api/fs/fs.c:146: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:147: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:148: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:149: undefined reference to `pthread_once' ~/linux/tools/lib/api/fs/fs.c:150: undefined reference to `pthread_once' /usr/bin/ld: ../lib/api/libapi.a(libapi-in.o):~/linux/tools/lib/api/fs/fs= .c:151: more undefined references to `pthread_once' follow collect2: error: ld returned 1 exit status make: *** [Makefile:22: page-types] Error 1 Fixes: 97d5f2e9ee12 ("tools api fs: More thread safety for global filesyste= m variables") Signed-off-by: Xie XiuQi Acked-by: Ian Rogers --- tools/mm/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/mm/Makefile b/tools/mm/Makefile index 6c1da51f4177..9997b2e401ae 100644 --- a/tools/mm/Makefile +++ b/tools/mm/Makefile @@ -9,7 +9,7 @@ LIB_DIR =3D ../lib/api LIBS =3D $(LIB_DIR)/libapi.a =20 CFLAGS +=3D -Wall -Wextra -I../lib/ -LDFLAGS +=3D $(LIBS) +LDFLAGS +=3D $(LIBS) -lpthread =20 all: $(TARGETS) =20 --=20 2.25.1