Improve compatibility with other implementations of the ELF(3) API:

when an output file has no program headers, set the 'e_phentsize'
field of the ELF executable header to zero.

Obtained from:	elftoolchain
MFC after:		1 month
This commit is contained in:
Kai Wang 2010-07-21 09:20:40 +00:00
parent e8968eb491
commit 3fd7b10a01
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=210326

View File

@ -422,8 +422,8 @@ _libelf_resync_elf(Elf *e)
(E)->e_ident[EI_VERSION] = (V); \
(E)->e_ehsize = _libelf_fsize(ELF_T_EHDR, (EC), (V), \
(size_t) 1); \
(E)->e_phentsize = _libelf_fsize(ELF_T_PHDR, (EC), (V), \
(size_t) 1); \
(E)->e_phentsize = (phnum == 0) ? 0 : _libelf_fsize( \
ELF_T_PHDR, (EC), (V), (size_t) 1); \
(E)->e_shentsize = _libelf_fsize(ELF_T_SHDR, (EC), (V), \
(size_t) 1); \
} while (0)