Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp695072rwe; Wed, 24 Aug 2022 07:38:52 -0700 (PDT) X-Google-Smtp-Source: AA6agR6o3kSmnQsqWGppdaZ8R2+DWf1SKTJoAVnv3WH4tAdlrEzX8av5nFJ+eGfPxjJorxQox995 X-Received: by 2002:a63:798c:0:b0:42a:4612:c07b with SMTP id u134-20020a63798c000000b0042a4612c07bmr19821606pgc.519.1661351932207; Wed, 24 Aug 2022 07:38:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661351932; cv=none; d=google.com; s=arc-20160816; b=LbGLb741PPWicYOEZ78wy2aX/UEnMXln3pMlonkzJcKOZSea3KqXK/NPomPhWcxwQr 2y+LI4Y/v/YweQ/CYnHfCwbkGSWj51rRWI9x04viP6hq4ztoZZfrUTOggUn6FBYLJudI 5UwzBEIpslIi892J09wYxAyd6i+J0OG/3GQn4Q2EQ/WvnLZ4xO+YTD2xJZhD2S7iyHn7 dUK4LdwkwUf0CIhG38pokOzrmUmrJxBX0j9qHIh9sFmrMQCOwiJjY2OJwwEoUSTkSipj aEUwdNS0Kv9ZJ667EOYLoKnembTIuB6l+BB67Gx5Qp+W/vuMD+Uu/yNIeI97EIilGdo3 ngpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=oLdo3QZ+FnQ0nsmTtGkIvl/vOr+TTR+PQ4zL0TVlpOs=; b=jwfMzAQlnUXPmR8hA6LWiPYDtMGuHDZtsYjlaO/5ZEP+ik1TWgvK0y6Tn2DINdKMoY ScY0hZ4rAZKfP4gYQxAWtzQlnSyKBTO4R5erY95oLBS2ii9g3UvP4C9T/1RWsALezHJC Tk1w0ids8wDpWNkxUB2PSoWwr/coBcIUFzsOQ06dfwnbuzTo5p2cez51FPtE/2FR47V1 yFRwmQfKGzsnrYAZv0v2QPhrkeytpz5ovX+zWncGnIl5Ecix4qu+lKL09AZnKtKqr7v3 71aVILZV99PwtUG1Ux7aGU+JvOY59Hq9HM+yyHR/QCjCRMCrb4CEdyCgIz/i6aO34149 /LDA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 74-20020a63004d000000b0042b406231dcsi262842pga.867.2022.08.24.07.38.39; Wed, 24 Aug 2022 07:38:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239016AbiHXOGE (ORCPT + 99 others); Wed, 24 Aug 2022 10:06:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239234AbiHXOFn (ORCPT ); Wed, 24 Aug 2022 10:05:43 -0400 Received: from out30-54.freemail.mail.aliyun.com (out30-54.freemail.mail.aliyun.com [115.124.30.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A0DA7E02D; Wed, 24 Aug 2022 07:05:36 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R531e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=chentao.kernel@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0VN7g--P_1661349909; Received: from VM20210331-5.tbsite.net(mailfrom:chentao.kernel@linux.alibaba.com fp:SMTPD_---0VN7g--P_1661349909) by smtp.aliyun-inc.com; Wed, 24 Aug 2022 22:05:31 +0800 From: "chentao.ct" To: Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend Cc: KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, "chentao.ct" Subject: [PATCH] libbpf: Support raw btf placed in the default path Date: Wed, 24 Aug 2022 22:05:07 +0800 Message-Id: <1661349907-57222-1-git-send-email-chentao.kernel@linux.alibaba.com> X-Mailer: git-send-email 2.2.1 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now only elf btf can be placed in the default path, raw btf should also can be there. Signed-off-by: chentao.ct --- tools/lib/bpf/btf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/lib/bpf/btf.c b/tools/lib/bpf/btf.c index bb1e06e..b22b5b3 100644 --- a/tools/lib/bpf/btf.c +++ b/tools/lib/bpf/btf.c @@ -4661,7 +4661,7 @@ struct btf *btf__load_vmlinux_btf(void) } locations[] = { /* try canonical vmlinux BTF through sysfs first */ { "/sys/kernel/btf/vmlinux", true /* raw BTF */ }, - /* fall back to trying to find vmlinux ELF on disk otherwise */ + /* fall back to trying to find vmlinux RAW/ELF on disk otherwise */ { "/boot/vmlinux-%1$s" }, { "/lib/modules/%1$s/vmlinux-%1$s" }, { "/lib/modules/%1$s/build/vmlinux" }, @@ -4686,7 +4686,7 @@ struct btf *btf__load_vmlinux_btf(void) if (locations[i].raw_btf) btf = btf__parse_raw(path); else - btf = btf__parse_elf(path, NULL); + btf = btf__parse(path, NULL); err = libbpf_get_error(btf); pr_debug("loading kernel BTF '%s': %d\n", path, err); if (err) -- 2.2.1