Changeset 2535 in CLRX


Ignore:
Timestamp:
Nov 4, 2016, 9:32:06 PM (3 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Add next stuff to ROCmBinGenerator. Add CLRX version to default Gallium comment (ROCm comment).

Location:
CLRadeonExtender/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/CLRX/amdbin/ROCmBinaries.h

    r2534 r2535  
    162162    size_t codeSize;        ///< code size
    163163    const cxbyte* code;     ///< code
    164    
     164    size_t commentSize; ///< comment size (can be null)
     165    const char* comment; ///< comment
    165166    std::vector<BinSection> extraSections;  ///< extra sections
    166167    std::vector<BinSymbol> extraSymbols;    ///< extra symbols
  • CLRadeonExtender/trunk/amdbin/GalliumBinaries.cpp

    r2313 r2535  
    512512      const AmdGpuConfigContent& amdGpuConfigContent)
    513513{
    514     uint32_t commentSize = 28;
    515     const char* comment = "CLRX GalliumBinGenerator 0.1";
     514    const char* comment = "CLRX GalliumBinGenerator " CLRX_VERSION;
     515    uint32_t commentSize = ::strlen(comment);
    516516   
    517517    typedef ElfRegionTemplate<Types> ElfRegion;
  • CLRadeonExtender/trunk/amdbin/ROCmBinaries.cpp

    r2534 r2535  
    3131using namespace CLRX;
    3232
     33/* TODO: add support for various kernel code offset (now only 256 is supported) */
     34
    3335ROCmBinary::ROCmBinary(size_t binaryCodeSize, cxbyte* binaryCode, Flags creationFlags)
    3436        : ElfBinary64(binaryCodeSize, binaryCode, creationFlags),
     
    180182{
    181183    ElfBinaryGen64 elfBinGen64;
    182     elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 8,
    183                 ".dynsym", SHT_DYNSYM, SHF_ALLOC, 3, 1));
     184   
     185    const char* comment = "CLRX ROCmBinGenerator " CLRX_VERSION;
     186    uint32_t commentSize = ::strlen(comment);
     187    if (input->comment!=nullptr)
     188    {   // if comment, store comment section
     189        comment = input->comment;
     190        commentSize = input->commentSize;
     191        if (commentSize==0)
     192            commentSize = ::strlen(comment);
     193    }
     194   
     195    elfBinGen64.addRegion(ElfRegion64::programHeaderTable());
     196    elfBinGen64.addRegion(ElfRegion64::dynsymSection());
     197    elfBinGen64.addRegion(ElfRegion64::dynstrSection());
     198    elfBinGen64.addRegion(ElfRegion64(input->codeSize, (const cxbyte*)input->code,
     199              0x1000, ".text", SHT_PROGBITS, SHF_ALLOC|SHF_EXECINSTR, 0, 0, 0, 0,
     200              false, 256));
     201    elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 0x1000, ".dynamic",
     202              SHT_DYNAMIC, SHF_ALLOC|SHF_WRITE, 2, 0, 0, 0, false, 8));
     203    elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 4, ".note",
     204              SHT_NOTE, 0));
     205    elfBinGen64.addRegion(ElfRegion64(commentSize, (const cxbyte*)comment, 1, ".comment",
     206              SHT_PROGBITS, SHF_MERGE|SHF_STRINGS));
     207    elfBinGen64.addRegion(ElfRegion64::symtabSection());
     208    elfBinGen64.addRegion(ElfRegion64::shstrtabSection());
     209    elfBinGen64.addRegion(ElfRegion64::strtabSection());
     210    elfBinGen64.addRegion(ElfRegion64::sectionHeaderTable());
    184211   
    185212    size_t binarySize;
Note: See TracChangeset for help on using the changeset viewer.