From 829e2d6c5d9c8a69acc829c12d6e68dcdf9b5651 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Tue, 24 Oct 2006 09:43:50 -0700 Subject: [PATCH] set e_shentsize to work around bug in binutils [mostly cosmetic] --- src/p_lx_elf.cpp | 6 +++--- src/stub/tools/sstrip/sstrip.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/p_lx_elf.cpp b/src/p_lx_elf.cpp index cd9d8168..69ed2ce0 100644 --- a/src/p_lx_elf.cpp +++ b/src/p_lx_elf.cpp @@ -1053,7 +1053,7 @@ PackLinuxElf32::generateElfHdr( h2->ehdr.e_shoff = 0; assert(get_native16(&h2->ehdr.e_ehsize) == sizeof(Elf32_Ehdr)); assert(get_native16(&h2->ehdr.e_phentsize) == sizeof(Elf32_Phdr)); - h2->ehdr.e_shentsize = 0; + h2->ehdr.e_shentsize = sizeof(Elf32_Shdr); h2->ehdr.e_shnum = 0; h2->ehdr.e_shstrndx = 0; @@ -1103,7 +1103,7 @@ PackOpenBSDElf32x86::generateElfHdr( h3->ehdr.e_shoff = 0; assert(get_native16(&h3->ehdr.e_ehsize) == sizeof(Elf32_Ehdr)); assert(get_native16(&h3->ehdr.e_phentsize) == sizeof(Elf32_Phdr)); - h3->ehdr.e_shentsize = 0; + h3->ehdr.e_shentsize = sizeof(Elf32_Shdr); h3->ehdr.e_shnum = 0; h3->ehdr.e_shstrndx = 0; @@ -1165,7 +1165,7 @@ PackLinuxElf64::generateElfHdr( h2->ehdr.e_shoff = 0; assert(get_native16(&h2->ehdr.e_ehsize) == sizeof(Elf64_Ehdr)); assert(get_native16(&h2->ehdr.e_phentsize) == sizeof(Elf64_Phdr)); - h2->ehdr.e_shentsize = 0; + h2->ehdr.e_shentsize = sizeof(Elf64_Shdr); h2->ehdr.e_shnum = 0; h2->ehdr.e_shstrndx = 0; diff --git a/src/stub/tools/sstrip/sstrip.c b/src/stub/tools/sstrip/sstrip.c index e54ab081..e9e9704a 100644 --- a/src/stub/tools/sstrip/sstrip.c +++ b/src/stub/tools/sstrip/sstrip.c @@ -240,7 +240,7 @@ static int modifyheaders ## CLASS (Elf ## CLASS ## _Ehdr *ehdr, \ if (EGET(ehdr->e_shoff) >= newsize) { \ ESET(ehdr->e_shoff,0); \ ESET(ehdr->e_shnum,0); \ - ESET(ehdr->e_shentsize,0); \ + ESET(ehdr->e_shentsize,sizeof(Elf ## CLASS ## _Shdr)); \ ESET(ehdr->e_shstrndx,0); \ } \ \