Re: [PATCH bpf-next v3 6/6] resolve_btfids: change in-place update with raw binary output
From: Ihor Solodrai
Date: Mon Dec 15 2025 - 21:16:24 EST
On 12/11/25 11:08 PM, Eduard Zingerman wrote:
> On Fri, 2025-12-05 at 14:35 -0800, Ihor Solodrai wrote:
>
> [...]
>
>> @@ -860,23 +913,34 @@ 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;
>>
>> + err = make_out_path(out_path, obj.path, BTF_IDS_SECTION);
>> + if (err || dump_raw_btf_ids(&obj, out_path))
>> + goto out;
>> +
>> +dump_btf:
>> + err = make_out_path(out_path, obj.path, BTF_ELF_SEC);
>> + if (err || dump_raw_btf(obj.btf, out_path))
>
> Nit: 'err' is not set if dump_raw_btf() errors out.
> Maybe use:
>
> err = make_out_path(out_path, obj.path, BTF_ELF_SEC);
> err = err ?: dump_raw_btf(obj.btf, out_path);
> if (err)
> goto out;
> ?
Good observation. I'll fix this, thanks.
>
>> + goto out;
>> +
>> + if (obj.base_btf && obj.distill_base) {
>> + err = make_out_path(out_path, obj.path, BTF_BASE_ELF_SEC);
>> + if (err || dump_raw_btf(obj.base_btf, out_path))
>> + goto out;
>> + }
>> +
>> if (!(fatal_warnings && warnings))
>> err = 0;
>> out:
>
> [...]