Changeset 2496 in CLRX


Ignore:
Timestamp:
Oct 29, 2016, 6:51:57 PM (4 years ago)
Author:
matszpk
Message:

CLRadeonExtender: Preliminary fixes to ElfBinaries? (additional section align) for ROCm binary format.

Location:
CLRadeonExtender/trunk
Files:
2 edited

Legend:

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

    r2386 r2496  
    500500        typename Types::Word entSize;    ///< entries size
    501501        bool zeroOffset;
     502        typename Types::Word align;
    502503    } section;  ///< section structure
    503504   
     
    535536              typename Types::SectionFlags _flags, uint32_t _link = 0, uint32_t _info = 0,
    536537              typename Types::Word _addrBase = 0,
    537               typename Types::Word _entSize = 0, bool _zeroOffset = false)
     538              typename Types::Word _entSize = 0, bool _zeroOffset = false,
     539              typename Types::Word _sectAlign = 0)
    538540            : type(ElfRegionType::SECTION), dataFromPointer(true), size(_size),
    539541              align(_align), data(_data)
    540542    {
    541         section = {_name, _type, _flags, _link, _info, _addrBase, _entSize, _zeroOffset};
     543        section = {_name, _type, _flags, _link, _info, _addrBase,
     544            _entSize, _zeroOffset, _sectAlign};
    542545    }
    543546   
     
    547550              typename Types::SectionFlags _flags, uint32_t _link = 0, uint32_t _info = 0,
    548551              typename Types::Word _addrBase = 0,
    549               typename Types::Word _entSize = 0, bool _zeroOffset = false)
     552              typename Types::Word _entSize = 0, bool _zeroOffset = false,
     553              typename Types::Word _sectAlign = 0)
    550554            : type(ElfRegionType::SECTION), dataFromPointer(false), size(_size),
    551555              align(_align), dataGen(_data)
    552556    {
    553         section = {inName, _type, _flags, _link, _info, _addrBase, _entSize, _zeroOffset};
     557        section = {inName, _type, _flags, _link, _info, _addrBase,
     558            _entSize, _zeroOffset, _sectAlign};
    554559    }
    555560    /// constructor for external section (BinSection)
     
    569574            uint32_t(convertSectionId(binSection.linkId, builtinSections,
    570575                             maxBuiltinSection, startExtraIndex)),
    571             binSection.info, 0, typename Types::Word(binSection.entSize) };
     576            binSection.info, 0, typename Types::Word(binSection.entSize), 0 };
    572577    }
    573578   
  • CLRadeonExtender/trunk/amdbin/ElfBinaries.cpp

    r2150 r2496  
    593593        // fix alignment
    594594        uint64_t toFill = 0;
    595         if (region.align > 1)
     595        typename Types::Word ralign = (region.type==ElfRegionType::SECTION) ?
     596                        region.section.align : 0;
     597        ralign = std::max(region.align, ralign);
     598        if (ralign > 1)
    596599        {
    597600            const uint64_t curOffset = (fob.getWritten()-startOffset);
    598             if (region.align!=0 && (curOffset&(region.align-1))!=0)
    599                 toFill = region.align - (curOffset&(region.align-1));
     601            if (ralign!=0 && (curOffset&(ralign-1))!=0)
     602                toFill = ralign - (curOffset&(ralign-1));
    600603            fob.fill(toFill, 0);
    601604        }
     
    615618                SLEV(phdr.p_offset, !zeroOffset ?
    616619                        regionOffsets[progHeader.regionStart] : 0);
    617                 SLEV(phdr.p_align, regions[progHeader.regionStart].align);
     620                typename Types::Word align = (sregion.type==ElfRegionType::SECTION) ?
     621                        sregion.section.align : 0;
     622                align = std::max(sregion.align, align);
     623                SLEV(phdr.p_align, align);
    618624               
    619625                /* paddrBase and vaddrBase is base to program header virtual and physical
Note: See TracChangeset for help on using the changeset viewer.