Changeset 4945 in CLRX


Ignore:
Timestamp:
Sep 1, 2019, 5:51:19 PM (2 weeks ago)
Author:
matszpk
Message:

CLRadeonExtender: ROCmBinGen: Change visibility and type for kernel symbols in LLVM10 binary. Adding kernel descritptor symbols to LLVM10 binary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdbin/ROCmBinaries.cpp

    r4944 r4945  
    771771                  ELF64_ST_INFO(STB_LOCAL, STT_NOTYPE), STV_HIDDEN, true, 0, 0));
    772772    const uint16_t textSectIndex = mainBuiltinSectTable[ELFSECTID_TEXT-ELFSECTID_START];
     773    const uint16_t rodataSectIndex = mainBuiltinSectTable[ELFSECTID_RODATA-ELFSECTID_START];
     774   
     775    const cxuint kernelSymType = input->llvm10BinFormat ? STT_FUNC : STT_GNU_IFUNC;
     776    const cxuint kernelSymVis = input->llvm10BinFormat ? STV_PROTECTED : STV_DEFAULT;
     777    size_t kdOffset = 0;
    773778    for (const ROCmSymbolInput& symbol: input->symbols)
    774779    {
     
    778783            case ROCmRegionType::KERNEL:
    779784                elfsym = ElfSymbol64(symbol.symbolName.c_str(), textSectIndex,
    780                       ELF64_ST_INFO(STB_GLOBAL, STT_GNU_IFUNC), 0, true,
     785                      ELF64_ST_INFO(STB_GLOBAL, kernelSymType),
     786                      ELF64_ST_VISIBILITY(kernelSymVis), true,
    781787                      symbol.offset, symbol.size);
    782788                break;
     
    797803        elfBinGen64->addSymbol(elfsym);
    798804        elfBinGen64->addDynSymbol(elfsym);
     805        if (input->llvm10BinFormat)
     806        {
     807            std::string kdsym(symbol.symbolName.c_str());
     808            kdsym += ".kd";
     809            elfsym = ElfSymbol64(kdsym.c_str(), rodataSectIndex,
     810                      ELF64_ST_INFO(STB_GLOBAL, kernelSymType),
     811                      ELF64_ST_VISIBILITY(kernelSymVis), true, kdOffset, symbol.size);
     812            kdOffset += sizeof(ROCmKernelDescriptor);
     813        }
    799814    }
    800815    /* extra symbols */
Note: See TracChangeset for help on using the changeset viewer.