From f2e5ef5617060ae832582a6bbdcaa139cab25f07 Mon Sep 17 00:00:00 2001 From: Jeremy Newton Date: Thu, 17 Feb 2022 09:05:56 -0500 Subject: [PATCH] SWDEV-323669 - Fix linux arch detection CMake assumes we're bundling on x86, but for GNU compatible compilers, we should rely on the compiler target to set the build arch. For non-gnu compilers, just fall back to assuming x86 (no change). Signed-off-by: Jeremy Newton Change-Id: Iee9794e6f7c3973c781ddaf740ded77f34712c4f --- rocclr/cmake/ROCclr.cmake | 1 - rocclr/include/top.hpp | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/rocclr/cmake/ROCclr.cmake b/rocclr/cmake/ROCclr.cmake index 2f6ff8c155..e4d0cdc182 100644 --- a/rocclr/cmake/ROCclr.cmake +++ b/rocclr/cmake/ROCclr.cmake @@ -100,7 +100,6 @@ if(NOT CMAKE_CL_64) endif() target_compile_definitions(rocclr PUBLIC - ATI_ARCH_X86 LITTLEENDIAN_CPU WITH_LIQUID_FLASH=0 ${AMD_OPENCL_DEFS}) diff --git a/rocclr/include/top.hpp b/rocclr/include/top.hpp index f51db7d1e3..70273510c9 100644 --- a/rocclr/include/top.hpp +++ b/rocclr/include/top.hpp @@ -21,6 +21,16 @@ #ifndef TOP_HPP_ #define TOP_HPP_ +#if defined(__GNUC__) +#if defined(__arm__) || defined(__aarch64__) +#define ATI_ARCH_ARM +#elif defined(__x86__) || defined(__x86_64__) +#define ATI_ARCH_X86 +#endif +#else /*!__GNUC__*/ +#define ATI_ARCH_X86 +#endif /*!__GNUC__*/ + #if defined(ATI_ARCH_ARM) #define __EXPORTED_HEADERS__ 1 #endif /*ATI_ARCH_ARM*/