Gentoo Archives: gentoo-commits

From: Sergei Trofimovich <slyfox@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libffi/, dev-libs/libffi/files/
Date: Sun, 30 Sep 2018 23:07:31
Message-Id: 1538348839.6d8e37b7787e68f6b3aafb55b81f2781c54f8665.slyfox@gentoo
1 commit: 6d8e37b7787e68f6b3aafb55b81f2781c54f8665
2 Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
3 AuthorDate: Sun Sep 30 23:01:33 2018 +0000
4 Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org>
5 CommitDate: Sun Sep 30 23:07:19 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d8e37b7
7
8 dev-libs/libffi: bump up to 3.3_rc0
9
10 Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org>
11 Package-Manager: Portage-2.3.50, Repoman-2.3.11
12
13 dev-libs/libffi/Manifest | 1 +
14 .../files/libffi-3.3_rc0-hppa-no-TEXTREL.patch | 93 ++++++++++++++++++++++
15 dev-libs/libffi/libffi-3.3_rc0.ebuild | 64 +++++++++++++++
16 3 files changed, 158 insertions(+)
17
18 diff --git a/dev-libs/libffi/Manifest b/dev-libs/libffi/Manifest
19 index f77899f0229..d70d8b54808 100644
20 --- a/dev-libs/libffi/Manifest
21 +++ b/dev-libs/libffi/Manifest
22 @@ -1 +1,2 @@
23 DIST libffi-3.2.1.tar.gz 940837 BLAKE2B d202ccaa185acfd2476ed2a9b011891507cd8efbbda60f67c583268d1563853442ed829acecbf81c9b6b9a930345780bb7a4bd80e71e50ef544c7f4eab8cb01f SHA512 980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483
24 +DIST libffi-3.3-rc0.tar.gz 1084854 BLAKE2B 2c38d60f17ef52bcf270178c13c218f6ee320c9785091621d4689bcf6cee31d07eaaca12790965e1ae3ad71ad2c408342743968bf1d23f81a07fbdf6cfd55b90 SHA512 e6e695d32cd6eb7d65983f32986fccdfc786a593d2ea18af30ce741f58cfa1eb264b1a8d09df5084cb916001aea15187b005c2149a0620a44397a4453b6137d4
25
26 diff --git a/dev-libs/libffi/files/libffi-3.3_rc0-hppa-no-TEXTREL.patch b/dev-libs/libffi/files/libffi-3.3_rc0-hppa-no-TEXTREL.patch
27 new file mode 100644
28 index 00000000000..c6286f34990
29 --- /dev/null
30 +++ b/dev-libs/libffi/files/libffi-3.3_rc0-hppa-no-TEXTREL.patch
31 @@ -0,0 +1,93 @@
32 +From 955e3c56459556284cf4a7fb23c51f9d310be80c Mon Sep 17 00:00:00 2001
33 +From: Sergei Trofimovich <slyfox@g.o>
34 +Date: Sat, 19 May 2018 10:49:07 +0100
35 +Subject: [PATCH] hppa: avoid TEXTREL in .eh_frame section
36 +
37 +Before the change hand-crafted .eh_frame section contained
38 +ABS relocation and caused TEXTREL tag to be emitted:
39 +
40 +```
41 +$ ./configure --host=hppa2.0-unknown-linux-gnu LDFLAGS=-Wl,-z,text
42 +$ make
43 +...
44 +/usr/libexec/gcc/hppa2.0-unknown-linux-gnu/ld:
45 + read-only segment has dynamic relocations.
46 +```
47 +
48 +Link failure is caused by absolute address of FDEs
49 +encoded into .eh_frame entries.
50 +
51 +Fixed TEXTREL by using pcrel (instead of ABS) encoding
52 +for absolute addresses (__PIC__ code) by adding augmentation
53 +information ("zR" CIE type).
54 +
55 +All tests still pass on hppa2.0. The specific tests that still pass
56 +and exercise this code path:
57 + testsuite/libffi.call/unwindtest.cc
58 + testsuite/libffi.call/unwindtest_ffi_call.cc
59 +
60 +Signed-off-by: Sergei Trofimovich <slyfox@g.o>
61 +---
62 + src/pa/linux.S | 25 +++++++++++++++++++++++--
63 + 1 file changed, 23 insertions(+), 2 deletions(-)
64 +
65 +diff --git a/src/pa/linux.S b/src/pa/linux.S
66 +index f11ae76..ab04c75 100644
67 +--- a/src/pa/linux.S
68 ++++ b/src/pa/linux.S
69 +@@ -297,10 +297,18 @@ ffi_closure_pa32:
70 + .LSCIE1:
71 + .word 0x0 ;# CIE Identifier Tag
72 + .byte 0x1 ;# CIE Version
73 ++#ifdef __PIC__
74 ++ .ascii "zR\0" ;# CIE Augmentation: 'z' - data, 'R' - DW_EH_PE_... data
75 ++#else
76 + .ascii "\0" ;# CIE Augmentation
77 ++#endif
78 + .uleb128 0x1 ;# CIE Code Alignment Factor
79 + .sleb128 4 ;# CIE Data Alignment Factor
80 + .byte 0x2 ;# CIE RA Column
81 ++#ifdef __PIC__
82 ++ .uleb128 0x1 ;# Augmentation size
83 ++ .byte 0x1b ;# FDE Encoding (DW_EH_PE_pcrel|DW_EH_PE_sdata4)
84 ++#endif
85 + .byte 0xc ;# DW_CFA_def_cfa
86 + .uleb128 0x1e
87 + .uleb128 0x0
88 +@@ -310,9 +318,15 @@ ffi_closure_pa32:
89 + .word .LEFDE1-.LASFDE1 ;# FDE Length
90 + .LASFDE1:
91 + .word .LASFDE1-.Lframe1 ;# FDE CIE offset
92 +- .word .LFB1 ;# FDE initial location
93 ++#ifdef __PIC__
94 ++ .word .LFB1-. ;# FDE initial location
95 ++#else
96 ++ .word .LFB1 ;# FDE initial location
97 ++#endif
98 + .word .LFE1-.LFB1 ;# FDE address range
99 +-
100 ++#ifdef __PIC__
101 ++ .uleb128 0x0 ;# Augmentation size: no data
102 ++#endif
103 + .byte 0x4 ;# DW_CFA_advance_loc4
104 + .word .LCFI11-.LFB1
105 + .byte 0x83 ;# DW_CFA_offset, column 0x3
106 +@@ -338,8 +352,15 @@ ffi_closure_pa32:
107 + .word .LEFDE2-.LASFDE2 ;# FDE Length
108 + .LASFDE2:
109 + .word .LASFDE2-.Lframe1 ;# FDE CIE offset
110 ++#ifdef __PIC__
111 ++ .word .LFB2-. ;# FDE initial location
112 ++#else
113 + .word .LFB2 ;# FDE initial location
114 ++#endif
115 + .word .LFE2-.LFB2 ;# FDE address range
116 ++#ifdef __PIC__
117 ++ .uleb128 0x0 ;# Augmentation size: no data
118 ++#endif
119 + .byte 0x4 ;# DW_CFA_advance_loc4
120 + .word .LCFI21-.LFB2
121 + .byte 0x83 ;# DW_CFA_offset, column 0x3
122 +--
123 +2.19.0
124 +
125
126 diff --git a/dev-libs/libffi/libffi-3.3_rc0.ebuild b/dev-libs/libffi/libffi-3.3_rc0.ebuild
127 new file mode 100644
128 index 00000000000..0a31487e51f
129 --- /dev/null
130 +++ b/dev-libs/libffi/libffi-3.3_rc0.ebuild
131 @@ -0,0 +1,64 @@
132 +# Copyright 1999-2018 Gentoo Authors
133 +# Distributed under the terms of the GNU General Public License v2
134 +
135 +EAPI=7
136 +inherit multilib multilib-minimal toolchain-funcs
137 +
138 +MY_PV=${PV/_rc/-rc}
139 +MY_P=${PN}-${MY_PV}
140 +
141 +DESCRIPTION="a portable, high level programming interface to various calling conventions"
142 +HOMEPAGE="https://sourceware.org/libffi/"
143 +SRC_URI="https://github.com/libffi/libffi/releases/download/v${MY_PV}/${MY_P}.tar.gz"
144 +
145 +LICENSE="MIT"
146 +SLOT="0/7" # SONAME=libffi.so.7
147 +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 ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
148 +IUSE="debug pax_kernel static-libs test"
149 +
150 +RDEPEND=""
151 +DEPEND=""
152 +BDEPEND="test? ( dev-util/dejagnu )"
153 +
154 +DOCS="ChangeLog* README.md"
155 +
156 +PATCHES=(
157 + "${FILESDIR}"/${PN}-3.2.1-o-tmpfile-eacces.patch #529044
158 + "${FILESDIR}"/${PN}-3.3_rc0-hppa-no-TEXTREL.patch
159 +)
160 +
161 +S=${WORKDIR}/${MY_P}
162 +
163 +ECONF_SOURCE=${S}
164 +
165 +pkg_setup() {
166 + # Check for orphaned libffi, see https://bugs.gentoo.org/354903 for example
167 + if [[ ${ROOT} == "/" && ${EPREFIX} == "" ]] && ! has_version ${CATEGORY}/${PN}; then
168 + local base="${T}"/conftest
169 + echo 'int main() { }' > "${base}".c
170 + $(tc-getCC) -o "${base}" "${base}".c -lffi >&/dev/null
171 + if [ $? -eq 0 ]; then
172 + eerror "The linker reported linking against -lffi to be working while it shouldn't have."
173 + eerror "This is wrong and you should find and delete the old copy of libffi before continuing."
174 + die "The system is in inconsistent state with unknown libffi installed."
175 + fi
176 + fi
177 +}
178 +
179 +multilib_src_configure() {
180 + use userland_BSD && export HOST="${CHOST}"
181 + econf \
182 + --includedir="${EPREFIX}"/usr/$(get_libdir)/${P}/include \
183 + $(use_enable static-libs static) \
184 + $(use_enable pax_kernel pax_emutramp) \
185 + $(use_enable debug)
186 +}
187 +
188 +multilib_src_test() {
189 + emake check RUNTESTFLAGS='-a -v'
190 +}
191 +
192 +multilib_src_install_all() {
193 + find "${ED}" -name "*.la" -delete || die
194 + einstalldocs
195 +}