diff --git a/rocclr/compiler/lib/loaders/elf/elf.hpp b/rocclr/compiler/lib/loaders/elf/elf.hpp index 943bf55bc7..7d042973ef 100644 --- a/rocclr/compiler/lib/loaders/elf/elf.hpp +++ b/rocclr/compiler/lib/loaders/elf/elf.hpp @@ -334,7 +334,8 @@ public: const char* getErrMsg() { return _err.getOclElfError(); } unsigned char getELFClass() { return _eclass; } - bool isHsaCo() const { return (elf64_getehdr(_e)->e_machine == EM_AMDGPU); } + bool isHsaCo() const { return (_eclass == ELFCLASS32) ? + (elf32_getehdr(_e)->e_machine == EM_AMDGPU) : (elf64_getehdr(_e)->e_machine == EM_AMDGPU); } private: