Replace private libelf with elfio
Change-Id: I4c630d78f7bf23dda85ec8480bb2790864405657
This commit is contained in:
+21
-21
@@ -554,7 +554,7 @@ bool ClBinary::setElfTarget() {
|
||||
static const uint32_t Target = 21;
|
||||
assert(((0xFFFF8000 & Target) == 0) && "ASIC target ID >= 2^15");
|
||||
uint16_t elf_target = static_cast<uint16_t>(0x7FFF & Target);
|
||||
return elfOut()->setTarget(elf_target, amd::OclElf::CAL_PLATFORM);
|
||||
return elfOut()->setTarget(elf_target, amd::Elf::CAL_PLATFORM);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -630,7 +630,7 @@ void ClBinary::init(amd::option::Options* optionsObj, bool amdilRequired) {
|
||||
}
|
||||
}
|
||||
|
||||
bool ClBinary::isRecompilable(std::string& llvmBinary, amd::OclElf::oclElfPlatform thePlatform) {
|
||||
bool ClBinary::isRecompilable(std::string& llvmBinary, amd::Elf::ElfPlatform thePlatform) {
|
||||
/* It is recompilable if there is llvmir that was generated for
|
||||
the same platform (CPU or GPU) and with the same bitness.
|
||||
|
||||
@@ -643,16 +643,16 @@ bool ClBinary::isRecompilable(std::string& llvmBinary, amd::OclElf::oclElfPlatfo
|
||||
}
|
||||
|
||||
uint16_t elf_target;
|
||||
amd::OclElf::oclElfPlatform platform;
|
||||
amd::Elf::ElfPlatform platform;
|
||||
if (elfIn()->getTarget(elf_target, platform)) {
|
||||
if (platform == thePlatform) {
|
||||
return true;
|
||||
}
|
||||
if ((platform == amd::OclElf::COMPLIB_PLATFORM) &&
|
||||
(((thePlatform == amd::OclElf::CAL_PLATFORM) &&
|
||||
if ((platform == amd::Elf::COMPLIB_PLATFORM) &&
|
||||
(((thePlatform == amd::Elf::CAL_PLATFORM) &&
|
||||
((elf_target == (uint16_t)EM_AMDIL) || (elf_target == (uint16_t)EM_HSAIL) ||
|
||||
(elf_target == (uint16_t)EM_HSAIL_64))) ||
|
||||
((thePlatform == amd::OclElf::CPU_PLATFORM) &&
|
||||
((thePlatform == amd::Elf::CPU_PLATFORM) &&
|
||||
((elf_target == (uint16_t)EM_386) || (elf_target == (uint16_t)EM_X86_64))))) {
|
||||
return true;
|
||||
}
|
||||
@@ -704,7 +704,7 @@ bool ClBinary::createElfBinary(bool doencrypt, Program::type_t type) {
|
||||
buildVerInfo.append("OpenCL 1.1" AMD_PLATFORM_INFO);
|
||||
}
|
||||
|
||||
elfOut_->addSection(amd::OclElf::COMMENT, buildVerInfo.data(), buildVerInfo.size());
|
||||
elfOut_->addSection(amd::Elf::COMMENT, buildVerInfo.data(), buildVerInfo.size());
|
||||
switch (type) {
|
||||
case Program::TYPE_NONE: {
|
||||
elfOut_->setType(ET_NONE);
|
||||
@@ -815,8 +815,8 @@ bool ClBinary::setElfIn() {
|
||||
if (binary_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
elfIn_ = new amd::OclElf(ELFCLASSNONE, binary_, size_, nullptr, ELF_C_READ);
|
||||
if ((elfIn_ == nullptr) || elfIn_->hasError()) {
|
||||
elfIn_ = new amd::Elf(ELFCLASSNONE, binary_, size_, nullptr, amd::Elf::ELF_C_READ);
|
||||
if ((elfIn_ == nullptr) || !elfIn_->isSuccessful()) {
|
||||
if (elfIn_) {
|
||||
delete elfIn_;
|
||||
elfIn_ = nullptr;
|
||||
@@ -836,8 +836,8 @@ void ClBinary::resetElfIn() {
|
||||
}
|
||||
|
||||
bool ClBinary::setElfOut(unsigned char eclass, const char* outFile) {
|
||||
elfOut_ = new amd::OclElf(eclass, nullptr, 0, outFile, ELF_C_WRITE);
|
||||
if ((elfOut_ == nullptr) || elfOut_->hasError()) {
|
||||
elfOut_ = new amd::Elf(eclass, nullptr, 0, outFile, amd::Elf::ELF_C_WRITE);
|
||||
if ((elfOut_ == nullptr) || !elfOut_->isSuccessful()) {
|
||||
if (elfOut_) {
|
||||
delete elfOut_;
|
||||
elfOut_ = nullptr;
|
||||
@@ -857,12 +857,12 @@ void ClBinary::resetElfOut() {
|
||||
}
|
||||
|
||||
bool ClBinary::loadLlvmBinary(std::string& llvmBinary,
|
||||
amd::OclElf::oclElfSections& elfSectionType) const {
|
||||
amd::Elf::ElfSections& elfSectionType) const {
|
||||
// Check if current binary already has LLVMIR
|
||||
char* section = nullptr;
|
||||
size_t sz = 0;
|
||||
const amd::OclElf::oclElfSections SectionTypes[] = {amd::OclElf::LLVMIR, amd::OclElf::SPIR,
|
||||
amd::OclElf::SPIRV};
|
||||
const amd::Elf::ElfSections SectionTypes[] = {amd::Elf::LLVMIR, amd::Elf::SPIR,
|
||||
amd::Elf::SPIRV};
|
||||
|
||||
for (int i = 0; i < 3; ++i) {
|
||||
if (elfIn_->getSection(SectionTypes[i], §ion, &sz) && section && sz > 0) {
|
||||
@@ -880,7 +880,7 @@ bool ClBinary::loadCompileOptions(std::string& compileOptions) const {
|
||||
char* options = nullptr;
|
||||
size_t sz;
|
||||
compileOptions.clear();
|
||||
if (elfIn_->getSymbol(amd::OclElf::COMMENT, getBIFSymbol(symOpenclCompilerOptions).c_str(),
|
||||
if (elfIn_->getSymbol(amd::Elf::COMMENT, getBIFSymbol(symOpenclCompilerOptions).c_str(),
|
||||
&options, &sz)) {
|
||||
if (sz > 0) {
|
||||
compileOptions.append(options, sz);
|
||||
@@ -894,7 +894,7 @@ bool ClBinary::loadLinkOptions(std::string& linkOptions) const {
|
||||
char* options = nullptr;
|
||||
size_t sz;
|
||||
linkOptions.clear();
|
||||
if (elfIn_->getSymbol(amd::OclElf::COMMENT, getBIFSymbol(symOpenclLinkerOptions).c_str(),
|
||||
if (elfIn_->getSymbol(amd::Elf::COMMENT, getBIFSymbol(symOpenclLinkerOptions).c_str(),
|
||||
&options, &sz)) {
|
||||
if (sz > 0) {
|
||||
linkOptions.append(options, sz);
|
||||
@@ -905,21 +905,21 @@ bool ClBinary::loadLinkOptions(std::string& linkOptions) const {
|
||||
}
|
||||
|
||||
void ClBinary::storeCompileOptions(const std::string& compileOptions) {
|
||||
elfOut()->addSymbol(amd::OclElf::COMMENT, getBIFSymbol(symOpenclCompilerOptions).c_str(),
|
||||
elfOut()->addSymbol(amd::Elf::COMMENT, getBIFSymbol(symOpenclCompilerOptions).c_str(),
|
||||
compileOptions.c_str(), compileOptions.length());
|
||||
}
|
||||
|
||||
void ClBinary::storeLinkOptions(const std::string& linkOptions) {
|
||||
elfOut()->addSymbol(amd::OclElf::COMMENT, getBIFSymbol(symOpenclLinkerOptions).c_str(),
|
||||
elfOut()->addSymbol(amd::Elf::COMMENT, getBIFSymbol(symOpenclLinkerOptions).c_str(),
|
||||
linkOptions.c_str(), linkOptions.length());
|
||||
}
|
||||
|
||||
bool ClBinary::isSPIR() const {
|
||||
char* section = nullptr;
|
||||
size_t sz = 0;
|
||||
if (elfIn_->getSection(amd::OclElf::LLVMIR, §ion, &sz) && section && sz > 0) return false;
|
||||
if (elfIn_->getSection(amd::Elf::LLVMIR, §ion, &sz) && section && sz > 0) return false;
|
||||
|
||||
if (elfIn_->getSection(amd::OclElf::SPIR, §ion, &sz) && section && sz > 0) return true;
|
||||
if (elfIn_->getSection(amd::Elf::SPIR, §ion, &sz) && section && sz > 0) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -928,7 +928,7 @@ bool ClBinary::isSPIRV() const {
|
||||
char* section = nullptr;
|
||||
size_t sz = 0;
|
||||
|
||||
if (elfIn_->getSection(amd::OclElf::SPIRV, §ion, &sz) && section && sz > 0) {
|
||||
if (elfIn_->getSection(amd::Elf::SPIRV, §ion, &sz) && section && sz > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -887,11 +887,11 @@ class ClBinary : public amd::HeapObject {
|
||||
virtual bool setElfTarget();
|
||||
|
||||
// class used in for loading images in new format
|
||||
amd::OclElf* elfIn() { return elfIn_; }
|
||||
amd::Elf* elfIn() { return elfIn_; }
|
||||
|
||||
// classes used storing and loading images in new format
|
||||
amd::OclElf* elfOut() { return elfOut_; }
|
||||
void elfOut(amd::OclElf* v) { elfOut_ = v; }
|
||||
amd::Elf* elfOut() { return elfOut_; }
|
||||
void elfOut(amd::Elf* v) { elfOut_ = v; }
|
||||
|
||||
//! Create and save ELF binary image
|
||||
bool createElfBinary(bool doencrypt, Program::type_t type);
|
||||
@@ -908,7 +908,7 @@ class ClBinary : public amd::HeapObject {
|
||||
//! Loads llvmir binary from OCL binary file
|
||||
bool loadLlvmBinary(
|
||||
std::string& llvmBinary, //!< LLVMIR binary code
|
||||
amd::OclElf::oclElfSections& elfSectionType //!< LLVMIR binary is in SPIR format
|
||||
amd::Elf::ElfSections& elfSectionType //!< LLVMIR binary is in SPIR format
|
||||
) const;
|
||||
|
||||
//! Loads compile options from OCL binary file
|
||||
@@ -928,7 +928,7 @@ class ClBinary : public amd::HeapObject {
|
||||
);
|
||||
|
||||
//! Check if the binary is recompilable
|
||||
bool isRecompilable(std::string& llvmBinary, amd::OclElf::oclElfPlatform thePlatform);
|
||||
bool isRecompilable(std::string& llvmBinary, amd::Elf::ElfPlatform thePlatform);
|
||||
|
||||
void saveOrigBinary(const char* origBinary, size_t origSize) {
|
||||
origBinary_ = origBinary;
|
||||
@@ -1024,8 +1024,8 @@ class ClBinary : public amd::HeapObject {
|
||||
int encryptCode_; //!< Encryption Code for input binary (0 for not encrypted)
|
||||
|
||||
protected:
|
||||
amd::OclElf* elfIn_; //!< ELF object for input ELF binary
|
||||
amd::OclElf* elfOut_; //!< ELF object for output ELF binary
|
||||
amd::Elf* elfIn_; //!< ELF object for input ELF binary
|
||||
amd::Elf* elfOut_; //!< ELF object for output ELF binary
|
||||
BinaryImageFormat format_; //!< which binary image format to use
|
||||
};
|
||||
|
||||
|
||||
@@ -74,7 +74,7 @@ Program::Program(amd::Device& device, amd::Program& owner)
|
||||
flags_(0),
|
||||
clBinary_(nullptr),
|
||||
llvmBinary_(),
|
||||
elfSectionType_(amd::OclElf::LLVMIR),
|
||||
elfSectionType_(amd::Elf::LLVMIR),
|
||||
compileOptions_(),
|
||||
linkOptions_(),
|
||||
binaryElf_(nullptr),
|
||||
@@ -579,7 +579,7 @@ bool Program::compileImplLC(const std::string& sourceCode,
|
||||
const char* xLang = options->oVariables->XLang;
|
||||
if (xLang != nullptr) {
|
||||
if (strcmp(xLang,"asm") == 0) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::SOURCE, sourceCode.data(), sourceCode.size());
|
||||
clBinary()->elfOut()->addSection(amd::Elf::SOURCE, sourceCode.data(), sourceCode.size());
|
||||
return true;
|
||||
} else if (!strcmp(xLang,"cl")) {
|
||||
buildLog_ += "Unsupported language: \"" + std::string(xLang) + "\".\n";
|
||||
@@ -684,14 +684,13 @@ bool Program::compileImplLC(const std::string& sourceCode,
|
||||
// Destroy the original LLVM binary, received after compilation
|
||||
delete[] binaryData;
|
||||
|
||||
elfSectionType_ = amd::OclElf::LLVMIR;
|
||||
elfSectionType_ = amd::Elf::LLVMIR;
|
||||
|
||||
if (clBinary()->saveSOURCE()) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::SOURCE, sourceCode.data(), sourceCode.size());
|
||||
clBinary()->elfOut()->addSection(amd::Elf::SOURCE, sourceCode.data(), sourceCode.size());
|
||||
}
|
||||
if (clBinary()->saveLLVMIR()) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(),
|
||||
false);
|
||||
clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size());
|
||||
// store the original compile options
|
||||
clBinary()->storeCompileOptions(compileOptions_);
|
||||
}
|
||||
@@ -857,7 +856,7 @@ bool Program::linkImplLC(const std::vector<Program*>& inputPrograms,
|
||||
}
|
||||
|
||||
if (result) {
|
||||
result = (program->elfSectionType_ == amd::OclElf::LLVMIR);
|
||||
result = (program->elfSectionType_ == amd::Elf::LLVMIR);
|
||||
}
|
||||
|
||||
if (result) {
|
||||
@@ -908,11 +907,10 @@ bool Program::linkImplLC(const std::vector<Program*>& inputPrograms,
|
||||
// Destroy llvm binary, received after compilation
|
||||
delete[] binaryData;
|
||||
|
||||
elfSectionType_ = amd::OclElf::LLVMIR;
|
||||
elfSectionType_ = amd::Elf::LLVMIR;
|
||||
|
||||
if (clBinary()->saveLLVMIR()) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(),
|
||||
false);
|
||||
clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size());
|
||||
// store the original link options
|
||||
clBinary()->storeLinkOptions(linkOptions_);
|
||||
// store the original compile options
|
||||
@@ -1075,7 +1073,7 @@ bool Program::linkImplLC(amd::option::Options* options) {
|
||||
case ACL_TYPE_ASM_TEXT: {
|
||||
char* section;
|
||||
size_t sz;
|
||||
clBinary()->elfOut()->getSection(amd::OclElf::SOURCE, §ion, &sz);
|
||||
clBinary()->elfOut()->getSection(amd::Elf::SOURCE, §ion, &sz);
|
||||
|
||||
if (addCodeObjData(section, sz, AMD_COMGR_DATA_KIND_BC, "Assembly Text",
|
||||
&inputs) != AMD_COMGR_STATUS_SUCCESS) {
|
||||
@@ -2382,33 +2380,32 @@ bool Program::FindGlobalVarSize(void* binary, size_t binSize) {
|
||||
size_t dynamicSize = 0;
|
||||
size_t progvarsWriteSize = 0;
|
||||
|
||||
// Begin the Elf image from memory
|
||||
Elf* e = elf_memory((char*)binary, binSize, nullptr);
|
||||
if (elf_kind(e) != ELF_K_ELF) {
|
||||
buildLog_ += "Error while reading the ELF program binary\n";
|
||||
amd::Elf elfIn(ELFCLASSNONE, reinterpret_cast<const char *>(binary), binSize,
|
||||
nullptr, amd::Elf::ELF_C_READ);
|
||||
|
||||
if (!elfIn.isSuccessful()) {
|
||||
buildLog_ += "Creating input amd::Elf object failed\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
size_t numpHdrs;
|
||||
if (elf_getphdrnum(e, &numpHdrs) != 0) {
|
||||
buildLog_ += "Error while reading the ELF program binary\n";
|
||||
return false;
|
||||
}
|
||||
auto numpHdrs = elfIn.getSegmentNum();
|
||||
bool metadata_found = false;
|
||||
for (size_t i = 0; i < numpHdrs; ++i) {
|
||||
GElf_Phdr pHdr;
|
||||
if (gelf_getphdr(e, i, &pHdr) != &pHdr) {
|
||||
for (unsigned int i = 0; i < numpHdrs; ++i) {
|
||||
amd::ELFIO::segment* seg = nullptr;
|
||||
if (!elfIn.getSegment(i, seg)) {
|
||||
continue;
|
||||
}
|
||||
// Look for the runtime metadata note
|
||||
if (pHdr.p_type == PT_NOTE && pHdr.p_align >= sizeof(int)) {
|
||||
if (seg->get_type() == PT_NOTE && seg->get_align() >= sizeof(int)) {
|
||||
// Iterate over the notes in this segment
|
||||
address ptr = (address)binary + pHdr.p_offset;
|
||||
address segmentEnd = ptr + pHdr.p_filesz;
|
||||
address ptr = (address)binary + seg->get_offset();
|
||||
address segmentEnd = ptr + seg->get_file_size();
|
||||
|
||||
while (ptr < segmentEnd) {
|
||||
Elf_Note* note = (Elf_Note*)ptr;
|
||||
address name = (address)¬e[1];
|
||||
// see spec of note:
|
||||
// https://docs.oracle.com/cd/E19683-01/816-1386/6m7qcoblj/index.html#chapter6-18048
|
||||
auto note = reinterpret_cast<amd::Elf::ElfNote*>(ptr);
|
||||
address name = reinterpret_cast<address>(¬e[1]);
|
||||
address desc = name + amd::alignUp(note->n_namesz, sizeof(int));
|
||||
|
||||
if (note->n_type == 7 ||
|
||||
@@ -2447,21 +2444,19 @@ bool Program::FindGlobalVarSize(void* binary, size_t binSize) {
|
||||
}
|
||||
}
|
||||
// Accumulate the size of R & !X loadable segments
|
||||
else if (pHdr.p_type == PT_LOAD && !(pHdr.p_flags & PF_X)) {
|
||||
if (pHdr.p_flags & PF_R) {
|
||||
progvarsTotalSize += pHdr.p_memsz;
|
||||
else if (seg->get_type() == PT_LOAD && !(seg->get_flags() & PF_X)) {
|
||||
if (seg->get_flags() & PF_R) {
|
||||
progvarsTotalSize += seg->get_memory_size();
|
||||
}
|
||||
if (pHdr.p_flags & PF_W) {
|
||||
progvarsWriteSize += pHdr.p_memsz;
|
||||
if (seg->get_flags() & PF_W) {
|
||||
progvarsWriteSize += seg->get_memory_size();
|
||||
}
|
||||
}
|
||||
else if (pHdr.p_type == PT_DYNAMIC) {
|
||||
dynamicSize += pHdr.p_memsz;
|
||||
else if (seg->get_type() == PT_DYNAMIC) {
|
||||
dynamicSize += seg->get_memory_size();
|
||||
}
|
||||
}
|
||||
|
||||
elf_end(e);
|
||||
|
||||
if (!metadata_found) {
|
||||
buildLog_ += "Error: runtime metadata section not present in ELF program binary\n";
|
||||
return false;
|
||||
|
||||
@@ -103,7 +103,7 @@ class Program : public amd::HeapObject {
|
||||
|
||||
ClBinary* clBinary_; //!< The CL program binary file
|
||||
std::string llvmBinary_; //!< LLVM IR binary code
|
||||
amd::OclElf::oclElfSections elfSectionType_; //!< LLVM IR binary code is in SPIR format
|
||||
amd::Elf::ElfSections elfSectionType_; //!< LLVM IR binary code is in SPIR format
|
||||
std::string compileOptions_; //!< compile/build options.
|
||||
std::string linkOptions_; //!< link options.
|
||||
//!< the option arg passed in to clCompileProgram(), clLinkProgram(),
|
||||
@@ -324,7 +324,7 @@ class Program : public amd::HeapObject {
|
||||
//! Finds the total size of all global variables in the program
|
||||
bool FindGlobalVarSize(void* binary, size_t binSize);
|
||||
|
||||
bool isElf(const char* bin) const { return amd::isElfMagic(bin); }
|
||||
bool isElf(const char* bin) const { return amd::Elf::isElfMagic(bin); }
|
||||
|
||||
virtual bool defineGlobalVar(const char* name, void* dptr) {
|
||||
ShouldNotReachHere();
|
||||
|
||||
@@ -38,7 +38,7 @@ typedef struct {
|
||||
SymInfo[NDX_HEADER] : SymbolInfo for kernel header
|
||||
SymInfo[NDX_AMDIL] : SymbolInfo for kernel's amdil
|
||||
*/
|
||||
amd::OclElf::SymbolInfo SymInfo[NDX_LAST];
|
||||
amd::Elf::SymbolInfo SymInfo[NDX_LAST];
|
||||
} ElfSymbol_t;
|
||||
}
|
||||
|
||||
@@ -58,12 +58,12 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
// Target should be 15 bit maximum. Should check this somewhere.
|
||||
uint32_t target = static_cast<uint32_t>(dev().calTarget());
|
||||
uint16_t elf_target;
|
||||
amd::OclElf::oclElfPlatform platform;
|
||||
amd::Elf::ElfPlatform platform;
|
||||
if (!elfIn()->getTarget(elf_target, platform)) {
|
||||
LogError("The OCL binary image loading failed: incorrect format");
|
||||
return false;
|
||||
}
|
||||
if (platform == amd::OclElf::COMPLIB_PLATFORM) {
|
||||
if (platform == amd::Elf::COMPLIB_PLATFORM) {
|
||||
// BIF 3.0
|
||||
uint32_t flag;
|
||||
aclTargetInfo tgtInfo = aclGetTargetInfo("amdil", dev().hwInfo()->targetName_, NULL);
|
||||
@@ -76,7 +76,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (((platform != amd::OclElf::CAL_PLATFORM) || ((uint32_t)target != elf_target))) {
|
||||
if (((platform != amd::Elf::CAL_PLATFORM) || ((uint32_t)target != elf_target))) {
|
||||
LogError("The OCL binary image loading failed: different target");
|
||||
return false;
|
||||
}
|
||||
@@ -109,10 +109,10 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
*/
|
||||
bool usedebugil = program.getCompilerOptions()->oVariables->UseDebugIL;
|
||||
|
||||
for (amd::Sym_Handle sym = elfIn()->nextSymbol(NULL); sym != NULL;
|
||||
sym = elfIn()->nextSymbol(sym)) {
|
||||
amd::OclElf::SymbolInfo symInfo;
|
||||
if (!elfIn()->getSymbolInfo(sym, &symInfo)) {
|
||||
int num = elfIn()->getSymbolNum();
|
||||
for (int index = 0; index < num; index++) {
|
||||
amd::Elf::SymbolInfo symInfo;
|
||||
if (!elfIn()->getSymbolInfo(index, &symInfo)) {
|
||||
LogError("LoadKernelFromElf: getSymbolInfo() fails");
|
||||
return false;
|
||||
}
|
||||
@@ -131,7 +131,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
FName.append("_kernel"); // make the kernel's linkage name
|
||||
|
||||
ElfSymbol_t* elfsymbol = tempObj.functionNameMap[FName];
|
||||
amd::OclElf::SymbolInfo* sinfo = (elfsymbol != NULL) ? &(elfsymbol->SymInfo[0]) : NULL;
|
||||
amd::Elf::SymbolInfo* sinfo = (elfsymbol != NULL) ? &(elfsymbol->SymInfo[0]) : NULL;
|
||||
|
||||
// Add info for this elf symbol into tempobj's functionNameMap[]
|
||||
int index = -1;
|
||||
@@ -168,7 +168,6 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
if (elfsymbol == NULL) {
|
||||
elfsymbol = new ElfSymbol_t();
|
||||
sinfo = &(elfsymbol->SymInfo[0]);
|
||||
::memset(sinfo, 0, NDX_LAST * sizeof(amd::OclElf::SymbolInfo));
|
||||
tempObj.functionNameMap[FName] = elfsymbol;
|
||||
|
||||
elfsymbol->IsKernel = isKernel;
|
||||
@@ -182,7 +181,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
char* section;
|
||||
size_t sz;
|
||||
|
||||
if (elfIn_->getSection(amd::OclElf::ILDEBUG, §ion, &sz)) {
|
||||
if (elfIn_->getSection(amd::Elf::ILDEBUG, §ion, &sz)) {
|
||||
// Get debugIL
|
||||
programil.append(section, sz);
|
||||
} else {
|
||||
@@ -221,10 +220,9 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
ElfSymbol_t* elfsymbol = tempObj.functionNameMap[kn];
|
||||
if (elfsymbol == NULL) {
|
||||
elfsymbol = new ElfSymbol_t();
|
||||
::memset(elfsymbol->SymInfo, 0, NDX_LAST * sizeof(amd::OclElf::SymbolInfo));
|
||||
tempObj.functionNameMap[kn] = elfsymbol;
|
||||
}
|
||||
amd::OclElf::SymbolInfo* sinfo = &(elfsymbol->SymInfo[0]);
|
||||
amd::Elf::SymbolInfo* sinfo = &(elfsymbol->SymInfo[0]);
|
||||
|
||||
elfsymbol->IsKernel = true;
|
||||
sinfo[NDX_AMDIL].address = const_cast<char*>(ilstr.data());
|
||||
@@ -248,7 +246,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
fmetadata.append(it.first);
|
||||
fmetadata.append("_fmetadata");
|
||||
|
||||
if (!elfOut()->addSymbol(amd::OclElf::RODATA, fmetadata.c_str(),
|
||||
if (!elfOut()->addSymbol(amd::Elf::RODATA, fmetadata.c_str(),
|
||||
elfsymbol->SymInfo[NDX_METADATA].address,
|
||||
elfsymbol->SymInfo[NDX_METADATA].size)) {
|
||||
LogError("AddSymbol() failed to add fmetadata");
|
||||
@@ -257,7 +255,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
}
|
||||
continue;
|
||||
}
|
||||
amd::OclElf::SymbolInfo* sinfo = &(elfsymbol->SymInfo[0]);
|
||||
amd::Elf::SymbolInfo* sinfo = &(elfsymbol->SymInfo[0]);
|
||||
std::string FName = it.first;
|
||||
|
||||
// For this kernel, get the demangled kernel name, which is used to identify each kernel.
|
||||
@@ -297,7 +295,7 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
|
||||
}
|
||||
|
||||
assert((func->metadata_.end_ == 0) && "ILFunc init failed");
|
||||
amd::OclElf::SymbolInfo* si = &(sym->SymInfo[0]);
|
||||
amd::Elf::SymbolInfo* si = &(sym->SymInfo[0]);
|
||||
if (si[NDX_METADATA].size > 0) {
|
||||
std::string meta(si[NDX_METADATA].address, si[NDX_METADATA].size);
|
||||
if (!program.parseFuncMetadata(meta, 0, std::string::npos)) {
|
||||
@@ -383,7 +381,7 @@ bool ClBinary::storeKernel(const std::string& name, const NullKernel* nullKernel
|
||||
if (saveAMDIL() && (ilSource.size() > 0)) {
|
||||
// Save IL (this is the per-kernel IL)
|
||||
std::string ilName = "__OpenCL_" + name + "_amdil";
|
||||
if (!elfOut()->addSymbol(amd::OclElf::ILTEXT, ilName.c_str(), ilSource.data(),
|
||||
if (!elfOut()->addSymbol(amd::Elf::ILTEXT, ilName.c_str(), ilSource.data(),
|
||||
ilSource.size())) {
|
||||
LogError("AddElfSymbol failed");
|
||||
return false;
|
||||
@@ -391,7 +389,7 @@ bool ClBinary::storeKernel(const std::string& name, const NullKernel* nullKernel
|
||||
|
||||
std::string metaName = "__OpenCL_" + name + "_metadata";
|
||||
// Save metadata symbols in .rodata
|
||||
if (!elfOut()->addSymbol(amd::OclElf::RODATA, metaName.c_str(), metadata.data(),
|
||||
if (!elfOut()->addSymbol(amd::Elf::RODATA, metaName.c_str(), metadata.data(),
|
||||
metadata.size())) {
|
||||
LogError("AddElfSymbol failed");
|
||||
return false;
|
||||
@@ -408,7 +406,7 @@ bool ClBinary::storeKernel(const std::string& name, const NullKernel* nullKernel
|
||||
if (!kernelMetaStored) {
|
||||
std::string metaName = "__OpenCL_" + name + "_metadata";
|
||||
// Save metadata symbols in .rodata
|
||||
if (!elfOut()->addSymbol(amd::OclElf::RODATA, metaName.c_str(), metadata.data(),
|
||||
if (!elfOut()->addSymbol(amd::Elf::RODATA, metaName.c_str(), metadata.data(),
|
||||
metadata.size())) {
|
||||
LogError("AddSymbol failed");
|
||||
return false;
|
||||
@@ -422,7 +420,7 @@ bool ClBinary::storeKernel(const std::string& name, const NullKernel* nullKernel
|
||||
delete[] isacode;
|
||||
return false;
|
||||
}
|
||||
if (!elfOut()->addSymbol(amd::OclElf::CAL, kernelName.c_str(), isacode, binarySize)) {
|
||||
if (!elfOut()->addSymbol(amd::Elf::CAL, kernelName.c_str(), isacode, binarySize)) {
|
||||
LogError("AddElfSymbol failed");
|
||||
return false;
|
||||
}
|
||||
@@ -446,7 +444,7 @@ bool ClBinary::storeKernel(const std::string& name, const NullKernel* nullKernel
|
||||
// VERSION_1
|
||||
kHeader.version_ = VERSION_CURRENT;
|
||||
|
||||
if (!elfOut()->addSymbol(amd::OclElf::RODATA, headerName.c_str(), &kHeader, sizeof(kHeader))) {
|
||||
if (!elfOut()->addSymbol(amd::Elf::RODATA, headerName.c_str(), &kHeader, sizeof(kHeader))) {
|
||||
LogError("AddElfSymbol failed");
|
||||
return false;
|
||||
}
|
||||
@@ -458,10 +456,10 @@ bool ClBinary::loadGlobalData(Program& program) {
|
||||
const char __OpenCL_[] = "__OpenCL_";
|
||||
const char _global[] = "_global";
|
||||
|
||||
for (amd::Sym_Handle sym = elfIn()->nextSymbol(NULL); sym != NULL;
|
||||
sym = elfIn()->nextSymbol(sym)) {
|
||||
amd::OclElf::SymbolInfo symInfo;
|
||||
if (!elfIn()->getSymbolInfo(sym, &symInfo)) {
|
||||
int num = elfIn()->getSymbolNum();
|
||||
for (int index = 0; index < num; index++) {
|
||||
amd::Elf::SymbolInfo symInfo;
|
||||
if (!elfIn()->getSymbolInfo(index, &symInfo)) {
|
||||
LogError("LoadGlobalDataFromElf: getSymbolInfo() fails");
|
||||
return false;
|
||||
}
|
||||
@@ -495,7 +493,7 @@ bool ClBinary::storeGlobalData(const void* globalData, size_t dataSize, uint ind
|
||||
std::stringstream glbName;
|
||||
glbName << "__OpenCL_" << index << "_global";
|
||||
|
||||
if (!elfOut()->addSymbol(amd::OclElf::RODATA, glbName.str().c_str(), globalData, dataSize)) {
|
||||
if (!elfOut()->addSymbol(amd::Elf::RODATA, glbName.str().c_str(), globalData, dataSize)) {
|
||||
LogError("addSymbol() failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class ClBinary : public device::ClBinary {
|
||||
uint32_t target = static_cast<uint32_t>(dev().calTarget());
|
||||
assert(((0xFFFF8000 & target) == 0) && "ASIC target ID >= 2^15");
|
||||
uint16_t elf_target = (uint16_t)(0x7FFF & target);
|
||||
return elfOut()->setTarget(elf_target, amd::OclElf::CAL_PLATFORM);
|
||||
return elfOut()->setTarget(elf_target, amd::Elf::CAL_PLATFORM);
|
||||
}
|
||||
|
||||
//! Clear elf out.
|
||||
|
||||
@@ -226,7 +226,7 @@ bool NullProgram::compileImpl(const std::string& src,
|
||||
}
|
||||
|
||||
llvmBinary_.assign(reinterpret_cast<const char*>(ir), len);
|
||||
elfSectionType_ = amd::OclElf::LLVMIR;
|
||||
elfSectionType_ = amd::Elf::LLVMIR;
|
||||
aclBinaryFini(bin);
|
||||
|
||||
for (size_t i = 0; i < headerFileNames.size(); ++i) {
|
||||
@@ -241,10 +241,10 @@ bool NullProgram::compileImpl(const std::string& src,
|
||||
#endif
|
||||
|
||||
if (clBinary()->saveSOURCE()) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::SOURCE, sourceCode.data(), sourceCode.size());
|
||||
clBinary()->elfOut()->addSection(amd::Elf::SOURCE, sourceCode.data(), sourceCode.size());
|
||||
}
|
||||
if (clBinary()->saveLLVMIR()) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(),
|
||||
clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(),
|
||||
false);
|
||||
// store the original compile options
|
||||
clBinary()->storeCompileOptions(compileOptions_);
|
||||
@@ -272,11 +272,11 @@ int NullProgram::compileBinaryToIL(amd::option::Options* options) {
|
||||
aclSections_0_8 spirFlag;
|
||||
_acl_type_enum_0_8 aclTypeBinaryUsed;
|
||||
if (std::string::npos != options->clcOptions.find("--spirv") ||
|
||||
elfSectionType_ == amd::OclElf::SPIRV) {
|
||||
elfSectionType_ == amd::Elf::SPIRV) {
|
||||
spirFlag = aclSPIRV;
|
||||
aclTypeBinaryUsed = ACL_TYPE_SPIRV_BINARY;
|
||||
} else if (std::string::npos != options->clcOptions.find("--spir") ||
|
||||
elfSectionType_ == amd::OclElf::SPIR) {
|
||||
elfSectionType_ == amd::Elf::SPIR) {
|
||||
spirFlag = aclSPIR;
|
||||
aclTypeBinaryUsed = ACL_TYPE_SPIR_BINARY;
|
||||
} else {
|
||||
|
||||
@@ -169,8 +169,8 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
|
||||
char* section;
|
||||
size_t sz;
|
||||
if (clBinary()->saveSOURCE() &&
|
||||
clBinary()->elfIn()->getSection(amd::OclElf::SOURCE, §ion, &sz)) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::SOURCE, section, sz);
|
||||
clBinary()->elfIn()->getSection(amd::Elf::SOURCE, §ion, &sz)) {
|
||||
clBinary()->elfOut()->addSection(amd::Elf::SOURCE, section, sz);
|
||||
}
|
||||
if (clBinary()->saveLLVMIR()) {
|
||||
if (clBinary()->loadLlvmBinary(llvmBinary_, elfSectionType_) &&
|
||||
@@ -193,7 +193,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
|
||||
}
|
||||
return true;
|
||||
} else if (clBinary()->loadLlvmBinary(llvmBinary_, elfSectionType_) &&
|
||||
clBinary()->isRecompilable(llvmBinary_, amd::OclElf::CAL_PLATFORM)) {
|
||||
clBinary()->isRecompilable(llvmBinary_, amd::Elf::CAL_PLATFORM)) {
|
||||
char* section;
|
||||
size_t sz;
|
||||
|
||||
@@ -205,8 +205,8 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
|
||||
}
|
||||
|
||||
if (clBinary()->saveSOURCE() &&
|
||||
clBinary()->elfIn()->getSection(amd::OclElf::SOURCE, §ion, &sz)) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::SOURCE, section, sz);
|
||||
clBinary()->elfIn()->getSection(amd::Elf::SOURCE, §ion, &sz)) {
|
||||
clBinary()->elfOut()->addSection(amd::Elf::SOURCE, section, sz);
|
||||
}
|
||||
if (clBinary()->saveLLVMIR()) {
|
||||
clBinary()->elfOut()->addSection(elfSectionType_, llvmBinary_.data(), llvmBinary_.size(),
|
||||
@@ -239,7 +239,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
|
||||
size_t dbgSize = debugILStr.size();
|
||||
// Add an IL section that contains debug information and is the
|
||||
// output of LLVM codegen.
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::ILDEBUG, dbgSec, dbgSize);
|
||||
clBinary()->elfOut()->addSection(amd::Elf::ILDEBUG, dbgSec, dbgSize);
|
||||
|
||||
if ((dbgSize > 0) && options->isDumpFlagSet(amd::option::DUMP_DEBUGIL)) {
|
||||
std::string debugilWithLine;
|
||||
@@ -275,7 +275,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
|
||||
continue;
|
||||
}
|
||||
clBinary()->elfOut()->addSection(
|
||||
static_cast<amd::OclElf::oclElfSections>(x + amd::OclElf::DEBUG_INFO), dbgSec, dbgSize);
|
||||
static_cast<amd::Elf::ElfSections>(x + amd::Elf::DEBUG_INFO), dbgSec, dbgSize);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -410,7 +410,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
|
||||
aStream << "__OpenCL_" << baseFunc->name_ << "_fmetadata";
|
||||
std::string metaName = aStream.str();
|
||||
// Save metadata symbols in .rodata
|
||||
if (!clBinary()->elfOut()->addSymbol(amd::OclElf::RODATA, metaName.c_str(),
|
||||
if (!clBinary()->elfOut()->addSymbol(amd::Elf::RODATA, metaName.c_str(),
|
||||
metadataStr.data(), metadataStr.size())) {
|
||||
buildLog_ += "Internal error: addSymbol failed!\n";
|
||||
LogError("AddSymbol failed");
|
||||
@@ -437,7 +437,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
|
||||
bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
amd::option::Options* options, bool createLibrary) {
|
||||
std::vector<std::string*> llvmBinaries(inputPrograms.size());
|
||||
std::vector<amd::OclElf::oclElfSections> elfSectionType(inputPrograms.size());
|
||||
std::vector<amd::Elf::ElfSections> elfSectionType(inputPrograms.size());
|
||||
auto it = inputPrograms.cbegin();
|
||||
const auto itEnd = inputPrograms.cend();
|
||||
for (size_t i = 0; it != itEnd; ++it, ++i) {
|
||||
@@ -464,7 +464,7 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!program->clBinary()->isRecompilable(program->llvmBinary_, amd::OclElf::CAL_PLATFORM)) {
|
||||
if (!program->clBinary()->isRecompilable(program->llvmBinary_, amd::Elf::CAL_PLATFORM)) {
|
||||
buildLog_ +=
|
||||
"Internal error: Input OpenCL binary is not"
|
||||
" for the target!\n";
|
||||
@@ -477,8 +477,8 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
size_t sz;
|
||||
|
||||
if (clBinary()->saveSOURCE() &&
|
||||
clBinary()->elfIn()->getSection(amd::OclElf::SOURCE, §ion, &sz)) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::SOURCE, section, sz);
|
||||
clBinary()->elfIn()->getSection(amd::Elf::SOURCE, §ion, &sz)) {
|
||||
clBinary()->elfOut()->addSection(amd::Elf::SOURCE, section, sz);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -505,9 +505,9 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
}
|
||||
|
||||
_bif_sections_enum_0_8 aclTypeUsed;
|
||||
if (elfSectionType[i] == amd::OclElf::SPIRV) {
|
||||
if (elfSectionType[i] == amd::Elf::SPIRV) {
|
||||
aclTypeUsed = aclSPIRV;
|
||||
} else if (elfSectionType[i] == amd::OclElf::SPIR) {
|
||||
} else if (elfSectionType[i] == amd::Elf::SPIR) {
|
||||
aclTypeUsed = aclSPIR;
|
||||
} else {
|
||||
aclTypeUsed = aclLLVMIR;
|
||||
@@ -542,9 +542,9 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
|
||||
size_t size = 0;
|
||||
_bif_sections_enum_0_8 aclTypeUsed;
|
||||
if (elfSectionType[0] == amd::OclElf::SPIRV && numLibs == 0) {
|
||||
if (elfSectionType[0] == amd::Elf::SPIRV && numLibs == 0) {
|
||||
aclTypeUsed = aclSPIRV;
|
||||
} else if (elfSectionType[0] == amd::OclElf::SPIR && numLibs == 0) {
|
||||
} else if (elfSectionType[0] == amd::Elf::SPIR && numLibs == 0) {
|
||||
aclTypeUsed = aclSPIR;
|
||||
} else {
|
||||
aclTypeUsed = aclLLVMIR;
|
||||
@@ -556,7 +556,7 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
}
|
||||
|
||||
llvmBinary_.assign(reinterpret_cast<const char*>(llvmir), size);
|
||||
elfSectionType_ = amd::OclElf::LLVMIR;
|
||||
elfSectionType_ = amd::Elf::LLVMIR;
|
||||
} while (0);
|
||||
|
||||
std::for_each(libs.begin(), libs.end(), std::ptr_fun(aclBinaryFini));
|
||||
@@ -567,7 +567,7 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
}
|
||||
|
||||
if (clBinary()->saveLLVMIR()) {
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(),
|
||||
clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(),
|
||||
false);
|
||||
// store the original link options
|
||||
clBinary()->storeLinkOptions(linkOptions_);
|
||||
@@ -603,7 +603,7 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
size_t dbgSize = debugILStr.size();
|
||||
// Add an IL section that contains debug information and is the
|
||||
// output of LLVM codegen.
|
||||
clBinary()->elfOut()->addSection(amd::OclElf::ILDEBUG, dbgSec, dbgSize);
|
||||
clBinary()->elfOut()->addSection(amd::Elf::ILDEBUG, dbgSec, dbgSize);
|
||||
|
||||
if ((dbgSize > 0) && options->isDumpFlagSet(amd::option::DUMP_DEBUGIL)) {
|
||||
std::string debugilWithLine;
|
||||
@@ -639,7 +639,7 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
continue;
|
||||
}
|
||||
clBinary()->elfOut()->addSection(
|
||||
static_cast<amd::OclElf::oclElfSections>(x + amd::OclElf::DEBUG_INFO), dbgSec, dbgSize);
|
||||
static_cast<amd::Elf::ElfSections>(x + amd::Elf::DEBUG_INFO), dbgSec, dbgSize);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -774,7 +774,7 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
|
||||
aStream << "__OpenCL_" << baseFunc->name_ << "_fmetadata";
|
||||
std::string metaName = aStream.str();
|
||||
// Save metadata symbols in .rodata
|
||||
if (!clBinary()->elfOut()->addSymbol(amd::OclElf::RODATA, metaName.c_str(),
|
||||
if (!clBinary()->elfOut()->addSymbol(amd::Elf::RODATA, metaName.c_str(),
|
||||
metadataStr.data(), metadataStr.size())) {
|
||||
buildLog_ += "Internal error: addSymbol failed!\n";
|
||||
LogError("AddSymbol failed");
|
||||
|
||||
@@ -109,8 +109,6 @@ target_include_directories(rocclrpal
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/include
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/backends/common
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/loaders/elf/utils/common
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/loaders/elf/utils/libelf
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${ROCM_OCL_INCLUDES}
|
||||
${ROCR_INCLUDES})
|
||||
|
||||
@@ -32,9 +32,6 @@
|
||||
#include "hsa.h"
|
||||
#include "hsa_ext_image.h"
|
||||
#include "amd_hsa_loader.hpp"
|
||||
#if defined(USE_COMGR_LIBRARY)
|
||||
#include "gelf.h"
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
|
||||
namespace pal {
|
||||
|
||||
|
||||
@@ -28,8 +28,7 @@ target_include_directories(oclrocm
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/include
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/backends/common
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/loaders/elf/utils/common
|
||||
${PROJECT_SOURCE_DIR}/compiler/lib/loaders/elf/utils/libelf
|
||||
${PROJECT_SOURCE_DIR}/elf
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${ROCM_OCL_INCLUDES}
|
||||
$<TARGET_PROPERTY:hsa-runtime64::hsa-runtime64,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
@@ -24,9 +24,6 @@
|
||||
|
||||
#include "utils/options.hpp"
|
||||
#include "rockernel.hpp"
|
||||
#if defined(USE_COMGR_LIBRARY)
|
||||
#include <gelf.h>
|
||||
#endif // defined(USE_COMGR_LIBRARY)
|
||||
|
||||
#include "utils/bif_section_labels.hpp"
|
||||
#include "amd_hsa_kernel_code.h"
|
||||
@@ -112,7 +109,7 @@ bool Program::initClBinary(char* binaryIn, size_t size) {
|
||||
}
|
||||
|
||||
// Both 32-bit and 64-bit are allowed!
|
||||
if (!amd::isElfMagic(bin)) {
|
||||
if (!amd::Elf::isElfMagic(bin)) {
|
||||
// Invalid binary.
|
||||
if (decryptedBin != nullptr) {
|
||||
delete[] decryptedBin;
|
||||
|
||||
Reference in New Issue
Block a user