Gentoo Archives: gentoo-commits

From: Jory Pratt <anarchy@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/musl:master commit in: sys-libs/libunwind/files/, sys-libs/libunwind/
Date: Sun, 01 Jul 2018 03:50:17
Message-Id: 1530416965.bfc4cb8125638cda99e63d699d2afe787cf055b3.anarchy@gentoo
1 commit: bfc4cb8125638cda99e63d699d2afe787cf055b3
2 Author: Jory A. Pratt <anarchy <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 1 03:49:25 2018 +0000
4 Commit: Jory Pratt <anarchy <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 1 03:49:25 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/musl.git/commit/?id=bfc4cb81
7
8 sys-libs/libunwind: Only include execinfo.h if it is avaliable on the
9 system.
10
11 sys-libs/libunwind/Manifest | 1 +
12 .../files/libunwind-1.2-coredump-regs.patch | 16 ++++
13 .../files/libunwind-1.2-ia64-missing.patch | 93 +++++++++++++++++++
14 .../files/libunwind-1.2-ia64-ptrace-coredump.patch | 34 +++++++
15 .../files/libunwind-1.2-ia64-undwarf.patch | 17 ++++
16 .../files/libunwind-1.2.1-fix_version_macros.patch | 13 +++
17 ....2.1-only-include-execinfo_h-if-avaliable.patch | 52 +++++++++++
18 sys-libs/libunwind/libunwind-1.2.1-r1.ebuild | 103 +++++++++++++++++++++
19 sys-libs/libunwind/metadata.xml | 12 +++
20 9 files changed, 341 insertions(+)
21
22 diff --git a/sys-libs/libunwind/Manifest b/sys-libs/libunwind/Manifest
23 new file mode 100644
24 index 0000000..4155a10
25 --- /dev/null
26 +++ b/sys-libs/libunwind/Manifest
27 @@ -0,0 +1 @@
28 +DIST libunwind-1.2.1.tar.gz 780774 BLAKE2B a5be4142e1e4932231023bdec2ab3ecd6b707faf2d32d2b571239252a1d0fb6a273a6a46c4a107db63f74f7b54c0c54cf252b8b79ad53216333ba7bcf63147a1 SHA512 af7c280d2a963779a4a2711887618bc96383011e4e5d52e4085aa7fb351e55e357468f6ff85e66a216f1c6826538f498335a917a5970575c93be74c96316319b
29
30 diff --git a/sys-libs/libunwind/files/libunwind-1.2-coredump-regs.patch b/sys-libs/libunwind/files/libunwind-1.2-coredump-regs.patch
31 new file mode 100644
32 index 0000000..3ddc610
33 --- /dev/null
34 +++ b/sys-libs/libunwind/files/libunwind-1.2-coredump-regs.patch
35 @@ -0,0 +1,16 @@
36 +https://bugs.gentoo.org/586092
37 +
38 +this might not be correct, but at least it builds, and doesn't crash
39 +
40 +--- a/src/coredump/_UCD_access_reg_linux.c
41 ++++ b/src/coredump/_UCD_access_reg_linux.c
42 +@@ -51,6 +51,9 @@ _UCD_access_reg (unw_addr_space_t as,
43 + #elif defined(UNW_TARGET_TILEGX)
44 + if (regnum < 0 || regnum > UNW_TILEGX_CFA)
45 + goto badreg;
46 ++#elif defined(UNW_TARGET_IA64) || defined(UNW_TARGET_HPPA) || defined(UNW_TARGET_PPC32) || defined(UNW_TARGET_PPC64)
47 ++ if (regnum < 0 || regnum >= ARRAY_SIZE(ui->prstatus->pr_reg))
48 ++ goto badreg;
49 + #else
50 + #if defined(UNW_TARGET_MIPS)
51 + static const uint8_t remap_regs[] =
52
53 diff --git a/sys-libs/libunwind/files/libunwind-1.2-ia64-missing.patch b/sys-libs/libunwind/files/libunwind-1.2-ia64-missing.patch
54 new file mode 100644
55 index 0000000..e15250b
56 --- /dev/null
57 +++ b/sys-libs/libunwind/files/libunwind-1.2-ia64-missing.patch
58 @@ -0,0 +1,93 @@
59 +Original libunwind release is missing a few ia64-specific files in tarball.
60 +diff --git a/src/ia64/mk_Gcursor_i.c b/src/ia64/mk_Gcursor_i.c
61 +new file mode 100644
62 +index 0000000..67b14d5
63 +--- /dev/null
64 ++++ b/src/ia64/mk_Gcursor_i.c
65 +@@ -0,0 +1,65 @@
66 ++/* libunwind - a platform-independent unwind library
67 ++ Copyright (C) 2003 Hewlett-Packard Co
68 ++ Contributed by David Mosberger-Tang <davidm@××××××.com>
69 ++
70 ++This file is part of libunwind.
71 ++
72 ++Permission is hereby granted, free of charge, to any person obtaining
73 ++a copy of this software and associated documentation files (the
74 ++"Software"), to deal in the Software without restriction, including
75 ++without limitation the rights to use, copy, modify, merge, publish,
76 ++distribute, sublicense, and/or sell copies of the Software, and to
77 ++permit persons to whom the Software is furnished to do so, subject to
78 ++the following conditions:
79 ++
80 ++The above copyright notice and this permission notice shall be
81 ++included in all copies or substantial portions of the Software.
82 ++
83 ++THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
84 ++EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
85 ++MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
86 ++NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
87 ++LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
88 ++OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
89 ++WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
90 ++
91 ++/* Utility to generate cursor_i.h. */
92 ++
93 ++#include "libunwind_i.h"
94 ++
95 ++#ifdef offsetof
96 ++# undef offsetof
97 ++#endif
98 ++
99 ++#define offsetof(type,field) ((char *) &((type *) 0)->field - (char *) 0)
100 ++
101 ++#define OFFSET(sym, offset) \
102 ++ asm volatile("\n->" #sym " %0" : : "i" (offset))
103 ++
104 ++int
105 ++main (void)
106 ++{
107 ++ OFFSET("IP_OFF", offsetof (struct cursor, ip));
108 ++ OFFSET("PR_OFF", offsetof (struct cursor, pr));
109 ++ OFFSET("BSP_OFF", offsetof (struct cursor, bsp));
110 ++ OFFSET("PSP_OFF", offsetof (struct cursor, psp));
111 ++ OFFSET("PFS_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_PFS]));
112 ++ OFFSET("RNAT_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_RNAT]));
113 ++ OFFSET("UNAT_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_UNAT]));
114 ++ OFFSET("LC_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_LC]));
115 ++ OFFSET("FPSR_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_FPSR]));
116 ++ OFFSET("B1_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B1]));
117 ++ OFFSET("B2_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B2]));
118 ++ OFFSET("B3_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B3]));
119 ++ OFFSET("B4_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B4]));
120 ++ OFFSET("B5_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_B5]));
121 ++ OFFSET("F2_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F2]));
122 ++ OFFSET("F3_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F3]));
123 ++ OFFSET("F4_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F4]));
124 ++ OFFSET("F5_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F5]));
125 ++ OFFSET("FR_LOC_OFF", offsetof (struct cursor, loc[IA64_REG_F16]));
126 ++ OFFSET("LOC_SIZE",
127 ++ (offsetof (struct cursor, loc[1]) - offsetof (struct cursor, loc[0])));
128 ++ OFFSET("SIGCONTEXT_ADDR_OFF", offsetof (struct cursor, sigcontext_addr));
129 ++ return 0;
130 ++}
131 +diff --git a/src/ia64/mk_Lcursor_i.c b/src/ia64/mk_Lcursor_i.c
132 +new file mode 100644
133 +index 0000000..aee2e7e
134 +--- /dev/null
135 ++++ b/src/ia64/mk_Lcursor_i.c
136 +@@ -0,0 +1,2 @@
137 ++#define UNW_LOCAL_ONLY
138 ++#include "mk_Gcursor_i.c"
139 +diff --git a/src/ia64/mk_cursor_i b/src/ia64/mk_cursor_i
140 +new file mode 100755
141 +index 0000000..9211f91
142 +--- /dev/null
143 ++++ b/src/ia64/mk_cursor_i
144 +@@ -0,0 +1,7 @@
145 ++#!/bin/sh
146 ++test -z "$1" && exit 1
147 ++echo "/* GENERATED */"
148 ++echo "#ifndef cursor_i_h"
149 ++echo "#define cursor_i_h"
150 ++sed -ne 's/^->"\(\S*\)" \(\d*\)/#define \1 \2/p' < $1 || exit $?
151 ++echo "#endif"
152
153 diff --git a/sys-libs/libunwind/files/libunwind-1.2-ia64-ptrace-coredump.patch b/sys-libs/libunwind/files/libunwind-1.2-ia64-ptrace-coredump.patch
154 new file mode 100644
155 index 0000000..3785d88
156 --- /dev/null
157 +++ b/sys-libs/libunwind/files/libunwind-1.2-ia64-ptrace-coredump.patch
158 @@ -0,0 +1,34 @@
159 +Fix build failure on ia64.
160 + coredump/_UPT_get_dyn_info_list_addr.c
161 +is almost identical to
162 + ptrace/_UPT_get_dyn_info_list_addr.c
163 +It's clearly an __ia64 implementation copy.
164 +diff --git a/src/coredump/_UPT_get_dyn_info_list_addr.c b/src/coredump/_UPT_get_dyn_info_list_addr.c
165 +index 0d11905..176b146 100644
166 +--- a/src/coredump/_UPT_get_dyn_info_list_addr.c
167 ++++ b/src/coredump/_UPT_get_dyn_info_list_addr.c
168 +@@ -31,2 +31,3 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
169 + # include "os-linux.h"
170 ++# include "../ptrace/_UPT_internal.h"
171 +
172 +@@ -40,3 +41,2 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
173 + char path[PATH_MAX];
174 +- unw_dyn_info_t *di;
175 + unw_word_t res;
176 +@@ -50,5 +50,5 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
177 +
178 +- invalidate_edi (&ui->edi);
179 ++ invalidate_edi(&ui->edi);
180 +
181 +- if (elf_map_image (&ui->ei, path) < 0)
182 ++ if (elf_map_image (&ui->edi.ei, path) < 0)
183 + /* ignore unmappable stuff like "/SYSV00001b58 (deleted)" */
184 +@@ -58,6 +58,5 @@ get_list_addr (unw_addr_space_t as, unw_word_t *dil_addr, void *arg,
185 +
186 +- di = tdep_find_unwind_table (&ui->edi, as, path, lo, off);
187 +- if (di)
188 ++ if (tdep_find_unwind_table (&ui->edi, as, path, lo, off, 0) > 0)
189 + {
190 +- res = _Uia64_find_dyn_list (as, di, arg);
191 ++ res = _Uia64_find_dyn_list (as, &ui->edi.di_cache, arg);
192 + if (res && count++ == 0)
193
194 diff --git a/sys-libs/libunwind/files/libunwind-1.2-ia64-undwarf.patch b/sys-libs/libunwind/files/libunwind-1.2-ia64-undwarf.patch
195 new file mode 100644
196 index 0000000..1e3e248
197 --- /dev/null
198 +++ b/sys-libs/libunwind/files/libunwind-1.2-ia64-undwarf.patch
199 @@ -0,0 +1,17 @@
200 +diff --git a/src/mi/Gget_proc_name.c b/src/mi/Gget_proc_name.c
201 +index 5376f82..64d2503 100644
202 +--- a/src/mi/Gget_proc_name.c
203 ++++ b/src/mi/Gget_proc_name.c
204 +@@ -106,8 +106,12 @@ unw_get_proc_name (unw_cursor_t *cursor, char *buf, size_t buf_len,
205 + ip = tdep_get_ip (c);
206 ++#if !defined(__ia64)
207 + if (c->dwarf.use_prev_instr)
208 + --ip;
209 ++#endif
210 + error = get_proc_name (tdep_get_as (c), ip, buf, buf_len, offp,
211 + tdep_get_as_arg (c));
212 ++#if !defined(__ia64)
213 + if (c->dwarf.use_prev_instr && offp != NULL && error == 0)
214 + *offp += 1;
215 ++#endif
216 + return error;
217
218 diff --git a/sys-libs/libunwind/files/libunwind-1.2.1-fix_version_macros.patch b/sys-libs/libunwind/files/libunwind-1.2.1-fix_version_macros.patch
219 new file mode 100644
220 index 0000000..6320293
221 --- /dev/null
222 +++ b/sys-libs/libunwind/files/libunwind-1.2.1-fix_version_macros.patch
223 @@ -0,0 +1,13 @@
224 +diff --git a/configure.ac b/configure.ac
225 +index a254bbe..fe0247b 100644
226 +--- a/configure.ac
227 ++++ b/configure.ac
228 +@@ -1,6 +1,6 @@
229 + define(pkg_major, 1)
230 +-define(pkg_minor, 2.1)
231 +-define(pkg_extra, )
232 ++define(pkg_minor, 2)
233 ++define(pkg_extra, 1)
234 + define(pkg_maintainer, libunwind-devel@××××××.org)
235 + define(mkvers, $1.$2$3)
236 + dnl Process this file with autoconf to produce a configure script.
237
238 diff --git a/sys-libs/libunwind/files/libunwind-1.2.1-only-include-execinfo_h-if-avaliable.patch b/sys-libs/libunwind/files/libunwind-1.2.1-only-include-execinfo_h-if-avaliable.patch
239 new file mode 100644
240 index 0000000..cc42b15
241 --- /dev/null
242 +++ b/sys-libs/libunwind/files/libunwind-1.2.1-only-include-execinfo_h-if-avaliable.patch
243 @@ -0,0 +1,52 @@
244 +From 0f3f41a86842f2b19aa07af5242cb775ef9b20d3 Mon Sep 17 00:00:00 2001
245 +From: "Jory A. Pratt" <anarchy@g.o>
246 +Date: Sat, 30 Jun 2018 22:44:22 -0500
247 +Subject: [PATCH] Only include execinfo.h where avaliable
248 +
249 +Signed-off-by: Jory A. Pratt <anarchy@g.o>
250 +---
251 + tests/test-coredump-unwind.c | 8 ++++++--
252 + 1 file changed, 6 insertions(+), 2 deletions(-)
253 +
254 +diff --git a/tests/test-coredump-unwind.c b/tests/test-coredump-unwind.c
255 +index 5254708..33f92b0 100644
256 +--- a/tests/test-coredump-unwind.c
257 ++++ b/tests/test-coredump-unwind.c
258 +@@ -57,7 +57,9 @@
259 + #include <grp.h>
260 +
261 + /* For SIGSEGV handler code */
262 ++#if HAVE_EXECINFO_H
263 + #include <execinfo.h>
264 ++#endif
265 + #include <sys/ucontext.h>
266 +
267 + #include <libunwind-coredump.h>
268 +@@ -202,7 +204,7 @@ void die_out_of_memory(void)
269 + /* End of utility logging functions */
270 +
271 +
272 +-
273 ++#if HAVE_EXECINFO_H
274 + static
275 + void handle_sigsegv(int sig, siginfo_t *info, void *ucontext)
276 + {
277 +@@ -249,12 +251,14 @@ void handle_sigsegv(int sig, siginfo_t *info, void *ucontext)
278 +
279 + _exit(1);
280 + }
281 +-
282 ++#endif
283 + static void install_sigsegv_handler(void)
284 + {
285 + struct sigaction sa;
286 + memset(&sa, 0, sizeof(sa));
287 ++#if HAVE_EXECINFO_H
288 + sa.sa_sigaction = handle_sigsegv;
289 ++#endif
290 + sa.sa_flags = SA_SIGINFO;
291 + sigaction(SIGSEGV, &sa, NULL);
292 + sigaction(SIGILL, &sa, NULL);
293 +--
294 +2.18.0
295 +
296
297 diff --git a/sys-libs/libunwind/libunwind-1.2.1-r1.ebuild b/sys-libs/libunwind/libunwind-1.2.1-r1.ebuild
298 new file mode 100644
299 index 0000000..a4690fc
300 --- /dev/null
301 +++ b/sys-libs/libunwind/libunwind-1.2.1-r1.ebuild
302 @@ -0,0 +1,103 @@
303 +# Copyright 1999-2018 Gentoo Foundation
304 +# Distributed under the terms of the GNU General Public License v2
305 +
306 +EAPI=6
307 +
308 +MY_PV=${PV/_/-}
309 +MY_P=${PN}-${MY_PV}
310 +inherit autotools eutils libtool multilib-minimal
311 +
312 +DESCRIPTION="Portable and efficient API to determine the call-chain of a program"
313 +HOMEPAGE="https://savannah.nongnu.org/projects/libunwind"
314 +SRC_URI="mirror://nongnu/libunwind/${MY_P}.tar.gz"
315 +
316 +LICENSE="MIT"
317 +SLOT="7"
318 +KEYWORDS="amd64 arm arm64 hppa ia64 ~mips ppc ppc64 x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
319 +IUSE="debug debug-frame doc libatomic lzma +static-libs"
320 +
321 +RESTRICT="test" # half of tests are broken (toolchain version dependent)
322 +
323 +# We just use the header from libatomic.
324 +RDEPEND="lzma? ( app-arch/xz-utils )"
325 +DEPEND="${RDEPEND}
326 + libatomic? ( dev-libs/libatomic_ops )"
327 +
328 +S="${WORKDIR}/${MY_P}"
329 +
330 +MULTILIB_WRAPPED_HEADERS=(
331 + /usr/include/libunwind.h
332 +
333 + # see libunwind.h for the full list of arch-specific headers
334 + /usr/include/libunwind-aarch64.h
335 + /usr/include/libunwind-arm.h
336 + /usr/include/libunwind-hppa.h
337 + /usr/include/libunwind-ia64.h
338 + /usr/include/libunwind-mips.h
339 + /usr/include/libunwind-ppc32.h
340 + /usr/include/libunwind-ppc64.h
341 + /usr/include/libunwind-sh.h
342 + /usr/include/libunwind-tilegx.h
343 + /usr/include/libunwind-x86.h
344 + /usr/include/libunwind-x86_64.h
345 +)
346 +
347 +PATCHES=(
348 + "${FILESDIR}"/${PN}-1.2-coredump-regs.patch #586092
349 + "${FILESDIR}"/${PN}-1.2-ia64-undwarf.patch
350 + "${FILESDIR}"/${PN}-1.2-ia64-ptrace-coredump.patch
351 + "${FILESDIR}"/${PN}-1.2-ia64-missing.patch
352 + "${FILESDIR}"/${PN}-1.2.1-fix_version_macros.patch
353 + "${FILESDIR}"/${PN}-1.2.1-only-include-execinfo_h-if-avaliable.patch
354 +)
355 +
356 +src_prepare() {
357 + default
358 + chmod +x src/ia64/mk_cursor_i || die
359 + # Since we have tests disabled via RESTRICT, disable building in the subdir
360 + # entirely. This worksaround some build errors too. #484846
361 + sed -i -e '/^SUBDIRS/s:tests::' Makefile.in || die
362 +
363 + elibtoolize
364 + eautoreconf
365 +}
366 +
367 +multilib_src_configure() {
368 + # --enable-cxx-exceptions: always enable it, headers provide the interface
369 + # and on some archs it is disabled by default causing a mismatch between the
370 + # API and the ABI, bug #418253
371 + # conservative-checks: validate memory addresses before use; as of 1.0.1,
372 + # only x86_64 supports this, yet may be useful for debugging, couple it with
373 + # debug useflag.
374 + ECONF_SOURCE="${S}" \
375 + ac_cv_header_atomic_ops_h=$(usex libatomic) \
376 + econf \
377 + --enable-cxx-exceptions \
378 + --enable-coredump \
379 + --enable-ptrace \
380 + --enable-setjmp \
381 + $(use_enable debug-frame) \
382 + $(use_enable doc documentation) \
383 + $(use_enable lzma minidebuginfo) \
384 + $(use_enable static-libs static) \
385 + $(use_enable debug conservative_checks) \
386 + $(use_enable debug)
387 +}
388 +
389 +multilib_src_compile() {
390 + # Bug 586208
391 + CCACHE_NODIRECT=1 default
392 +}
393 +
394 +multilib_src_test() {
395 + # Explicitly allow parallel build of tests.
396 + # Sandbox causes some tests to freak out.
397 + SANDBOX_ON=0 emake check
398 +}
399 +
400 +multilib_src_install() {
401 + default
402 + # libunwind-ptrace.a (and libunwind-ptrace.h) is separate API and without
403 + # shared library, so we keep it in any case
404 + use static-libs || find "${ED}"usr '(' -name 'libunwind-generic.a' -o -name 'libunwind*.la' ')' -delete
405 +}
406
407 diff --git a/sys-libs/libunwind/metadata.xml b/sys-libs/libunwind/metadata.xml
408 new file mode 100644
409 index 0000000..95faca4
410 --- /dev/null
411 +++ b/sys-libs/libunwind/metadata.xml
412 @@ -0,0 +1,12 @@
413 +<?xml version="1.0" encoding="UTF-8"?>
414 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
415 +<pkgmetadata>
416 + <maintainer type="project">
417 + <email>toolchain@g.o</email>
418 + <name>Gentoo Toolchain Project</name>
419 + </maintainer>
420 + <use>
421 + <flag name="debug-frame">Adds support for DWARF .debug_frame section: Use the information from this section if available</flag>
422 + <flag name="libatomic">Use libatomic instead of builtin atomic operations</flag>
423 + </use>
424 +</pkgmetadata>