diff --git a/hipamd/vdi/hip_rtc.cpp b/hipamd/vdi/hip_rtc.cpp index 3ccab6f44c..9897b98b7f 100644 --- a/hipamd/vdi/hip_rtc.cpp +++ b/hipamd/vdi/hip_rtc.cpp @@ -105,9 +105,9 @@ char* demangle(const char* loweredName) { if (!loweredName) { return nullptr; } -#if HIPRTC_USE_CXXABI || __linux__ +#if __linux__ int status = 0; - char* demangledName = abi::__cxa_demangle(loweredName, nullptr, nullptr, &status); + char* demangledName = DEMANGLE(loweredName, nullptr, nullptr, &status); if (status != 0) { return nullptr; } @@ -122,7 +122,7 @@ char* demangle(const char* loweredName) { } #else #error "Only Linux and Windows are supported" -#endif // HIPRTC_USE_CXXABI || __linux__ +#endif // __linux__ return demangledName; } diff --git a/hipamd/vdi/hiprtc_internal.hpp b/hipamd/vdi/hiprtc_internal.hpp index e95a28c08f..4e533c9716 100644 --- a/hipamd/vdi/hiprtc_internal.hpp +++ b/hipamd/vdi/hiprtc_internal.hpp @@ -23,17 +23,28 @@ #include "hip_internal.hpp" -#if HIPRTC_USE_CXXABI || __linux__ -#include +#if __linux__ #include +#if HIPRTC_USE_CXXABI +#include + +#define DEMANGLE abi::__cxa_demangle + +#else +extern "C" char * __cxa_demangle(const char *mangled_name, char *output_buffer, + size_t *length, int *status); + +#define DEMANGLE __cxa_demangle +#endif //HIPRTC_USE_CXXABI + #elif defined(_WIN32) #include #include #define UNDECORATED_SIZE 4096 -#endif // HIPRTC_USE_CXXABI || __linux__ +#endif // __linux__ // This macro should be called at the beginning of every HIP RTC API. #define HIPRTC_INIT_API(...) \