[clang] [llvm] [Clang][BPF] Allow sign extension for call parameters with int types (PR #84874)

via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 14 11:49:23 PDT 2024


yonghong-song wrote:

@pulehui I will not merge this patch now since it does not really solve the whole riscv issue. As @4ast commented above, the verifier made btf_func_model to jit.
```
struct btf_func_model {
        u8 ret_size;
        u8 ret_flags;
        u8 nr_args;
        u8 arg_size[MAX_BPF_FUNC_ARGS];
        u8 arg_flags[MAX_BPF_FUNC_ARGS];
};
```
For example, for each argument, you will know its size and flags has some information as well.The flags has
```
static u8 __get_type_fmodel_flags(const struct btf_type *t)
{
        u8 flags = 0;

        if (__btf_type_is_struct(t))
                flags |= BTF_FMODEL_STRUCT_ARG;
        if (btf_type_is_signed_int(t))
                flags |= BTF_FMODEL_SIGNED_ARG;

        return flags;
}
```
So you will know whether it is a struct or signed or not. If you feel you need explicit UNSIGNED flag, you can add it in btf as well.

Let us try to resolve the issue in riscv backend. Thanks!


https://github.com/llvm/llvm-project/pull/84874


More information about the cfe-commits mailing list