[libcxx-commits] [PATCH] D59694: [PPC64][libunwind] Fix r2 not properly restored

Saleem Abdulrasool via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Mar 22 14:19:32 PDT 2019


compnerd accepted this revision.
compnerd added a comment.
This revision is now accepted and ready to land.

LG with the minor changes requested.



================
Comment at: libunwind/src/DwarfInstructions.hpp:244
+              == 0xe8410028 // ld r2,40(r1)
+#endif
+      ) {
----------------
Could you please expand the comment above to explain that we are checking explicit displacements in the encoding because of parameter spill area (32-byte in ELF ABIv2, so offset is 24, 48-byte in ELF ABIv1, so offset is 40 bytes).


================
Comment at: libunwind/src/DwarfInstructions.hpp:253
+        newRegisters.setRegister(UNW_PPC64_R2, r2);
+      }
+#endif
----------------
I think it would be nicer if you hoisted the constants out:

```
#if _CALL_ELF-0 == 2
#define PPC64_R2_LOAD_INST_ENCODING 0xe8410018
#define PPC64_R2_OFFSET 24
#else
#define PPC64_R2_LOAD_INST_ENCODING 0xe8410028
#define PPC64_R2_OFFSET 40
#endif

...
  pint_t r2 = addressSpace.get64(sp + PPC64_R2_OFFSET);
...
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D59694/new/

https://reviews.llvm.org/D59694





More information about the libcxx-commits mailing list