[PATCH dwarves v5 08/11] dwarf_loader: Check whether two-reg parameter actually use two regs or not
Yonghong Song <[email protected]> Sat, 23 May 2026 09:57:55 -0700
| Newsgroups | org.kernel.vger.dwarves,org.kernel.vger.bpf |
|---|---|
| Message-ID | <[email protected]> |
For a parameter whose type occuplies two registers, for x86_64 and aarch64, the parameter will actually use two registers. S390 is different as it allocates on stack and pass a pointer to the function. Signed-off-by: Yonghong Song <[email protected]> --- dwarf_loader.c | 11 +++++++++++ dwarves.h | 1 + 2 files changed, 12 insertions(+) diff --git a/dwarf_loader.c b/dwarf_loader.c index 97f576a..b888783 100644 --- a/dwarf_loader.c +++ b/dwarf_loader.c @@ -1100,6 +1100,16 @@ static void arch__set_register_params(const GElf_Ehdr *ehdr, struct cu *cu) } } +static bool arch__agg_use_two_regs(const GElf_Ehdr *ehdr) +{ + switch (ehdr->e_machine) { + case EM_S390: + return false; + default: + return true; + } +} + static struct template_type_param *template_type_param__new(Dwarf_Die *die, struct cu *cu, struct conf_load *conf) { struct template_type_param *ttparm = tag__alloc(cu, sizeof(*ttparm)); @@ -3562,6 +3572,7 @@ static int cu__set_common(struct cu *cu, struct conf_load *conf, cu->little_endian = ehdr.e_ident[EI_DATA] == ELFDATA2LSB; cu->nr_register_params = arch__nr_register_params(&ehdr); + cu->agg_use_two_regs = arch__agg_use_two_regs(&ehdr); arch__set_register_params(&ehdr, cu); return 0; } diff --git a/dwarves.h b/dwarves.h index b49e651..2d94dff 100644 --- a/dwarves.h +++ b/dwarves.h @@ -307,6 +307,7 @@ struct cu { uint8_t uses_global_strings:1; uint8_t little_endian:1; uint8_t producer_clang:1; + uint8_t agg_use_two_regs:1; /* An aggregate like {long a; long b;} */ uint8_t nr_register_params; int register_params[ARCH_MAX_REGISTER_PARAMS]; int functions_saved; -- 2.53.0-Meta