From 035e90b70e1d4333660496022e1779396c93b4ac Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Sat, 17 Dec 2005 01:08:19 +0000 Subject: Add support for ELF visibility markings. (Portage version: 2.0.53) --- dev-lang/nasm/ChangeLog | 10 +- dev-lang/nasm/files/digest-nasm-0.98.39-r2 | 1 + .../nasm/files/nasm-0.98.39-elf-visibility.patch | 106 +++++++++++++++++++++ dev-lang/nasm/nasm-0.98.39-r2.ebuild | 66 +++++++++++++ 4 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 dev-lang/nasm/files/digest-nasm-0.98.39-r2 create mode 100644 dev-lang/nasm/files/nasm-0.98.39-elf-visibility.patch create mode 100644 dev-lang/nasm/nasm-0.98.39-r2.ebuild (limited to 'dev-lang/nasm') diff --git a/dev-lang/nasm/ChangeLog b/dev-lang/nasm/ChangeLog index c320a0097af8..bcb4adb40b32 100644 --- a/dev-lang/nasm/ChangeLog +++ b/dev-lang/nasm/ChangeLog @@ -1,6 +1,12 @@ # ChangeLog for dev-lang/nasm -# Copyright 2002-2005 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/dev-lang/nasm/ChangeLog,v 1.37 2005/05/17 22:56:40 mr_bones_ Exp $ +# Copyright 1999-2005 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/nasm/ChangeLog,v 1.38 2005/12/17 01:08:18 vapier Exp $ + +*nasm-0.98.39-r2 (17 Dec 2005) + + 17 Dec 2005; Mike Frysinger + +files/nasm-0.98.39-elf-visibility.patch, +nasm-0.98.39-r2.ebuild: + Add support for ELF visibility markings. *nasm-0.98.39-r1 (17 May 2005) diff --git a/dev-lang/nasm/files/digest-nasm-0.98.39-r2 b/dev-lang/nasm/files/digest-nasm-0.98.39-r2 new file mode 100644 index 000000000000..6e9a89fbc65a --- /dev/null +++ b/dev-lang/nasm/files/digest-nasm-0.98.39-r2 @@ -0,0 +1 @@ +MD5 2032ad44c7359f7a9a166a40a633e772 nasm-0.98.39.tar.bz2 543976 diff --git a/dev-lang/nasm/files/nasm-0.98.39-elf-visibility.patch b/dev-lang/nasm/files/nasm-0.98.39-elf-visibility.patch new file mode 100644 index 000000000000..9065f9f193db --- /dev/null +++ b/dev-lang/nasm/files/nasm-0.98.39-elf-visibility.patch @@ -0,0 +1,106 @@ +Add support for declaring elf visibility attributes. Used to +help cleanup TEXTRELs in misc libraries (like libsdl). + +Syntax to declare function foo hidden: +GLOBAL foo:function:hidden + +Patch by Mike Frysinger + +http://sourceforge.net/mailarchive/forum.php?thread_id=9230919&forum_id=4978 + +--- nasm/output/outelf.c ++++ nasm/output/outelf.c +@@ -50,6 +50,7 @@ struct Symbol { + long strpos; /* string table position of name */ + long section; /* section ID of the symbol */ + int type; /* symbol type */ ++ int other; /* symbol visibility */ + long value; /* address, or COMMON variable align */ + long size; /* size of symbol */ + long globnum; /* symbol table offset if global */ +@@ -113,9 +114,15 @@ extern struct ofmt of_elf; + + #define SYM_SECTION 0x04 + #define SYM_GLOBAL 0x10 ++#define SYM_NOTYPE 0x00 + #define SYM_DATA 0x01 + #define SYM_FUNCTION 0x02 + ++#define STV_DEFAULT 0 ++#define STV_INTERNAL 1 ++#define STV_HIDDEN 2 ++#define STV_PROTECTED 3 ++ + #define GLOBAL_TEMP_BASE 16 /* bigger than any constant sym id */ + + #define SEG_ALIGN 16 /* alignment of sections in file */ +@@ -493,6 +500,7 @@ static void elf_deflabel(char *name, lon + + sym->strpos = pos; + sym->type = is_global ? SYM_GLOBAL : 0; ++ sym->other = STV_DEFAULT; + sym->size = 0; + if (segment == NO_SEG) + sym->section = SHN_ABS; +@@ -571,16 +579,40 @@ static void elf_deflabel(char *name, lon + sects[sym->section - 1]->gsyms = sym; + + if (special) { +- int n = strcspn(special, " "); ++ char *visibility = NULL; ++ int n; ++ n = strcspn(special, ":"); ++ if (special[n]) { ++ visibility = special + n + 1; ++ } else ++ n = strcspn(special, " "); + + if (!nasm_strnicmp(special, "function", n)) + sym->type |= SYM_FUNCTION; + else if (!nasm_strnicmp(special, "data", n) || + !nasm_strnicmp(special, "object", n)) + sym->type |= SYM_DATA; ++ else if (!nasm_strnicmp(special, "notype", n)) ++ sym->type |= SYM_NOTYPE; + else + error(ERR_NONFATAL, "unrecognised symbol type `%.*s'", + n, special); ++ if (visibility) { ++ n = strcspn(visibility, " "); ++ if (!nasm_strnicmp(visibility, "default", n)) ++ sym->other = STV_DEFAULT; ++ else if (!nasm_strnicmp(visibility, "internal", n)) ++ sym->other = STV_INTERNAL; ++ else if (!nasm_strnicmp(visibility, "hidden", n)) ++ sym->other = STV_HIDDEN; ++ else if (!nasm_strnicmp(visibility, "protected", n)) ++ sym->other = STV_PROTECTED; ++ else ++ error(ERR_NONFATAL, "unrecognised symbol type `%.*s'", ++ n, visibility); ++ n = strcspn(special, " "); ++ } ++ + if (special[n]) { + struct tokenval tokval; + expr *e; +@@ -1120,7 +1152,8 @@ static struct SAA *elf_build_symtab(long + WRITELONG(p, sym->strpos); + WRITELONG(p, sym->value); + WRITELONG(p, sym->size); +- WRITESHORT(p, sym->type); /* local non-typed thing */ ++ WRITECHAR(p, sym->type); /* local non-typed thing */ ++ WRITECHAR(p, sym->other); + WRITESHORT(p, sym->section); + saa_wbytes(s, entry, 16L); + *len += 16; +@@ -1138,7 +1171,8 @@ static struct SAA *elf_build_symtab(long + WRITELONG(p, sym->strpos); + WRITELONG(p, sym->value); + WRITELONG(p, sym->size); +- WRITESHORT(p, sym->type); /* global non-typed thing */ ++ WRITECHAR(p, sym->type); /* global non-typed thing */ ++ WRITECHAR(p, sym->other); + WRITESHORT(p, sym->section); + saa_wbytes(s, entry, 16L); + *len += 16; diff --git a/dev-lang/nasm/nasm-0.98.39-r2.ebuild b/dev-lang/nasm/nasm-0.98.39-r2.ebuild new file mode 100644 index 000000000000..fd7486bc4e93 --- /dev/null +++ b/dev-lang/nasm/nasm-0.98.39-r2.ebuild @@ -0,0 +1,66 @@ +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/nasm/nasm-0.98.39-r2.ebuild,v 1.1 2005/12/17 01:08:18 vapier Exp $ + +inherit eutils toolchain-funcs + +DESCRIPTION="groovy little assembler" +HOMEPAGE="http://nasm.sourceforge.net/" +SRC_URI="mirror://sourceforge/nasm/${P}.tar.bz2" + +LICENSE="LGPL-2.1" +SLOT="0" +KEYWORDS="-* ~amd64 ~x86" +IUSE="doc build" + +DEPEND="!build? ( dev-lang/perl ) + doc? ( virtual/ghostscript sys-apps/texinfo )" +RDEPEND="" + +src_unpack() { + unpack ${A} + cd "${S}" + epatch "${FILESDIR}"/${P}-elf-visibility.patch + if [ "$(gcc-major-version)" -eq "2" ] ; then + sed -i \ + -e 's:-std=c99::g' \ + configure \ + || die "sed failed" + fi + #security fix for bug #92991 + sed -i \ + -e '/vsprintf/c\ vsnprintf(buffer, sizeof(buffer), format, ap); + ' output/outieee.c \ + || die "sed failed" +} + +src_compile() { + econf || die + + if use build; then + emake nasm || die "emake failed" + else + emake all || die "emake failed" + emake rdf || die "emake failed" + if use doc ; then + emake doc || die "emake failed" + fi + fi +} + +src_install() { + if use build; then + dobin nasm || die "dobin failed" + else + dobin nasm ndisasm rdoff/{ldrdf,rdf2bin,rdf2ihx,rdfdump,rdflib,rdx} \ + || die "dobin failed" + dosym /usr/bin/rdf2bin /usr/bin/rdf2com + doman nasm.1 ndisasm.1 + dodoc AUTHORS CHANGES ChangeLog INSTALL README TODO + if use doc; then + doinfo doc/info/* + dohtml doc/html/* + dodoc doc/nasmdoc.* + fi + fi +} -- cgit v1.2.3-65-gdbad