[compiler-rt] [compiler-rt][asan] Add AMDGPU ASan support via HSA API interceptors. (PR #192240)

Amit Kumar Pandey via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 17 02:53:15 PDT 2026


================
@@ -56,6 +56,13 @@ void ReportNewDeleteTypeMismatch(uptr addr, uptr delete_size,
 void ReportFreeSizeMismatch(uptr addr, uptr delete_size, uptr delete_alignment,
                             BufferedStackTrace* free_stack);
 void ReportDoubleFree(uptr addr, BufferedStackTrace *free_stack);
+#if SANITIZER_AMDHSA
----------------
ampandey-1995 wrote:

>General question, why do these need to be guarded with SANITIZER_AMDHSA? 

`SANITIZER_AMDHSA`  is required  to avoid building on platforms (windows, android) where neither HSA types/ API is supported  nor dlopen (dlopen of hsa_amd_* api calls in `sanitizer_allocator_amdgpu.cpp` to initialize the function pointers). It is initialized for Linux, non-Android platforms after commit d49a4c2.

>  I am curious what our discriminator is here, we either force the uesr to pass ON for this, or do it by default and add a few KB to a static library on Linux. Static linking semantics should mean that we don't link anything that's not actually used, as long as these are properly separated (part of why I said that everything needs to be in its own file more or less).

There is no hard discriminator, only issue is HSA Api + dlopen(Windows don't support it) not supported on some platforms, a guard is required intentionally in common generic platform supported (linux) builds only.  Fixed in commit d49a4c2.

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


More information about the llvm-commits mailing list