diff --git a/runtime/hsa-runtime/loader/executable.cpp b/runtime/hsa-runtime/loader/executable.cpp index dc53520963..20619ba332 100644 --- a/runtime/hsa-runtime/loader/executable.cpp +++ b/runtime/hsa-runtime/loader/executable.cpp @@ -62,7 +62,15 @@ using namespace amd::hsa; using namespace amd::hsa::common; -static void __attribute__((noinline, optimize(0))) _loader_debug_state() {}; +#ifdef __GNUC__ +#define NONOPTIMIZE __attribute__((noinline, optimize(0))) +#elif defined __clang__ +#define NONOPTIMIZE __attribute__((noinline, optnone)) +#else +#define NONOPTIMIZE __attribute__((noinline, optimize(0))) +#endif + +NONOPTIMIZE static void _loader_debug_state() {}; r_debug _amdgpu_r_debug __attribute__((visibility("default"))) = {1, nullptr, reinterpret_cast(&_loader_debug_state),