From 99abbc5e5a6ecd3fc981b45646fd8cb5d320377b Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sat, 24 Feb 2018 19:58:07 +0000 Subject: gentoo resync : 24.02.2018 --- dev-libs/libffi/Manifest | 2 + .../files/libffi-3.2.1-ia64-small-struct.patch | 74 ++++++++++++++++++++++ dev-libs/libffi/libffi-3.2.1-r2.ebuild | 70 ++++++++++++++++++++ 3 files changed, 146 insertions(+) create mode 100644 dev-libs/libffi/files/libffi-3.2.1-ia64-small-struct.patch create mode 100644 dev-libs/libffi/libffi-3.2.1-r2.ebuild (limited to 'dev-libs/libffi') diff --git a/dev-libs/libffi/Manifest b/dev-libs/libffi/Manifest index 2675c9c12199..c1703df24135 100644 --- a/dev-libs/libffi/Manifest +++ b/dev-libs/libffi/Manifest @@ -1,10 +1,12 @@ AUX libffi-3.1-darwin-x32.patch 606 BLAKE2B d5fb0c46d294241fd054717e3da00fdfa4e37b9d98bd79801843b0562f8ec02943659ce1baac5ed24a8651771ef318626b8f70d054e300572c2888a482a3084d SHA512 909e4c45f124d6a9d4a0b2b97fdcbf0451a15c11c3da581fc8571d4f4f0857306bbfddf682bbe0441f0c5c84a8489e4a79a792883bfe440224cf672567bf0a24 AUX libffi-3.2.1-complex-ia64.patch 1622 BLAKE2B dc51b1cf0d0cd796d168bf4cdb66a8d5fc34a5fd46d96fd0dffd07d5885032775389cfd1465100d9972eb0ce736e8caab14dd49318dcc6630754825806be342e SHA512 136eaaa9e467afba2634fd4f997cfd982fc0162a48aba7efc429e719afea53e40607c973d281f78d5cf2d7886664ddc4b19161d35af113c9a7326c637e10b2e1 AUX libffi-3.2.1-complex_alpha.patch 605 BLAKE2B 3b14addb7797ff99a465101487be49c922f0286f49230d13cebdec159e0054defa0f35e5dbbd0c5dad71117ad72d183d0a88af5b175957b3585d2b1639c87a2b SHA512 c5a3c287db9b7a71068c4f73c0dc3c3e2ee602a9c55c57cae393fcdbdc913e77e18481c19f8454b74ed7b66f7dded9e30b11b61d079c8567c585f6cc890cd70b +AUX libffi-3.2.1-ia64-small-struct.patch 2306 BLAKE2B 1bace1573d4bdb93e7be97a8609426d35a1217cbb0718e7580c2a3b646a7d493d4b7aecc25dee35f61f7e036904e6b7dde8d3d398842dab7149053da2a2761a3 SHA512 4f33d849210da633629e16e96779dce2e03c0d1e6f44b91b68410e35433378f8cf0a04736d161539ea368f54a713177e6e8df2fde93d40c6917d03ad74a99c2c AUX libffi-3.2.1-include-path-autogen.patch 2901 BLAKE2B 836e61b6f64b9d649e969799e42c5dd808750ba51997d7486eef58e636ef2e1f215f9a26b5e88e61366d57e758688c4e69f578edd81167e1dbb0a8357f049150 SHA512 6c8b2d7dca0cdc6f69b2393777f546b6722b6260cfa6fcb814915975227185cc3b467b6537939f8f8d05df5fd8f245301030aa4ef74a3c2fa073e6200e91d47f AUX libffi-3.2.1-include-path.patch 1156 BLAKE2B b5842f5dc6462edac0a5f58265246599d0283bb148f954fb79d8037e37ae332a664f57a201589b89022d63932d8a4e56c4b0c6a7a9a2240ae6602e847fff3a55 SHA512 f387590510ee5e3aedc03744fcf1faae35c105a81d4c2f646e495d489bc6467cd88d4a0a63b40a29fe620ad71db1a05c1fe483af63974222f366135f73f36cb3 AUX libffi-3.2.1-o-tmpfile-eacces.patch 660 BLAKE2B 651067a56e0bd0980a696ad12c8fa76d68d914fa370fb93c3f5f5759dd4837895a077510606fa451beafb75e7da19f42a9f88e3d56d6c283f684da695ad69960 SHA512 0887063ce1d812c31a34d662f852cf2944e008f2f60bd07941572f9032861e749968b090686e0d788f7cc3c5c8f1ed2388418ff000c42fd2d592f9837e782f65 DIST libffi-3.2.1.tar.gz 940837 BLAKE2B d202ccaa185acfd2476ed2a9b011891507cd8efbbda60f67c583268d1563853442ed829acecbf81c9b6b9a930345780bb7a4bd80e71e50ef544c7f4eab8cb01f SHA512 980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483 EBUILD libffi-3.2.1-r1.ebuild 2405 BLAKE2B 09d43e6a73ce68afa1e86c166dd46a75887fe8ccf68b40fde42839ba9845a2bc305f2cdfa05570bddd3e47364435b1055b101da8ac6f56fbb8d5de2275cd4ca1 SHA512 777f38391afb930d42ccd56a7fcfad57c684b3359f43ed80d179cf1a9ef125cfc73b64208f5072323460368a71561fd94c3c03d31ed64955d5dfc40409af9fc3 +EBUILD libffi-3.2.1-r2.ebuild 2464 BLAKE2B 280d49c1be545edc9efe1c89afaf2047f9d35a6c2f73b73b0847c927daaf717310b62fe4933768adc3623eae708ea36f2710632bcc9c4a34bd13b7444bc668d3 SHA512 e8c23b5341335c5371daba4176c5b9904fe5c816364b7c36ae64edece64284cab39e8506d5c729aa2f39e5b5a0bd34745af46af98e085e0e26d73414bcba46ff EBUILD libffi-3.2.1.ebuild 2104 BLAKE2B e14f781ba993954032bb80464efe262c46e419b5d8b97c2f9f125cca0ab3d3acf5479413226e00422791bc238a93ed4f35411f02004dcef2cb62d69ed64e75c3 SHA512 98e9e34ed8312ca0a4bbf3cded47c135558b35a821a6ef26dfa14621fd965ebb7bb30c97c3cd39e0663fe9ae85fc79455c88bd472bd7f410ef8386a879f3fa13 MISC metadata.xml 1866 BLAKE2B 4623e414d8d8c2d569b2ae8a6fd6117c38b11e5b3845bba17b32ce442b88afd0ea1aff66cd73181c59b7e66be65df078d68d13f793ab654c3e213ab4c20fce50 SHA512 e1de94bb58c77aa48ee1b7d81777d26b736db3f3ef652099bb3f3a9bd75689258a61168371a30976e0717519bc9300b3812a8405ad1f16683c45a24817960b90 diff --git a/dev-libs/libffi/files/libffi-3.2.1-ia64-small-struct.patch b/dev-libs/libffi/files/libffi-3.2.1-ia64-small-struct.patch new file mode 100644 index 000000000000..6e21f3566bc9 --- /dev/null +++ b/dev-libs/libffi/files/libffi-3.2.1-ia64-small-struct.patch @@ -0,0 +1,74 @@ +From b58caef7fd620408be9239ac24ea89d5bc84f30b Mon Sep 17 00:00:00 2001 +From: Sergei Trofimovich +Date: Sat, 17 Feb 2018 19:00:40 +0000 +Subject: [PATCH 2/2] ia64: fix small struct return + +This change fixes libffi.call/struct10.c failure on ia64: +FAIL: libffi.call/struct10.c -W -Wall -Wno-psabi -O0 execution test + +.Lst_small_struct handles returns for structs less than 32 bytes +(following ia64 return value ABI [1]). Subroutine does roughly the +following: + +``` + mov [sp+0] = r8 + mov [sp+8] = r9 + mov [sp+16] = r10 + mov [sp+24] = r11 + memcpy(destination, source=sp, 12); +``` + +The problem: ia64 ABI guarantees that top 16 bytes of stack are +scratch space for callee function. Thus it can clobber it. [1] +says (7.1 Procedure Frames): +""" +* Scratch area. This 16-byte region is provided as scratch storage + for procedures that are called by the current procedure. Leaf + procedures do not need to allocate this region. A procedure may + use the 16 bytes at the top of its own frame as scratch memory, + but the contents of this area are not preserved by a procedure call. +""" + +In our case 16 top bytes are clobbered by a PLT resolver when memcpy() +is called for the first time. As a result memcpy implementation reads +already clobbered data frop top of stack. + +The fix is simple: allocate 16 bytes of scrats space prior to memcpy() +call. + +[1]: https://www.intel.com/content/dam/www/public/us/en/documents/guides/itanium-software-runtime-architecture-guide.pdf + +Bug: https://bugs.gentoo.org/634190 +Signed-off-by: Sergei Trofimovich +--- + src/ia64/unix.S | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/src/ia64/unix.S b/src/ia64/unix.S +index 4733377..e2547e0 100644 +--- a/src/ia64/unix.S ++++ b/src/ia64/unix.S +@@ -175,7 +175,6 @@ ffi_call_unix: + ;; + + .Lst_small_struct: +- add sp = -16, sp + cmp.lt p6, p0 = 8, in3 + cmp.lt p7, p0 = 16, in3 + cmp.lt p8, p0 = 24, in3 +@@ -191,6 +190,12 @@ ffi_call_unix: + (p8) st8 [r18] = r11 + mov out1 = sp + mov out2 = in3 ++ ;; ++ // ia64 software calling convention requires ++ // top 16 bytes of stack to be scratch space ++ // PLT resolver uses that scratch space at ++ // 'memcpy' symbol reolution time ++ add sp = -16, sp + br.call.sptk.many b0 = memcpy# + ;; + mov ar.pfs = loc0 +-- +2.16.1 + diff --git a/dev-libs/libffi/libffi-3.2.1-r2.ebuild b/dev-libs/libffi/libffi-3.2.1-r2.ebuild new file mode 100644 index 000000000000..533e9afa08e2 --- /dev/null +++ b/dev-libs/libffi/libffi-3.2.1-r2.ebuild @@ -0,0 +1,70 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +inherit eutils libtool multilib multilib-minimal toolchain-funcs + +DESCRIPTION="a portable, high level programming interface to various calling conventions" +HOMEPAGE="https://sourceware.org/libffi/" +SRC_URI="ftp://sourceware.org/pub/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-fbsd ~x86-fbsd ~amd64-linux ~arm-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="debug pax_kernel static-libs test" + +RDEPEND="abi_x86_32? ( !<=app-emulation/emul-linux-x86-baselibs-20130224-r1 + !app-emulation/emul-linux-x86-baselibs[-abi_x86_32(-)] )" +DEPEND="test? ( dev-util/dejagnu )" + +DOCS="ChangeLog* README" + +PATCHES=( + "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044 + "${FILESDIR}"/${PN}-3.2.1-complex_alpha.patch + "${FILESDIR}"/${PN}-3.1-darwin-x32.patch + "${FILESDIR}"/${PN}-3.2.1-complex-ia64.patch + "${FILESDIR}"/${PN}-3.2.1-include-path.patch + "${FILESDIR}"/${PN}-3.2.1-include-path-autogen.patch + "${FILESDIR}"/${PN}-3.2.1-ia64-small-struct.patch #634190 +) + +ECONF_SOURCE=${S} + +pkg_setup() { + # Check for orphaned libffi, see https://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() { + default + + sed -i -e 's:@toolexeclibdir@:$(libdir):g' Makefile.in || die #462814 + elibtoolize +} + +multilib_src_configure() { + use userland_BSD && export HOST="${CHOST}" + # python does not like miltilib-wrapped headers: bug #643582 + # thus we install includes into ABI-specific paths + local includes="${EPREFIX}"/usr/$(get_libdir)/${P}/include/ + econf \ + $(use_enable static-libs static) \ + $(use_enable pax_kernel pax_emutramp) \ + $(use_enable debug) \ + --includedir="${includes}" +} + +multilib_src_install_all() { + prune_libtool_files + einstalldocs +} -- cgit v1.2.3