Skip to content

Support specifying a stack location as an argument and return value in calling convention #3340

@fuzyll

Description

@fuzyll

What is the feature you'd like to have?
You can specify a register as the location for an argument in binary ninja by doing something like int32_t arg1@rax (to specify that arg1 is in rax). You cannot specify a stack location, which is problematic for certain compilers and/or languages (like Go).

Is your feature request related to a problem?
See above. We would have much better support for languages like Go that tend to do this a fair amount, even if doing this were a manual process instead of an automated one.

Additional Information:
There are many ways this could be implemented. In my head, it would be simple enough to just extend the @ syntax to allow for something like int32_t arg1@rsp+4 (e.g. register + offset instead of just register) when setting the type for the return value or an argument. Ideally we would also update our analysis to be able to identify these things automatically, but being able to manually fix things up is an important first step.

It should be noted that I don't think you can specify the return location in a specific register through the y button (the "Change Type" menu) at all right now, either, which maybe means this should be split into two issues? I believe you need to do it through the Edit Function Properties window instead. I've campaigned for merging these together on a few occasions, so consider this another suggestion to consider doing so. 🙂

Metadata

Metadata

Assignees

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions