[PATCH] D53040: [libFuzzer] Generalize the code for getting the previous offset for different architectures

Max Moroz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 9 14:50:17 PDT 2018


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

I should admit that I'm not familiar with ARM offsets, but since the change fixes the test, LGTM.



================
Comment at: compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:202
+  // For A32 mode we return (pc-4) because all instructions are 32 bit long.
+  return (PC - 3) & (~1);
+#elif defined(__powerpc__) || defined(__powerpc64__) || defined(__aarch64__)
----------------
Are you sure you need `-3` here, not `-2`? I'm definitely not an expert here, so it's more like a sanity check question :)

```
>>> hex((0x122 - 3) & (~1))
'0x11e'
>>> hex((0x122 - 2) & (~1))
'0x120'
```



================
Comment at: compiler-rt/lib/fuzzer/FuzzerTracePC.cpp:213
+
+inline ALWAYS_INLINE uintptr_t GetNextInstructionPc(uintptr_t PC) {
+#if defined(__mips__)
----------------
some comment here might be useful too


https://reviews.llvm.org/D53040





More information about the llvm-commits mailing list