From aa04b964cf093d6db6075942335bc264563c28b6 Mon Sep 17 00:00:00 2001 From: Saleel Kudchadker Date: Tue, 10 Mar 2020 00:02:10 -0700 Subject: [PATCH] Fix P4 linux make builds Change-Id: I6cc4e69a914389b53bc3b52535eb6faf24897a09 --- vdi/hip_rtc.cpp | 6 +++--- vdi/hiprtc_internal.hpp | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/vdi/hip_rtc.cpp b/vdi/hip_rtc.cpp index 3ccab6f44c..9897b98b7f 100644 --- a/vdi/hip_rtc.cpp +++ b/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/vdi/hiprtc_internal.hpp b/vdi/hiprtc_internal.hpp index e95a28c08f..4e533c9716 100644 --- a/vdi/hiprtc_internal.hpp +++ b/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(...) \