Ignore:
Timestamp:
Nov 10, 2016, 7:45:45 PM (4 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Remove obsolete data from AmdCL2BinGen. Change ElfRegion::noteSection definition.
ROCmBinaries: add dynamics and notes.

File:
1 edited

Legend:

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

    r2545 r2554  
    179179}
    180180
     181static const cxbyte noteDescType1[8] =
     182{ 2, 0, 0, 0, 1, 0, 0, 0 };
     183
     184static const cxbyte noteDescType3[27] =
     185{ 4, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     186  'A', 'M', 'D', 0, 'A', 'M', 'D', 'G', 'P', 'U', 0 };
     187
    181188void ROCmBinGenerator::generateInternal(std::ostream* osPtr, std::vector<char>* vPtr,
    182189             Array<cxbyte>* aPtr) const
     
    211218    }
    212219   
     220    static const int32_t dynTags[] = {
     221        DT_SYMTAB, DT_SYMENT, DT_STRTAB, DT_STRSZ, DT_HASH };
     222    elfBinGen64.addDynamics(sizeof(dynTags)/sizeof(int32_t), dynTags);
     223   
     224    elfBinGen64.addNote(ElfNote("AMD", sizeof noteDescType1, noteDescType1, 1U));
     225    std::unique_ptr<cxbyte[]> noteBuf(new cxbyte[0x1b]);
     226    ::memcpy(noteBuf.get(), noteDescType3, 0x1e);
     227    //SULEV(*(uint32_t*)(noteBuf.get()+4), amdGpuArchValues.major);
     228    //SULEV(*(uint32_t*)(noteBuf.get()+8), amdGpuArchValues.minor);
     229    //SULEV(*(uint32_t*)(noteBuf.get()+12), amdGpuArchValues.stepping);
     230    elfBinGen64.addNote(ElfNote("AMD", 0x1b, noteBuf.get(), 3U));
     231   
    213232    elfBinGen64.addRegion(ElfRegion64::programHeaderTable());
    214233    elfBinGen64.addRegion(ElfRegion64::dynsymSection());
     
    218237              0x1000, ".text", SHT_PROGBITS, SHF_ALLOC|SHF_EXECINSTR, 0, 0, 0, 0,
    219238              false, 256));
    220     elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 0x1000, ".dynamic",
    221               SHT_DYNAMIC, SHF_ALLOC|SHF_WRITE, 2, 0, 0, 0, false, 8));
    222     elfBinGen64.addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 4, ".note",
    223               SHT_NOTE, 0));
     239    elfBinGen64.addRegion(ElfRegion64::dynamicSection(3));
     240    elfBinGen64.addRegion(ElfRegion64::noteSection());
    224241    elfBinGen64.addRegion(ElfRegion64(commentSize, (const cxbyte*)comment, 1, ".comment",
    225242              SHT_PROGBITS, SHF_MERGE|SHF_STRINGS));
Note: See TracChangeset for help on using the changeset viewer.