NationalSecurityAgency / ghidra

Ghidra is a software reverse engineering (SRE) framework
https://www.nsa.gov/ghidra
Apache License 2.0
51.96k stars 5.9k forks source link

Sparc 32 defaulting to returning undefined8 for void #6990

Open mumbel opened 1 month ago

mumbel commented 1 month ago

Describe the bug Upgraded an image. Noticed uncommitted void return functions want to now return undefined8.

Using unknown logic for the low 32 or really high, but wants to use param_2 as the high 32-bits. Inserting at least a param_1 and param_2 into the prototype even when it's zero arguments.

Previous ghidra versions were also broken though sometimes, converting void into undefined4, returning param_1 (and adding param_1 as an argument even when not present)

Environment (please complete the following information):

mumbel commented 1 month ago

No, nvmd. It's def breaking lots of functions, not just void return. It doesn't pick up the return 4-byte value and uses the previous o0 value

emteere commented 1 month ago

Are these assigned return and param types, or is the decompiler recovering the types on the fly? I'm assuming you mean the decompiler is computing them on the fly and you haven't committed the param/return from the decompiler or assigned the types manually.

64 or 32 bit sparc?

Do you have any example functions you could share? Either bytes or copy/paste of listing?

mumbel commented 1 week ago

sorry @emteere missed the reply. pcodetest is showing it looks like in 11.2.1, built with sparc-suse-linux-gcc (14). i just did the basic analysis and main (and others) were showing return CONCAT(param_2,param_1) for undefined8

.txt is .out

SPARC_GCC_O0_pcodtest.txt