svn commit: r210326 - head/lib/libelf
Kai Wang
kaiw at FreeBSD.org
Wed Jul 21 09:20:41 UTC 2010
Author: kaiw
Date: Wed Jul 21 09:20:40 2010
New Revision: 210326
URL: http://svn.freebsd.org/changeset/base/210326
Log:
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
Modified:
head/lib/libelf/elf_update.c
Modified: head/lib/libelf/elf_update.c
==============================================================================
--- head/lib/libelf/elf_update.c Wed Jul 21 08:58:52 2010 (r210325)
+++ head/lib/libelf/elf_update.c Wed Jul 21 09:20:40 2010 (r210326)
@@ -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)
More information about the svn-src-all
mailing list