Fix compiling issue exposed by opencl TC build

1.Some files are not built in rocclr so the issues are
not found in rocclr build. But the issues are exposed
in TC build.
2.Clear unused codes in test cmake file.

Change-Id: I1ad4decdf4df5237b93e1ea2547eb39a19f7dc4a


[ROCm/clr commit: 65075e72f1]
This commit is contained in:
Tao Sang
2020-09-04 09:42:14 -04:00
کامیت شده توسط Tao Sang
والد eaf65e59ae
کامیت c6a000f618
4فایلهای تغییر یافته به همراه8 افزوده شده و 14 حذف شده
@@ -110,9 +110,9 @@ bool ClBinary::loadKernels(NullProgram& program, bool* hasRecompiled) {
bool usedebugil = program.getCompilerOptions()->oVariables->UseDebugIL;
int num = elfIn()->getSymbolNum();
for (int index = 0; index < num; index++) {
for (int ndx = 0; ndx < num; ndx++) {
amd::Elf::SymbolInfo symInfo;
if (!elfIn()->getSymbolInfo(index, &symInfo)) {
if (!elfIn()->getSymbolInfo(ndx, &symInfo)) {
LogError("LoadKernelFromElf: getSymbolInfo() fails");
return false;
}
@@ -457,9 +457,9 @@ bool ClBinary::loadGlobalData(Program& program) {
const char _global[] = "_global";
int num = elfIn()->getSymbolNum();
for (int index = 0; index < num; index++) {
for (int ndx = 0; ndx < num; ndx++) {
amd::Elf::SymbolInfo symInfo;
if (!elfIn()->getSymbolInfo(index, &symInfo)) {
if (!elfIn()->getSymbolInfo(ndx, &symInfo)) {
LogError("LoadGlobalDataFromElf: getSymbolInfo() fails");
return false;
}
@@ -244,8 +244,7 @@ bool NullProgram::compileImpl(const std::string& src,
clBinary()->elfOut()->addSection(amd::Elf::SOURCE, sourceCode.data(), sourceCode.size());
}
if (clBinary()->saveLLVMIR()) {
clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(),
false);
clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size());
// store the original compile options
clBinary()->storeCompileOptions(compileOptions_);
}
@@ -176,7 +176,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
if (clBinary()->loadLlvmBinary(llvmBinary_, elfSectionType_) &&
(!llvmBinary_.empty())) {
clBinary()->elfOut()->addSection(elfSectionType_, llvmBinary_.data(),
llvmBinary_.size(), false);
llvmBinary_.size());
}
}
@@ -209,8 +209,7 @@ bool NullProgram::linkImpl(amd::option::Options* options) {
clBinary()->elfOut()->addSection(amd::Elf::SOURCE, section, sz);
}
if (clBinary()->saveLLVMIR()) {
clBinary()->elfOut()->addSection(elfSectionType_, llvmBinary_.data(), llvmBinary_.size(),
false);
clBinary()->elfOut()->addSection(elfSectionType_, llvmBinary_.data(), llvmBinary_.size());
}
} else {
buildLog_ += "Internal error: Input OpenCL binary is not for the target!\n";
@@ -567,8 +566,7 @@ bool NullProgram::linkImpl(const std::vector<device::Program*>& inputPrograms,
}
if (clBinary()->saveLLVMIR()) {
clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size(),
false);
clBinary()->elfOut()->addSection(amd::Elf::LLVMIR, llvmBinary_.data(), llvmBinary_.size());
// store the original link options
clBinary()->storeLinkOptions(linkOptions_);
@@ -38,9 +38,6 @@ target_include_directories(elf_test
add_definitions(-DUSE_COMGR_LIBRARY -DCOMGR_DYN_DLL -DWITH_LIGHTNING_COMPILER -DDEBUG)
#target_link_libraries(elf_test PUBLIC pthread)
#target_link_libraries(elf_test PRIVATE amdrocclr_static pthread hsa-runtime64::hsa-runtime64)
target_link_libraries(elf_test PRIVATE amdrocclr_static)
#install(TARGETS elf_test RUNTIME DESTINATION bin)
#-------------------------------------elf_test--------------------------------------#