[compiler-rt] [asan][windows] use __builtin_function_address to avoid problematic codegen in weak function registration (PR #108327)

via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 11 21:16:54 PDT 2024


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 828783177f71d95522763fba92ef1e42dc6101c7 0df07f38de2cc97940cc99a20b40ff7581a36b81 --extensions h -- compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h
``````````

</details>

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

``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h b/compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h
index 80c56f8f3c..278450d68a 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_win_thunk_interception.h
@@ -65,7 +65,7 @@ void initialize_thunks(const sanitizer_thunk *begin,
 #  define REGISTER_WEAK_FUNCTION_ADDRESS(fn) __builtin_function_start(fn)
 #else
 #  define REGISTER_WEAK_OPTNONE
-#  define REGISTER_WEAK_FUNCTION_ADDRESS(fn) & fn
+#  define REGISTER_WEAK_FUNCTION_ADDRESS(fn) &fn
 #endif
 
 #define REGISTER_WEAK_FUNCTION(local_function)                          \
@@ -73,7 +73,9 @@ void initialize_thunks(const sanitizer_thunk *begin,
   extern "C" void WEAK_EXPORT_NAME(local_function)();                   \
   WIN_WEAK_IMPORT_DEF(local_function)                                   \
   REGISTER_WEAK_OPTNONE static int register_weak_##local_function() {   \
-    if ((uintptr_t) REGISTER_WEAK_FUNCTION_ADDRESS(local_function) != (uintptr_t) REGISTER_WEAK_FUNCTION_ADDRESS(WEAK_EXPORT_NAME(local_function))) {                             \
+    if ((uintptr_t)REGISTER_WEAK_FUNCTION_ADDRESS(local_function) !=    \
+        (uintptr_t)REGISTER_WEAK_FUNCTION_ADDRESS(                      \
+            WEAK_EXPORT_NAME(local_function))) {                        \
       return __sanitizer::register_weak(                                \
           SANITIZER_STRINGIFY(WEAK_EXPORT_NAME(local_function)),        \
           reinterpret_cast<__sanitizer::uptr>(local_function));         \

``````````

</details>


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


More information about the llvm-commits mailing list