[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7fb4b953-449d-4f72-8bc7-2becae3cc639@linux.dev>
Date: Wed, 26 Nov 2025 10:32:30 -0800
From: Ihor Solodrai <ihor.solodrai@...ux.dev>
To: Donglin Peng <dolinux.peng@...il.com>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>, Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <martin.lau@...ux.dev>, Eduard Zingerman
<eddyz87@...il.com>, Song Liu <song@...nel.org>,
Yonghong Song <yonghong.song@...ux.dev>,
John Fastabend <john.fastabend@...il.com>, KP Singh <kpsingh@...nel.org>,
Stanislav Fomichev <sdf@...ichev.me>, Hao Luo <haoluo@...gle.com>,
Jiri Olsa <jolsa@...nel.org>, Nathan Chancellor <nathan@...nel.org>,
Nicolas Schier <nicolas.schier@...ux.dev>,
Nick Desaulniers <nick.desaulniers+lkml@...il.com>,
Bill Wendling <morbo@...gle.com>, Justin Stitt <justinstitt@...gle.com>,
bpf@...r.kernel.org, dwarves@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-kbuild@...r.kernel.org, Alan Maguire <alan.maguire@...cle.com>
Subject: Re: [PATCH bpf-next v1 4/4] resolve_btfids: change in-place update
with raw binary output
On 11/25/25 8:46 PM, Donglin Peng wrote:
> On Wed, Nov 26, 2025 at 9:29 AM Ihor Solodrai <ihor.solodrai@...ux.dev> wrote:
>>
>> [...]
>> static const char * const resolve_btfids_usage[] = {
>> @@ -823,12 +875,13 @@ int main(int argc, const char **argv)
>> .funcs = RB_ROOT,
>> .sets = RB_ROOT,
>> };
>> + char out_path[PATH_MAX];
>> bool fatal_warnings = false;
>> struct option btfid_options[] = {
>> OPT_INCR('v', "verbose", &verbose,
>> "be more verbose (show errors, etc)"),
>> OPT_STRING(0, "btf", &obj.btf_path, "BTF data",
>> - "BTF data"),
>> + "input BTF data"),
>> OPT_STRING('b', "btf_base", &obj.base_btf_path, "file",
>> "path of file providing base BTF"),
>> OPT_BOOLEAN(0, "fatal_warnings", &fatal_warnings,
>> @@ -844,6 +897,9 @@ int main(int argc, const char **argv)
>>
>> obj.path = argv[0];
>>
>> + if (load_btf(&obj))
>> + goto out;
>
> I think I can add the BTF sorting function here based on your patch.
Correct. Any btf2btf transformations will have to happen before the
symbols resolution.
>
> Thanks,
> Donglin
>> +
>> if (elf_collect(&obj))
>> goto out;
>>
>> @@ -853,23 +909,37 @@ int main(int argc, const char **argv)
>> */
>> if (obj.efile.idlist_shndx == -1 ||
>> obj.efile.symbols_shndx == -1) {
>> - pr_debug("Cannot find .BTF_ids or symbols sections, nothing to do\n");
>> - err = 0;
>> - goto out;
>> + pr_debug("Cannot find .BTF_ids or symbols sections, skip symbols resolution\n");
>> + goto dump_btf;
>> }
>>
>> if (symbols_collect(&obj))
>> goto out;
>>
>> - if (load_btf(&obj))
>> - goto out;
>> -
>> if (symbols_resolve(&obj))
>> goto out;
>>
>> if (symbols_patch(&obj))
>> goto out;
>>
>> + strcpy(out_path, obj.path);
>> + strcat(out_path, ".btf_ids");
>> + if (dump_raw_btf_ids(&obj, out_path))
>> + goto out;
>> +
>> +dump_btf:
>> + strcpy(out_path, obj.path);
>> + strcat(out_path, ".btf");
>
> Do we need to add .btf files to the .gitignore file?
I don't know. Probably?
I take care to cleanup temporary files in the gen-btf.sh, but it makes
sense to .gitignore them anyways, since those are temporary build
artifacts.
>
> Thanks,
> Donglin
>
>> + if (dump_raw_btf(obj.btf, out_path))
>> + goto out;
>> +
>> + if (obj.base_btf) {
>> + strcpy(out_path, obj.path);
>> + strcat(out_path, ".distilled_base.btf");
>> + if (dump_raw_btf(obj.base_btf, out_path))
>> + goto out;
>> + }
>> +
>> if (!(fatal_warnings && warnings))
>> err = 0;
>> out:
>> --
>> 2.52.0
>>
Powered by blists - more mailing lists