From 1f0cb0f2c1ba632c0fab02424928cfb756a9160c Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Thu, 16 Apr 2015 00:59:52 +0300 Subject: [PATCH] output: elf64 -- increase .symtab and .rel* alignment to 8 Discovered while working on ELF Tool Chain elfcopy (strip), which originally crashed on an assert while processing a nasm-generated ELF object. The .symtab and .rela.text sections report 4 byte alignment, but require 8. As an aside, see https://sourceforge.net/p/elftoolchain/tickets/485/ for a discussion of the ELF Tool Chain issue that this bug exposed. With my WIP elfcopy change and nasm-assembled jccolss2-64.o from libjpeg-turbo: % strip -o /dev/null --strip-debug jccolss2-64.o strip: section .symtab alignment 4 increased to 8 strip: section .rela.text alignment 4 increased to 8 http://bugzilla.nasm.us/show_bug.cgi?id=3392307 Signed-off-by: Ed Maste Signed-off-by: Cyrill Gorcunov --- output/outelf64.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/output/outelf64.c b/output/outelf64.c index 241e345f..19bd8459 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -1084,7 +1084,7 @@ static void elf_write(void) /* .symtab */ elf_section_header(p - shstrtab, SHT_SYMTAB, 0, symtab, true, - symtablen, sec_strtab, symtablocal, 4, 24); + symtablen, sec_strtab, symtablocal, 8, 24); p += strlen(p) + 1; /* .strtab */ @@ -1096,7 +1096,7 @@ static void elf_write(void) for (i = 0; i < nsects; i++) if (sects[i]->head) { elf_section_header(p - shstrtab, SHT_RELA, 0, sects[i]->rel, true, - sects[i]->rellen, sec_symtab, i + 1, 4, 24); + sects[i]->rellen, sec_symtab, i + 1, 8, 24); p += strlen(p) + 1; } -- 2.11.4.GIT