Re: [PATCH v2 1/3] btf_encoder: skip functions consuming packed structs passed by value on stack

Alexis Lothoré
2025-07-04T21:12:16Z

On Fri Jul 4, 2025 at 10:05 PM CEST, Ihor Solodrai wrote:
> On 7/3/25 2:02 AM, Alexis LothorÃ© (eBPF Foundation) wrote:

[...]

>> +static bool ftype__has_uncertain_arg_loc(struct cu *cu, struct ftype *ftype)
>> +{
>> + struct parameter *param;
>> + int param_idx = 0;
>> +
>> + if (ftype->nr_parms < cu->nr_register_params)
>> + return false;
>> +
>> + ftype__for_each_parameter(ftype, param) {
>> + if (param_idx++ < cu->nr_register_params)
>> + continue;
>> +
>> + struct tag *type = cu__type(cu, param->tag.type);
>> +
>> + if (type == NULL || !tag__is_struct(type))
>> + continue;
>> +
>> + struct type *ctype = tag__type(type);
>> + if (ctype->namespace.name == 0)
>> + continue;
>> +
>> + struct class *class = tag__class(type);
>> +
>> + class__find_holes(class);
>> + class__infer_packed_attributes(class, cu);
>
> I just noticed that class__infer_packed_attributes() already does call
> class__find_holes() [1], so calling it here is unnecessary. Although
> there is already a flag to detect repeated calls [2].
>
> [1] https://github.com/acmel/dwarves/blob/master/dwarves.c#L1859
> [2] https://github.com/acmel/dwarves/blob/master/dwarves.c#L1604-L1605

ACK, I'll remove the duplicate class__find_holes then.