162306a36Sopenharmony_ci.. SPDX-License-Identifier: GPL-2.0 262306a36Sopenharmony_ci 362306a36Sopenharmony_ci================================= 462306a36Sopenharmony_ciLinux-specific ELF idiosyncrasies 562306a36Sopenharmony_ci================================= 662306a36Sopenharmony_ci 762306a36Sopenharmony_ciDefinitions 862306a36Sopenharmony_ci=========== 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci"First" program header is the one with the smallest offset in the file: 1162306a36Sopenharmony_cie_phoff. 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci"Last" program header is the one with the biggest offset in the file: 1462306a36Sopenharmony_cie_phoff + (e_phnum - 1) * sizeof(Elf_Phdr). 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ciPT_INTERP 1762306a36Sopenharmony_ci========= 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_ciFirst PT_INTERP program header is used to locate the filename of ELF 2062306a36Sopenharmony_ciinterpreter. Other PT_INTERP headers are ignored (since Linux 2.4.11). 2162306a36Sopenharmony_ci 2262306a36Sopenharmony_ciPT_GNU_STACK 2362306a36Sopenharmony_ci============ 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ciLast PT_GNU_STACK program header defines userspace stack executability 2662306a36Sopenharmony_ci(since Linux 2.6.6). Other PT_GNU_STACK headers are ignored. 2762306a36Sopenharmony_ci 2862306a36Sopenharmony_ciPT_GNU_PROPERTY 2962306a36Sopenharmony_ci=============== 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ciELF interpreter's last PT_GNU_PROPERTY program header is used (since 3262306a36Sopenharmony_ciLinux 5.8). If interpreter doesn't have one, then the last PT_GNU_PROPERTY 3362306a36Sopenharmony_ciprogram header of an executable is used. Other PT_GNU_PROPERTY headers 3462306a36Sopenharmony_ciare ignored. 35