[compiler-rt] [ASan][Windows] Fix rip-relative instruction replacement (PR #68432)

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 6 10:21:13 PDT 2023


github-actions[bot] wrote:


<!--LLVM CODE FORMAT COMMENT: {clang-format}-->

:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff e9fa18878cdfb242812ea108a87f83dcb224cffc 67dfb84ce4cd5dca06bb47cd640bc460dbe0e574 -- compiler-rt/lib/interception/interception_win.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/compiler-rt/lib/interception/interception_win.cpp b/compiler-rt/lib/interception/interception_win.cpp
index 4f2a51e1a..d6bc38c58 100644
--- a/compiler-rt/lib/interception/interception_win.cpp
+++ b/compiler-rt/lib/interception/interception_win.cpp
@@ -736,11 +736,11 @@ static bool CopyInstructions(uptr to, uptr from, size_t size) {
       s64 relocated_offset = *(s32 *)(to + cursor + rel_offset) - delta;
       if (-0x8000'0000ll > relocated_offset || relocated_offset > 0x7FFF'FFFFll)
         return false;
-#else
+#  else
       // on 32-bit, the relative offset will always be correct
       s32 delta = to - from;
       s32 relocated_offset = *(s32 *)(to + cursor + rel_offset) - delta;
-#endif
+#  endif
       *(s32 *)(to + cursor + rel_offset) = relocated_offset;
     }
     cursor += instruction_size;

``````````

</details>


https://github.com/llvm/llvm-project/pull/68432


More information about the llvm-commits mailing list