Ignore:
Timestamp:
Jan 27, 2018, 1:49:38 PM (23 months ago)
Author:
matszpk
Message:

CLRadeonExtender: ROCmBinGen: Correct region space for program headers and add new program header for notes.

File:
1 edited

Legend:

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

    r3666 r3667  
    384384    addMainSectionToTable(mainSectionsNum, mainBuiltinSectTable, ROCMSECTID_HASH);
    385385    addMainSectionToTable(mainSectionsNum, mainBuiltinSectTable, ELFSECTID_DYNSTR);
     386    const cxuint execProgHeaderRegionIndex = mainSectionsNum;
    386387    addMainSectionToTable(mainSectionsNum, mainBuiltinSectTable, ELFSECTID_TEXT);
    387388    addMainSectionToTable(mainSectionsNum, mainBuiltinSectTable, ROCMSECTID_DYNAMIC);
     
    399400    elfBinGen64.addProgramHeader({ PT_PHDR, PF_R, 0, 1,
    400401                    true, Elf64Types::nobase, Elf64Types::nobase, 0 });
    401     elfBinGen64.addProgramHeader({ PT_LOAD, PF_R, PHREGION_FILESTART, 4,
     402    elfBinGen64.addProgramHeader({ PT_LOAD, PF_R, PHREGION_FILESTART,
     403                    execProgHeaderRegionIndex,
    402404                    true, Elf64Types::nobase, Elf64Types::nobase, 0, 0x1000 });
    403     elfBinGen64.addProgramHeader({ PT_LOAD, PF_R|PF_X, 4, 1,
     405    elfBinGen64.addProgramHeader({ PT_LOAD, PF_R|PF_X, execProgHeaderRegionIndex, 1,
    404406                    true, Elf64Types::nobase, Elf64Types::nobase, 0 });
    405     elfBinGen64.addProgramHeader({ PT_LOAD, PF_R|PF_W, 5, 1,
     407    elfBinGen64.addProgramHeader({ PT_LOAD, PF_R|PF_W, execProgHeaderRegionIndex+1, 1,
    406408                    true, Elf64Types::nobase, Elf64Types::nobase, 0 });
    407     elfBinGen64.addProgramHeader({ PT_DYNAMIC, PF_R|PF_W, 5, 1,
     409    elfBinGen64.addProgramHeader({ PT_DYNAMIC, PF_R|PF_W, execProgHeaderRegionIndex+1, 1,
    408410                    true, Elf64Types::nobase, Elf64Types::nobase, 0, 8 });
    409     elfBinGen64.addProgramHeader({ PT_GNU_RELRO, PF_R, 5, 1,
     411    elfBinGen64.addProgramHeader({ PT_GNU_RELRO, PF_R, execProgHeaderRegionIndex+1, 1,
    410412                    true, Elf64Types::nobase, Elf64Types::nobase, 0, 1 });
    411413    elfBinGen64.addProgramHeader({ PT_GNU_STACK, PF_R|PF_W, PHREGION_FILESTART, 0,
    412414                    true, 0, 0, 0 });
     415   
     416    if (input->newBinFormat)
     417        // program header for note (new binary format)
     418        elfBinGen64.addProgramHeader({ PT_NOTE, PF_R, 1, 1, true, 0, 0, 0 });
    413419   
    414420    // elf notes
Note: See TracChangeset for help on using the changeset viewer.