NationalSecurityAgency / ghidra

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

Wrong ABI for structs containing doubles #4658

Open jrmuizel opened 2 years ago

jrmuizel commented 2 years ago

Describe the bug

struct point {
        double x;
        double y;
};

struct point inc(struct point p) {
        p.x += 1;
        p.y += 1;
        return p;
}

is decompiled to

point inc(point p)

{
  undefined8 in_RAX;
  undefined8 in_RDX;

  return (point)CONCAT88(in_RDX,in_RAX);
}

Ghidra thinks point is passed on the stack but the ABI says that it is passed in XMM registers.

Environment (please complete the following information):

jrmuizel commented 2 years ago

Here's the object file this happens for test.zip

ghidracadabra commented 2 years ago

This is a known issue which is on the queue of things to fix. See the comments in #4195

At the moment you can enable "Custom Storage" for the relevant functions and set storage locations manually.