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).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.