Changeset 2554 in CLRX


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

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

Location:
CLRadeonExtender/trunk
Files:
3 edited

Legend:

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

    r2553 r2554  
    656656    /// get note section
    657657    static ElfRegionTemplate noteSection()
    658     { return ElfRegionTemplate(0, (const cxbyte*)nullptr, sizeof(typename Types::Word),
    659                 ".note", SHT_NOTE, 0); }
     658    { return ElfRegionTemplate(0, (const cxbyte*)nullptr, 4, ".note", SHT_NOTE, 0); }
    660659   
    661660    /// get dynamic
  • CLRadeonExtender/trunk/amdbin/AmdCL2BinGen.cpp

    r2551 r2554  
    16101610};
    16111611
    1612 /* NT_VERSION (0x1): size: 8, value: 0x1
    1613  * NT_ARCH (0x2): size: 12, dwords: 0x1, 0x0, 0x010101
    1614  * 0x5: size: 25, string: \x16\000-hsa_call_convention=\0\0
    1615  * 0x3: size: 30, string: (version???)
    1616  * "\4\0\7\0\7\0\0\0\0\0\0\0\0\0\0\0AMD\0AMDGPU\0\0\0\0"
    1617  * 0x4: size: 4, random 64-bit value: 0x7ffXXXXXXXXX */
    1618 static const cxbyte noteSectionData[168] =
    1619 {
    1620     0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
    1621     0x01, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x00,
    1622     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1623     0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
    1624     0x02, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x00,
    1625     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1626     0x01, 0x01, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
    1627     0x19, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
    1628     0x41, 0x4d, 0x44, 0x00, 0x16, 0x00, 0x2d, 0x68,
    1629     0x73, 0x61, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x5f,
    1630     0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69,
    1631     0x6f, 0x6e, 0x3d, 0x00, 0x00, 0x00, 0x00, 0x00,
    1632     0x04, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x00,
    1633     0x03, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x00,
    1634     0x04, 0x00, 0x07, 0x00, 0x07, 0x00, 0x00, 0x00,
    1635     0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1636     0x41, 0x4d, 0x44, 0x00, 0x41, 0x4d, 0x44, 0x47,
    1637     0x50, 0x55, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1638     0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
    1639     0x04, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x00,
    1640     0xf0, 0x83, 0x17, 0xfb, 0xfc, 0x7f, 0x00, 0x00
    1641 };
    1642 
    16431612static const cxbyte noteDescType1[8] = { 1, 0, 0, 0, 0, 0, 0, 0 };
    16441613static const cxbyte noteDescType2[12] = { 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0 };
     
    16611630{ 0x16, 0, '-', 'h', 's', 'a', '_', 'c', 'a', 'l', 'l', '_',
    16621631    'c', 'o', 'n', 'v', 'e', 'n', 't', 'i', 'o', 'n', '=', '0', 0, 't' };
    1663 
    1664 static const size_t noteAMDGPUTypeOffset = 0x74;
    1665 
    1666 static const cxbyte noteSectionData16_3[200] =
    1667 {
    1668     0x04, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
    1669     0x01, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x00,
    1670     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1671     0x04, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
    1672     0x02, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x00,
    1673     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1674     0x01, 0x01, 0x01, 0x00, 0x04, 0x00, 0x00, 0x00,
    1675     0x1a, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
    1676     0x41, 0x4d, 0x44, 0x00, 0x04, 0x00, 0x07, 0x00,
    1677     0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    1678     0x00, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x00,
    1679     0x41, 0x4d, 0x44, 0x47, 0x50, 0x55, 0x00, 0x00,
    1680     0x04, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00,
    1681     0x04, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x00,
    1682     0x19, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
    1683     0x00, 0x00, 0x00, 0x00, 0x41, 0x4d, 0x44, 0x20,
    1684     0x48, 0x53, 0x41, 0x20, 0x52, 0x75, 0x6e, 0x74,
    1685     0x69, 0x6d, 0x65, 0x20, 0x46, 0x69, 0x6e, 0x61,
    1686     0x6c, 0x69, 0x7a, 0x65, 0x72, 0x00, 0x00, 0x00,
    1687     0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00,
    1688     0x1a, 0x00, 0x00, 0x00, 0x05, 0x00, 0x00, 0x00,
    1689     0x41, 0x4d, 0x44, 0x00, 0x16, 0x00, 0x2d, 0x68,
    1690     0x73, 0x61, 0x5f, 0x63, 0x61, 0x6c, 0x6c, 0x5f,
    1691     0x63, 0x6f, 0x6e, 0x76, 0x65, 0x6e, 0x74, 0x69,
    1692     0x6f, 0x6e, 0x3d, 0x30, 0x00, 0x00, 0x00, 0x00,
    1693 };
    1694 
    1695 static const size_t noteAMDGPUTypeOffset_16_3 = 0x48;
    16961632
    16971633struct AMDGPUArchValues
     
    20261962                             sizeof noteDescType5_gpupro, noteDescType5_gpupro, 5U));
    20271963           
    2028             innerBinGen->addRegion(ElfRegion64::noteSection());
     1964            innerBinGen->addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 8,
     1965                             ".note", SHT_NOTE, 0));
    20291966            innerBinSectionTable[AMDCL2SECTID_NOTE-ELFSECTID_START] = extraSectionIndex++;
    20301967        }
     
    21092046            innerBinGen->addNote(ElfNote("AMD", sizeof noteDescType4, noteDescType4, 4U));
    21102047           
    2111             innerBinGen->addRegion(ElfRegion64::noteSection());
     2048            innerBinGen->addRegion(ElfRegion64(0, (const cxbyte*)nullptr, 8,
     2049                                   ".note", SHT_NOTE, 0));
    21122050           
    21132051            innerBinSectionTable[AMDCL2SECTID_NOTE-ELFSECTID_START] = extraSectionIndex++;
  • 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.