libffi: upgraded package to upstream

Upgraded {dev-libs,virtual}/libffi to version 3.0.11 on amd64, arm, x86

BUG=chromium:219083
TEST=`cbuildbot chromiumos-sdk {x86-alex,stumpy}-release` works

Change-Id: Ie1b27933fa25ae44bb4beacde97245c57be9cd3d
Reviewed-on: https://chromium-review.googlesource.com/176129
Reviewed-by: Aviv Keshet <akeshet@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/dev-libs/libffi/Manifest b/dev-libs/libffi/Manifest
new file mode 100644
index 0000000..a1b39fa
--- /dev/null
+++ b/dev-libs/libffi/Manifest
@@ -0,0 +1 @@
+DIST libffi-3.0.11.tar.gz 794220 SHA256 70bfb01356360089aa97d3e71e3edf05d195599fd822e922e50d46a0055a6283 SHA512 0049388d16207078a3d6dce97c877f1d9647aa9d908a9372a3f67ca064b70d8c8b23ee458be4a15a6344a5d39ea3e6292be728dfbcc73e1efc0b1db03be874f3 WHIRLPOOL c5ee01a6415b2715a4542d0997e3a7f42cbc97e476589d4e093fcff44315cc83f78a02dc04929c96831309966ac196e6ceb134c8b14cfc02313e139a98e6c11a
diff --git a/dev-libs/libffi/files/libffi-3.0.11-x86-pic-check.patch b/dev-libs/libffi/files/libffi-3.0.11-x86-pic-check.patch
new file mode 100644
index 0000000..40f5532
--- /dev/null
+++ b/dev-libs/libffi/files/libffi-3.0.11-x86-pic-check.patch
@@ -0,0 +1,113 @@
+https://bugs.gentoo.org/417179
+https://github.com/atgreen/libffi/issues/21
+
+From bff052d9cd5be41ba9e47c76114054af487d3c30 Mon Sep 17 00:00:00 2001
+From: Anthony Green <green@moxielogic.com>
+Date: Fri, 11 Jan 2013 10:24:32 -0500
+Subject: [PATCH] 32-bit x86 fix and more
+
+---
+ ChangeLog          |    8 ++++++++
+ README             |    2 ++
+ configure          |   43 +++++--------------------------------------
+ configure.ac       |    6 +++---
+ m4/ax_cc_maxopt.m4 |    3 ++-
+ 5 files changed, 20 insertions(+), 42 deletions(-)
+
+diff --git a/configure.ac b/configure.ac
+index 5ca32fd..32ec7c5 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -334,10 +334,10 @@ fi
+ if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then
+     AC_CACHE_CHECK([assembler supports pc related relocs],
+ 	libffi_cv_as_x86_pcrel, [
+-	libffi_cv_as_x86_pcrel=yes
++	libffi_cv_as_x86_pcrel=no
+ 	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
+-	if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then
+-	    libffi_cv_as_x86_pcrel=no
++	if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
++	    libffi_cv_as_x86_pcrel=yes
+ 	fi
+ 	])
+     if test "x$libffi_cv_as_x86_pcrel" = xyes; then
+diff --git a/m4/ax_cc_maxopt.m4 b/m4/ax_cc_maxopt.m4
+index f5f7517..62e3b53 100644
+--- a/m4/ax_cc_maxopt.m4
++++ b/m4/ax_cc_maxopt.m4
+@@ -141,7 +141,8 @@ if test "$ac_test_CFLAGS" != "set"; then
+      CFLAGS="-O3 -fomit-frame-pointer"
+ 
+      # -malign-double for x86 systems
+-     AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double")
++     # LIBFFI -- DON'T DO THIS - CHANGES ABI
++     # AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double")
+ 
+      #  -fstrict-aliasing for gcc-2.95+
+      AX_CHECK_COMPILE_FLAG(-fstrict-aliasing,
+diff --git a/configure b/configure
+index 95d950b..41bde69 100755
+--- a/configure
++++ b/configure
+@@ -12426,41 +12426,8 @@ $as_echo "$icc_archflag" >&6; }
+      CFLAGS="-O3 -fomit-frame-pointer"
+ 
+      # -malign-double for x86 systems
+-     { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -malign-double" >&5
+-$as_echo_n "checking whether C compiler accepts -malign-double... " >&6; }
+-if ${ax_cv_check_cflags___malign_double+:} false; then :
+-  $as_echo_n "(cached) " >&6
+-else
+-
+-  ax_check_save_flags=$CFLAGS
+-  CFLAGS="$CFLAGS  -malign-double"
+-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+-/* end confdefs.h.  */
+-
+-int
+-main ()
+-{
+-
+-  ;
+-  return 0;
+-}
+-_ACEOF
+-if ac_fn_c_try_compile "$LINENO"; then :
+-  ax_cv_check_cflags___malign_double=yes
+-else
+-  ax_cv_check_cflags___malign_double=no
+-fi
+-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+-  CFLAGS=$ax_check_save_flags
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___malign_double" >&5
+-$as_echo "$ax_cv_check_cflags___malign_double" >&6; }
+-if test x"$ax_cv_check_cflags___malign_double" = xyes; then :
+-  CFLAGS="$CFLAGS -malign-double"
+-else
+-  :
+-fi
+-
++     # LIBFFI -- DON'T DO THIS - CHANGES ABI
++     # AX_CHECK_COMPILE_FLAG(-malign-double, CFLAGS="$CFLAGS -malign-double")
+ 
+      #  -fstrict-aliasing for gcc-2.95+
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstrict-aliasing" >&5
+@@ -14480,10 +14447,10 @@ if ${libffi_cv_as_x86_pcrel+:} false; then :
+   $as_echo_n "(cached) " >&6
+ else
+ 
+-	libffi_cv_as_x86_pcrel=yes
++	libffi_cv_as_x86_pcrel=no
+ 	echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s
+-	if $CC $CFLAGS -c conftest.s 2>&1 | $EGREP -i 'illegal|warning' > /dev/null; then
+-	    libffi_cv_as_x86_pcrel=no
++	if $CC $CFLAGS -c conftest.s > /dev/null 2>&1; then
++	    libffi_cv_as_x86_pcrel=yes
+ 	fi
+ 
+ fi
+-- 
+1.7.10
+
diff --git a/dev-libs/libffi/libffi-3.0.11.ebuild b/dev-libs/libffi/libffi-3.0.11.ebuild
new file mode 100644
index 0000000..980ab5f
--- /dev/null
+++ b/dev-libs/libffi/libffi-3.0.11.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/dev-libs/libffi/libffi-3.0.11.ebuild,v 1.20 2013/03/28 23:48:12 vapier Exp $
+
+EAPI=4
+
+MY_P=${P/_/-}
+
+inherit eutils libtool multilib toolchain-funcs
+
+DESCRIPTION="a portable, high level programming interface to various calling conventions."
+HOMEPAGE="http://sourceware.org/libffi/"
+SRC_URI="ftp://sourceware.org/pub/${PN}/${MY_P}.tar.gz"
+
+LICENSE="MIT"
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE="debug static-libs test"
+
+RDEPEND=""
+DEPEND="test? ( dev-util/dejagnu )"
+
+S=${WORKDIR}/${MY_P}
+
+DOCS="ChangeLog* README"
+
+pkg_setup() {
+	# Check for orphaned libffi, see http://bugs.gentoo.org/354903 for example
+	if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
+		local base="${T}"/conftest
+		echo 'int main() { }' > "${base}".c
+		$(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
+		if [ $? -eq 0 ]; then
+			eerror "The linker reported linking against -lffi to be working while it shouldn't have."
+			eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
+			die "The system is in inconsistent state with unknown libffi installed."
+		fi
+	fi
+}
+
+src_prepare() {
+	epatch "${FILESDIR}"/${P}-x86-pic-check.patch #417179
+	sed -i 's:@toolexeclibdir@:$(libdir):g' Makefile.in || die #462814
+	epatch_user
+	elibtoolize
+}
+
+src_configure() {
+	use userland_BSD && export HOST="${CHOST}"
+	econf \
+		$(use_enable static-libs static) \
+		$(use_enable debug)
+}
+
+src_install() {
+	default
+	rm -f "${ED}"/usr/lib*/lib*.la
+}
+
+pkg_preinst() {
+	preserve_old_lib /usr/$(get_libdir)/${PN}$(get_libname 5)
+}
+
+pkg_postinst() {
+	preserve_old_lib_notify /usr/$(get_libdir)/${PN}$(get_libname 5)
+}
diff --git a/dev-libs/libffi/metadata.xml b/dev-libs/libffi/metadata.xml
new file mode 100644
index 0000000..691534b
--- /dev/null
+++ b/dev-libs/libffi/metadata.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+	<herd>toolchain</herd>
+	<longdescription lang="en">
+		Compilers for high level languages generate code that follow certain
+		conventions. These conventions are necessary, in part, for separate
+		compilation to work. One such convention is the "calling
+		convention". The "calling convention" is essentially a set of
+		assumptions made by the compiler about where function arguments will
+		be found on entry to a function. A "calling convention" also specifies
+		where the return value for a function is found.
+
+		Some programs may not know at the time of compilation what arguments
+		are to be passed to a function. For instance, an interpreter may be
+		told at run-time about the number and types of arguments used to call
+		a given function. Libffi can be used in such programs to provide a
+		bridge from the interpreter program to compiled code.
+
+		The libffi library provides a portable, high level programming
+		interface to various calling conventions. This allows a programmer to
+		call any function specified by a call interface description at run
+		time.
+
+		Ffi stands for Foreign Function Interface. A foreign function
+		interface is the popular name for the interface that allows code
+		written in one language to call code written in another language. The
+		libffi library really only provides the lowest, machine dependent
+		layer of a fully featured foreign function interface. A layer must
+		exist above libffi that handles type conversions for values passed
+		between the two languages.
+	</longdescription>
+	<use>
+		<flag name='pax_kernel'>Use PaX emulated trampolines, for we can't use PROT_EXEC</flag>
+	</use>
+</pkgmetadata>
diff --git a/metadata/md5-cache/dev-libs/libffi-3.0.11 b/metadata/md5-cache/dev-libs/libffi-3.0.11
new file mode 100644
index 0000000..0603ed4
--- /dev/null
+++ b/metadata/md5-cache/dev-libs/libffi-3.0.11
@@ -0,0 +1,12 @@
+DEFINED_PHASES=configure install postinst preinst prepare setup
+DEPEND=test? ( dev-util/dejagnu )
+DESCRIPTION=a portable, high level programming interface to various calling conventions.
+EAPI=4
+HOMEPAGE=http://sourceware.org/libffi/
+IUSE=debug static-libs test
+KEYWORDS=alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris
+LICENSE=MIT
+SLOT=0
+SRC_URI=ftp://sourceware.org/pub/libffi/libffi-3.0.11.tar.gz
+_eclasses_=eutils	d40dc948067bd3db1c8ebf7d51897313	libtool	0fd90d183673bf1107465ec45849d1ea	multilib	ded93e450747134a079e647d888aa80b	toolchain-funcs	3e30ef439a720915f8f4fd4fe75f704c	user	9e552f935106ff0bc92af16da64b4b29
+_md5_=a8e6dd42669f80d4597a507aaf1f0421
diff --git a/metadata/md5-cache/virtual/libffi-0 b/metadata/md5-cache/virtual/libffi-0
deleted file mode 100644
index b489efb..0000000
--- a/metadata/md5-cache/virtual/libffi-0
+++ /dev/null
@@ -1,6 +0,0 @@
-DEFINED_PHASES=-
-DESCRIPTION=Virtual for dev-libs/libffi
-KEYWORDS=alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris
-RDEPEND=dev-libs/libffi
-SLOT=0
-_md5_=fd7c0c7d6e5ddd51418c360e2f7533ff
diff --git a/metadata/md5-cache/virtual/libffi-3.0.11 b/metadata/md5-cache/virtual/libffi-3.0.11
new file mode 100644
index 0000000..daa4efa
--- /dev/null
+++ b/metadata/md5-cache/virtual/libffi-3.0.11
@@ -0,0 +1,6 @@
+DEFINED_PHASES=-
+DESCRIPTION=A virtual for the Foreign Function Interface implementation
+KEYWORDS=alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris
+RDEPEND=>=dev-libs/libffi-3.0.11
+SLOT=0
+_md5_=fb3f1f63b4c0988c6a48b4394736a38f
diff --git a/virtual/libffi/libffi-0.ebuild b/virtual/libffi/libffi-0.ebuild
deleted file mode 100644
index 88d1ab8..0000000
--- a/virtual/libffi/libffi-0.ebuild
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 1999-2010 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/virtual/libffi/libffi-0.ebuild,v 1.26 2010/01/11 11:19:25 ulm Exp $
-
-DESCRIPTION="Virtual for dev-libs/libffi"
-HOMEPAGE=""
-SRC_URI=""
-
-LICENSE=""
-SLOT="0"
-KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~sparc-fbsd ~x86-fbsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
-IUSE=""
-
-RDEPEND="dev-libs/libffi"
-DEPEND=""
diff --git a/virtual/libffi/libffi-3.0.11.ebuild b/virtual/libffi/libffi-3.0.11.ebuild
new file mode 100644
index 0000000..a918fe2
--- /dev/null
+++ b/virtual/libffi/libffi-3.0.11.ebuild
@@ -0,0 +1,18 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/virtual/libffi/libffi-3.0.11.ebuild,v 1.2 2013/02/17 23:41:52 zmedico Exp $
+
+# The purpose of this ebuild is to provide quick fallback if and when we need to
+# switch back to internal copy of libffi from sys-devel/gcc.
+
+DESCRIPTION="A virtual for the Foreign Function Interface implementation"
+HOMEPAGE=""
+SRC_URI=""
+
+LICENSE=""
+SLOT="0"
+KEYWORDS="alpha amd64 arm hppa ia64 m68k mips ppc ppc64 s390 sh sparc x86 ~ppc-aix ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x64-freebsd ~x86-freebsd ~hppa-hpux ~ia64-hpux ~x86-interix ~amd64-linux ~arm-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE=""
+
+RDEPEND=">=dev-libs/libffi-3.0.11"
+DEPEND=""