Changeset 2546 in CLRX


Ignore:
Timestamp:
Nov 7, 2016, 9:14:52 PM (3 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Add note table to ElfBinary?.

Location:
CLRadeonExtender/trunk
Files:
2 edited

Legend:

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

    r2545 r2546  
    7070    typedef Elf32_Phdr Phdr;    ///< program header
    7171    typedef Elf32_Sym Sym;      ///< symbol header
     72    typedef Elf32_Nhdr Nhdr;    ///< note header
    7273    static const cxbyte ELFCLASS;   ///< ELF class
    7374    static const cxuint bitness;    ///< ELF bitness
     
    8687    typedef Elf64_Phdr Phdr;    ///< program header
    8788    typedef Elf64_Sym Sym;      ///< symbol header
     89    typedef Elf64_Nhdr Nhdr;    ///< note header
    8890    static const cxbyte ELFCLASS;   ///< ELF class
    8991    static const cxuint bitness;    ///< ELF bitness
     
    113115    cxbyte* dynSymStringTable;    ///< pointer to dynamic symbol's string table
    114116    cxbyte* dynSymTable;          ///< pointer to dynamic symbol table
     117    cxbyte* noteTable;            ///< pointer to note table
     118    typename Types::Size noteTableSize;        ///< size of note table
    115119    SectionIndexMap sectionIndexMap;    ///< section's index map
    116120    SymbolIndexMap symbolIndexMap;      ///< symbol's index map
     
    347351    typename Types::Sym& getDynSymbol(const char* name)
    348352    { return getDynSymbol(getDynSymbolIndex(name)); }
     353   
     354    /// get note table
     355    const typename Types::Nhdr* getNotes() const
     356    { return reinterpret_cast<typename Types::Nhdr*>(noteTable); }
     357   
     358    /// get note table
     359    typename Types::Nhdr* getNotes()
     360    { return reinterpret_cast<typename Types::Nhdr*>(noteTable); }
     361   
     362    typename Types::Size getNotesSize() const
     363    { return noteTableSize; }
    349364   
    350365    /// get section content pointer
  • CLRadeonExtender/trunk/amdbin/ElfBinaries.cpp

    r2544 r2546  
    7070        sectionStringTable(nullptr), symbolStringTable(nullptr),
    7171        symbolTable(nullptr), dynSymStringTable(nullptr), dynSymTable(nullptr),
    72         symbolsNum(0), dynSymbolsNum(0),
     72        noteTable(nullptr), noteTableSize(0), symbolsNum(0), dynSymbolsNum(0),
    7373        symbolEntSize(0), dynSymEntSize(0)
    7474{ }
     
    8484        sectionStringTable(nullptr), symbolStringTable(nullptr),
    8585        symbolTable(nullptr), dynSymStringTable(nullptr), dynSymTable(nullptr),
     86        noteTable(nullptr), noteTableSize(0),
    8687        symbolsNum(0), dynSymbolsNum(0), symbolEntSize(0), dynSymEntSize(0)       
    8788{
     
    142143        const typename Types::Shdr* symTableHdr = nullptr;
    143144        const typename Types::Shdr* dynSymTableHdr = nullptr;
     145        const typename Types::Shdr* noteTableHdr = nullptr;
    144146       
    145147        cxuint shnum = ULEV(ehdr->e_shnum);
     
    175177            if (ULEV(shdr.sh_type) == SHT_DYNSYM)
    176178                dynSymTableHdr = &shdr;
     179            if (ULEV(shdr.sh_type) == SHT_NOTE)
     180                noteTableHdr = &shdr;
    177181        }
    178182        if ((creationFlags & ELF_CREATE_SECTIONMAP) != 0)
     
    256260            if ((creationFlags & ELF_CREATE_DYNSYMMAP) != 0)
    257261                mapSort(dynSymIndexMap.begin(), dynSymIndexMap.end(), CStringLess());
     262        }
     263        if (noteTableHdr != nullptr)
     264        {
     265            noteTable = binaryCode + ULEV(noteTableHdr->sh_offset);
     266            noteTableSize = ULEV(noteTableHdr->sh_size);
    258267        }
    259268    }
Note: See TracChangeset for help on using the changeset viewer.