Date: Sun, 19 Apr 2015 19:06:55 +0000 (UTC) From: Adam Weinberger <adamw@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r384314 - in head/devel/nasm: . files Message-ID: <201504191906.t3JJ6t5J062950@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adamw Date: Sun Apr 19 19:06:55 2015 New Revision: 384314 URL: https://svnweb.freebsd.org/changeset/ports/384314 Log: Add a patch, taken from the nasm repo, written by emaste, that fixes alignment on 64-bit archs. From emaste: Essentially what happens is that nasm creates object files that have section contents aligned to 16 bytes, but it only specifies that the section requires 4 byte alignment. It seems that the GNU tools (strip at least) silently correct this to 8, which is what it should be. This fix only affects FreeBSD -CURRENT in combination with another (not yet committed) fix to libtool. On stable/10 and earlier GNU ld masks the nasm bug, and without the libtool fix we don't yet try to strip debug info from object files in -CURRENT. PORTREVISION bump for this. Also, while here, rename two other patches to have proper separators (_ instead of +). And, donate this port back to ports@. It is used by many other ports so it deserves to be maintained by the collective. Added: head/devel/nasm/files/patch-elf64-alignment (contents, props changed) head/devel/nasm/files/patch-output_outelf32.c - copied unchanged from r383931, head/devel/nasm/files/patch-output+outelf32.c head/devel/nasm/files/patch-output_outelf64.c - copied unchanged from r383931, head/devel/nasm/files/patch-output+outelf64.c Deleted: head/devel/nasm/files/patch-output+outelf32.c head/devel/nasm/files/patch-output+outelf64.c Modified: head/devel/nasm/Makefile Modified: head/devel/nasm/Makefile ============================================================================== --- head/devel/nasm/Makefile Sun Apr 19 18:46:53 2015 (r384313) +++ head/devel/nasm/Makefile Sun Apr 19 19:06:55 2015 (r384314) @@ -3,11 +3,12 @@ PORTNAME= nasm PORTVERSION= 2.11.08 +PORTREVISION= 1 PORTEPOCH= 1 CATEGORIES= devel lang MASTER_SITES= http://www.nasm.us/pub/nasm/releasebuilds/${PORTVERSION}/ -MAINTAINER= adamw@FreeBSD.org +MAINTAINER= ports@FreeBSD.org COMMENT= General-purpose multi-platform x86 and amd64 assembler LICENSE= BSD2CLAUSE Added: head/devel/nasm/files/patch-elf64-alignment ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/nasm/files/patch-elf64-alignment Sun Apr 19 19:06:55 2015 (r384314) @@ -0,0 +1,54 @@ +From 1f0cb0f2c1ba632c0fab02424928cfb756a9160c Mon Sep 17 00:00:00 2001 +From: Ed Maste <emaste@freebsd.org> +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 <emaste@freebsd.org> +Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com> +--- + output/outelf64.c | 4 ++-- + 1 files changed, 2 insertions(+), 2 deletions(-) + +diff --git output/outelf64.c output/outelf64.c +index 241e345..19bd845 100644 +--- output/outelf64.c ++++ 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; + } + +-- +1.7.6.6.GIT + Copied: head/devel/nasm/files/patch-output_outelf32.c (from r383931, head/devel/nasm/files/patch-output+outelf32.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/nasm/files/patch-output_outelf32.c Sun Apr 19 19:06:55 2015 (r384314, copy of r383931, head/devel/nasm/files/patch-output+outelf32.c) @@ -0,0 +1,11 @@ +--- output/outelf32.c.orig ++++ output/outelf32.c +@@ -1702,7 +1702,7 @@ + * the source-file, the n_desc field should be set to the number + * of remaining stabs + */ +- WRITE_STAB(sptr, fileidx[0], 0, 0, 0, strlen(allfiles[0] + 12)); ++ WRITE_STAB(sptr, fileidx[0], 0, 0, 0, stabstrlen); + + /* this is the stab for the main source file */ + WRITE_STAB(sptr, fileidx[mainfileindex], N_SO, 0, 0, 0); Copied: head/devel/nasm/files/patch-output_outelf64.c (from r383931, head/devel/nasm/files/patch-output+outelf64.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/devel/nasm/files/patch-output_outelf64.c Sun Apr 19 19:06:55 2015 (r384314, copy of r383931, head/devel/nasm/files/patch-output+outelf64.c) @@ -0,0 +1,11 @@ +--- output/outelf64.c.orig ++++ output/outelf64.c +@@ -1772,7 +1772,7 @@ + * the source-file, the n_desc field should be set to the number + * of remaining stabs + */ +- WRITE_STAB(sptr, fileidx[0], 0, 0, 0, strlen(allfiles[0] + 12)); ++ WRITE_STAB(sptr, fileidx[0], 0, 0, 0, stabstrlen); + + /* this is the stab for the main source file */ + WRITE_STAB(sptr, fileidx[mainfileindex], N_SO, 0, 0, 0);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201504191906.t3JJ6t5J062950>