Skip to content

RISC-V: JALR rd == 0 does not emit a branch #6273

Open
@emesare

Description

@emesare

However, I encountered another problem: "functions" that are called with jalr rd, rs1, imm usually end with jr rd. Obviously, the control-flow is the target "function" is unresolved, since rd does not have defined value in the context of the function.

As a matter of fact, this target "function" (ending with jr rd) is most probably just one or multiple basic blocks that are shared between multiple calling functions for space optimization.

Is there any way to tell BN to treat these target "functions" as such ? (i.e. not functions, but basic blocks to reattach to different parent functions). Doing this manually would be the equivalent of "Append function tail" feature in IDA ; that would be great is BN would handle this automatically (BN usually has no problem with shared basic blocks IIRC)

Or maybe my patch is incomplete, and this is already handled.

Anyway, thanks in advance

Forwarded for @jeanmicheldeva (original message)

Metadata

Metadata

Assignees

Labels

Arch: RISC-VIssues with the RISC-V architecture pluginComponent: ArchitectureIssue needs changes to an architecture pluginEffort: LowIssue should take < 1 weekImpact: LowIssue is a papercut or has a good, supported workaround

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions