[OpenMP] Use the libc malloc for AMDGPU if available (#151241)

Summary:
This patch enables the OpenMP runtime to use the general-purpose
`malloc` interface in `libc` if the user built OpenMP with it enabled.
All this requires is keeping `malloc` as an external function so it will
be resolved later by the linker.
This commit is contained in:
Joseph Huber
2025-08-01 20:41:06 -05:00
committed by GitHub
parent 962ee7a568
commit 8934a6e13b

View File

@@ -50,7 +50,7 @@ namespace {
///
///{
extern "C" {
#ifdef __AMDGPU__
#if defined(__AMDGPU__) && !defined(OMPTARGET_HAS_LIBC)
[[gnu::weak]] void *malloc(size_t Size) { return allocator::alloc(Size); }
[[gnu::weak]] void free(void *Ptr) { allocator::free(Ptr); }