Ignore:
Timestamp:
Mar 14, 2018, 9:59:17 PM (13 months ago)
Author:
matszpk
Message:

CLRadeonExtender: AsmROCm: Add '.nosectdiffs' for compatibility with the ROCm behaviour from older assembler's versions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • CLRadeonExtender/trunk/amdasm/AsmROCmFormat.cpp

    r3829 r3900  
    5454    "md_sgprsnum", "md_symname", "md_version",
    5555    "md_vgprsnum", "md_wavefront_size",
    56     "metadata", "newbinfmt", "pgmrsrc1", "pgmrsrc2", "printf", "priority",
     56    "metadata", "newbinfmt", "nosectdiffs",
     57    "pgmrsrc1", "pgmrsrc2", "printf", "priority",
    5758    "private_elem_size", "private_segment_align",
    5859    "privmode", "reqd_work_group_size",
     
    9394    ROCMOP_MD_PRIVATE_SEGMENT_FIXED_SIZE, ROCMOP_MD_SGPRSNUM,
    9495    ROCMOP_MD_SYMNAME, ROCMOP_MD_VERSION, ROCMOP_MD_VGPRSNUM, ROCMOP_MD_WAVEFRONT_SIZE,
    95     ROCMOP_METADATA, ROCMOP_NEWBINFMT, ROCMOP_PGMRSRC1, ROCMOP_PGMRSRC2, ROCMOP_PRINTF,
     96    ROCMOP_METADATA, ROCMOP_NEWBINFMT, ROCMOP_NOSECTDIFFS,
     97    ROCMOP_PGMRSRC1, ROCMOP_PGMRSRC2, ROCMOP_PRINTF,
    9698    ROCMOP_PRIORITY, ROCMOP_PRIVATE_ELEM_SIZE, ROCMOP_PRIVATE_SEGMENT_ALIGN,
    9799    ROCMOP_PRIVMODE, ROCMOP_REQD_WORK_GROUP_SIZE,
     
    278280    // code is addressable and writeable
    279281    if (info.type == AsmSectionType::CODE || info.type == AsmSectionType::DATA)
     282    {
    280283        info.flags = ASMSECT_ADDRESSABLE | ASMSECT_WRITEABLE;
     284        if (info.type == AsmSectionType::DATA && !sectionDiffsResolvable)
     285            info.flags |= ASMSECT_ABS_ADDRESSABLE;
     286    }
    281287    else if (info.type == AsmSectionType::ROCM_GOT)
     288    {
    282289        info.flags = ASMSECT_ADDRESSABLE;
     290        if (!sectionDiffsResolvable)
     291            info.flags |= ASMSECT_ABS_ADDRESSABLE;
     292    }
    283293    // any other section (except config) are absolute addressable and writeable
    284294    else if (info.type != AsmSectionType::CONFIG)
    285295        info.flags = ASMSECT_ADDRESSABLE | ASMSECT_WRITEABLE | ASMSECT_ABS_ADDRESSABLE;
    286296   
    287     if (info.type == AsmSectionType::CODE || info.type == AsmSectionType::DATA ||
    288         info.type == AsmSectionType::ROCM_GOT)
    289         info.relSpace = 0;  // first rel space
     297    if (sectionDiffsResolvable)
     298        if (info.type == AsmSectionType::CODE || info.type == AsmSectionType::DATA ||
     299            info.type == AsmSectionType::ROCM_GOT)
     300            info.relSpace = 0;  // first rel space
    290301   
    291302    info.name = sections[sectionId].name;
     
    17651776}
    17661777
     1778void AsmROCmPseudoOps::noSectionDiffs(AsmROCmHandler& handler, const char* linePtr)
     1779{
     1780    Assembler& asmr = handler.assembler;
     1781    if (!checkGarbagesAtEnd(asmr, linePtr))
     1782        return;
     1783   
     1784    handler.sectionDiffsResolvable = false;
     1785}
     1786
    17671787void AsmROCmPseudoOps::addGotSymbol(AsmROCmHandler& handler,
    17681788                    const char* pseudoOpPlace, const char* linePtr)
     
    21422162        case ROCMOP_MD_LANGUAGE:
    21432163            AsmROCmPseudoOps::setKernelLanguage(*this, stmtPlace, linePtr);
     2164            break;
     2165        case ROCMOP_NOSECTDIFFS:
     2166            AsmROCmPseudoOps::noSectionDiffs(*this, linePtr);
    21442167            break;
    21452168        case ROCMOP_MD_PRIVATE_SEGMENT_FIXED_SIZE:
     
    27522775bool AsmROCmHandler::prepareBinary()
    27532776{
     2777    if (!sectionDiffsResolvable)
     2778        // if no section resolvable
     2779        prepareSectionDiffsResolving();
     2780   
    27542781    if (unresolvedGlobals)
    27552782    {
Note: See TracChangeset for help on using the changeset viewer.