Skip to content

Commit ebbd73e

Browse files
petechouigcbot
authored andcommitted
Add runtime symbol "INTEL_PATCH_CROSS_THREAD_OFFSET_OFF_R0" in ZEBIN.
An ELF symbol is required for R_SYM_ADDR_32 relocation.
1 parent a52cbf8 commit ebbd73e

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

IGC/AdaptorOCL/OCL/sp/zebin_builder.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ void ZEBinaryBuilder::addProgramScopeInfo(const IGC::SOpenCLProgramInfo& program
119119
{
120120
addGlobalConstants(programInfo);
121121
addGlobals(programInfo);
122+
addRuntimeSymbols();
122123
addProgramSymbols(programInfo);
123124
addProgramRelocations(programInfo);
124125
}
@@ -342,6 +343,13 @@ void ZEBinaryBuilder::addSymbol(const vISA::ZESymEntry& sym, ZEELFObjectBuilder:
342343
(sym.s_type == vISA::GenSymType::S_UNDEF) ? -1 : targetSect);
343344
}
344345

346+
void ZEBinaryBuilder::addRuntimeSymbols()
347+
{
348+
if (IGC_IS_FLAG_ENABLED(EnableGlobalStateBuffer))
349+
mBuilder.addSymbol("INTEL_PATCH_CROSS_THREAD_OFFSET_OFF_R0", /*addr*/0, /*size*/0,
350+
llvm::ELF::STB_GLOBAL, llvm::ELF::STT_NOTYPE, /*sectionId*/-1);
351+
}
352+
345353
void ZEBinaryBuilder::addProgramSymbols(const IGC::SOpenCLProgramInfo& annotations)
346354
{
347355
const IGC::SOpenCLProgramInfo::ZEBinProgramSymbolTable& symbols = annotations.m_zebinSymbolTable;

IGC/AdaptorOCL/OCL/sp/zebin_builder.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ class ZEBinaryBuilder : DisallowCopy
9595
/// add spir-v section
9696
void addSPIRV(const uint8_t* data, uint32_t size);
9797

98+
/// add runtime symbols
99+
void addRuntimeSymbols();
100+
98101
/// add program scope symbols (e.g. symbols defined in global/const buffer)
99102
void addProgramSymbols(const IGC::SOpenCLProgramInfo& annotations);
100103

0 commit comments

Comments
 (0)