1 |
commit: da814d23d8c572f796fff850235402bf95d1d7aa |
2 |
Author: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jul 30 15:25:23 2021 +0000 |
4 |
Commit: Sergei Trofimovich <slyfox <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jul 30 15:25:49 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=da814d23 |
7 |
|
8 |
sys-devel/gdb: backport DW_LLE_start_end fix (for riscv64) |
9 |
|
10 |
Reported-by: Marek Szuba |
11 |
Closes: https://bugs.gentoo.org/805215 |
12 |
Bug: https://sourceware.org/PR27999 |
13 |
Package-Manager: Portage-3.0.20, Repoman-3.0.3 |
14 |
Signed-off-by: Sergei Trofimovich <slyfox <AT> gentoo.org> |
15 |
|
16 |
sys-devel/gdb/files/gdb-10.2-DW_LLE-riscv64.patch | 41 ++++ |
17 |
sys-devel/gdb/gdb-10.2-r1.ebuild | 261 ++++++++++++++++++++++ |
18 |
2 files changed, 302 insertions(+) |
19 |
|
20 |
diff --git a/sys-devel/gdb/files/gdb-10.2-DW_LLE-riscv64.patch b/sys-devel/gdb/files/gdb-10.2-DW_LLE-riscv64.patch |
21 |
new file mode 100644 |
22 |
index 00000000000..0d3e8c5cb94 |
23 |
--- /dev/null |
24 |
+++ b/sys-devel/gdb/files/gdb-10.2-DW_LLE-riscv64.patch |
25 |
@@ -0,0 +1,41 @@ |
26 |
+https://sourceware.org/git/?p=binutils-gdb.git;a=patch;h=80d1206d7fea6eb756183e2825abdfd0f00cd976 |
27 |
+https://sourceware.org/PR27999 |
28 |
+ |
29 |
+From 80d1206d7fea6eb756183e2825abdfd0f00cd976 Mon Sep 17 00:00:00 2001 |
30 |
+From: Andreas Schwab <schwab@××××.de> |
31 |
+Date: Mon, 21 Jun 2021 11:38:23 +0200 |
32 |
+Subject: [PATCH] gdb: Support DW_LLE_start_end |
33 |
+ |
34 |
+Without that it is impossible to debug on riscv64. |
35 |
+ |
36 |
+--- a/gdb/dwarf2/loc.c |
37 |
++++ b/gdb/dwarf2/loc.c |
38 |
+@@ -255,9 +255,27 @@ decode_debug_loclists_addresses (dwarf2_per_cu_data *per_cu, |
39 |
+ *new_ptr = loc_ptr; |
40 |
+ return DEBUG_LOC_OFFSET_PAIR; |
41 |
+ |
42 |
++ case DW_LLE_start_end: |
43 |
++ if (loc_ptr + 2 * addr_size > buf_end) |
44 |
++ return DEBUG_LOC_BUFFER_OVERFLOW; |
45 |
++ |
46 |
++ if (signed_addr_p) |
47 |
++ *low = extract_signed_integer (loc_ptr, addr_size, byte_order); |
48 |
++ else |
49 |
++ *low = extract_unsigned_integer (loc_ptr, addr_size, byte_order); |
50 |
++ |
51 |
++ loc_ptr += addr_size; |
52 |
++ if (signed_addr_p) |
53 |
++ *high = extract_signed_integer (loc_ptr, addr_size, byte_order); |
54 |
++ else |
55 |
++ *high = extract_unsigned_integer (loc_ptr, addr_size, byte_order); |
56 |
++ |
57 |
++ loc_ptr += addr_size; |
58 |
++ *new_ptr = loc_ptr; |
59 |
++ return DEBUG_LOC_START_END; |
60 |
++ |
61 |
+ /* Following cases are not supported yet. */ |
62 |
+ case DW_LLE_startx_endx: |
63 |
+- case DW_LLE_start_end: |
64 |
+ case DW_LLE_default_location: |
65 |
+ default: |
66 |
+ return DEBUG_LOC_INVALID_ENTRY; |
67 |
|
68 |
diff --git a/sys-devel/gdb/gdb-10.2-r1.ebuild b/sys-devel/gdb/gdb-10.2-r1.ebuild |
69 |
new file mode 100644 |
70 |
index 00000000000..b5d5204d045 |
71 |
--- /dev/null |
72 |
+++ b/sys-devel/gdb/gdb-10.2-r1.ebuild |
73 |
@@ -0,0 +1,261 @@ |
74 |
+# Copyright 1999-2021 Gentoo Authors |
75 |
+# Distributed under the terms of the GNU General Public License v2 |
76 |
+ |
77 |
+EAPI=7 |
78 |
+PYTHON_COMPAT=( python3_{7,8,9,10} ) |
79 |
+ |
80 |
+inherit eutils flag-o-matic python-single-r1 toolchain-funcs |
81 |
+ |
82 |
+export CTARGET=${CTARGET:-${CHOST}} |
83 |
+if [[ ${CTARGET} == ${CHOST} ]] ; then |
84 |
+ if [[ ${CATEGORY} == cross-* ]] ; then |
85 |
+ export CTARGET=${CATEGORY#cross-} |
86 |
+ fi |
87 |
+fi |
88 |
+is_cross() { [[ ${CHOST} != ${CTARGET} ]] ; } |
89 |
+ |
90 |
+case ${PV} in |
91 |
+9999*) |
92 |
+ # live git tree |
93 |
+ EGIT_REPO_URI="https://sourceware.org/git/binutils-gdb.git" |
94 |
+ inherit git-r3 |
95 |
+ SRC_URI="" |
96 |
+ ;; |
97 |
+*.*.50.2???????) |
98 |
+ # weekly snapshots |
99 |
+ SRC_URI="ftp://sourceware.org/pub/gdb/snapshots/current/gdb-weekly-${PV}.tar.xz" |
100 |
+ ;; |
101 |
+*) |
102 |
+ # Normal upstream release |
103 |
+ SRC_URI="mirror://gnu/gdb/${P}.tar.xz |
104 |
+ ftp://sourceware.org/pub/gdb/releases/${P}.tar.xz" |
105 |
+ ;; |
106 |
+esac |
107 |
+ |
108 |
+PATCH_VER="" |
109 |
+PATCH_DEV="" |
110 |
+DESCRIPTION="GNU debugger" |
111 |
+HOMEPAGE="https://sourceware.org/gdb/" |
112 |
+SRC_URI="${SRC_URI} |
113 |
+ ${PATCH_DEV:+https://dev.gentoo.org/~${PATCH_DEV}/distfiles/${P}-patches-${PATCH_VER}.tar.xz} |
114 |
+ ${PATCH_VER:+mirror://gentoo/${P}-patches-${PATCH_VER}.tar.xz} |
115 |
+" |
116 |
+ |
117 |
+LICENSE="GPL-2 LGPL-2" |
118 |
+SLOT="0" |
119 |
+if [[ ${PV} != 9999* ]] ; then |
120 |
+ KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" |
121 |
+fi |
122 |
+IUSE="cet lzma multitarget nls +python +server source-highlight test vanilla xml xxhash" |
123 |
+REQUIRED_USE=" |
124 |
+ python? ( ${PYTHON_REQUIRED_USE} ) |
125 |
+" |
126 |
+ |
127 |
+# ia64 kernel crashes when gdb testsuite is running |
128 |
+RESTRICT=" |
129 |
+ ia64? ( test ) |
130 |
+ |
131 |
+ !test? ( test ) |
132 |
+" |
133 |
+ |
134 |
+RDEPEND=" |
135 |
+ dev-libs/mpfr:0= |
136 |
+ >=sys-libs/ncurses-5.2-r2:0= |
137 |
+ >=sys-libs/readline-7:0= |
138 |
+ sys-libs/zlib |
139 |
+ lzma? ( app-arch/xz-utils ) |
140 |
+ python? ( ${PYTHON_DEPS} ) |
141 |
+ xml? ( dev-libs/expat ) |
142 |
+ source-highlight? ( |
143 |
+ dev-util/source-highlight |
144 |
+ ) |
145 |
+ xxhash? ( |
146 |
+ dev-libs/xxhash |
147 |
+ ) |
148 |
+" |
149 |
+DEPEND="${RDEPEND}" |
150 |
+BDEPEND=" |
151 |
+ app-arch/xz-utils |
152 |
+ sys-apps/texinfo |
153 |
+ virtual/yacc |
154 |
+ nls? ( sys-devel/gettext ) |
155 |
+ source-highlight? ( virtual/pkgconfig ) |
156 |
+ test? ( dev-util/dejagnu ) |
157 |
+" |
158 |
+ |
159 |
+PATCHES=( |
160 |
+ "${FILESDIR}"/${PN}-8.3.1-verbose-build.patch |
161 |
+ "${FILESDIR}"/${PN}-10.1-cet.patch |
162 |
+ "${FILESDIR}"/${PN}-10.2-sparc-nat.patch |
163 |
+ "${FILESDIR}"/${PN}-10.2-DW_LLE-riscv64.patch |
164 |
+) |
165 |
+ |
166 |
+pkg_setup() { |
167 |
+ use python && python-single-r1_pkg_setup |
168 |
+} |
169 |
+ |
170 |
+src_prepare() { |
171 |
+ default |
172 |
+ |
173 |
+ strip-linguas -u bfd/po opcodes/po |
174 |
+ export CC_FOR_BUILD=$(tc-getBUILD_CC) |
175 |
+ |
176 |
+ # avoid using ancient termcap from host on Prefix systems |
177 |
+ sed -i -e 's/termcap tinfow/tinfow/g' \ |
178 |
+ gdb/configure{.ac,} || die |
179 |
+} |
180 |
+ |
181 |
+gdb_branding() { |
182 |
+ printf "Gentoo ${PV} " |
183 |
+ if ! use vanilla && [[ -n ${PATCH_VER} ]] ; then |
184 |
+ printf "p${PATCH_VER}" |
185 |
+ else |
186 |
+ printf "vanilla" |
187 |
+ fi |
188 |
+ [[ -n ${EGIT_COMMIT} ]] && printf " ${EGIT_COMMIT}" |
189 |
+} |
190 |
+ |
191 |
+src_configure() { |
192 |
+ strip-unsupported-flags |
193 |
+ |
194 |
+ local myconf=( |
195 |
+ # portage's econf() does not detect presence of --d-d-t |
196 |
+ # because it greps only top-level ./configure. But not |
197 |
+ # gnulib's or gdb's configure. |
198 |
+ --disable-dependency-tracking |
199 |
+ |
200 |
+ --with-pkgversion="$(gdb_branding)" |
201 |
+ --with-bugurl='https://bugs.gentoo.org/' |
202 |
+ --disable-werror |
203 |
+ # Disable modules that are in a combined binutils/gdb tree. #490566 |
204 |
+ --disable-{binutils,etc,gas,gold,gprof,ld} |
205 |
+ |
206 |
+ # avoid automagic dependency on (currently prefix) systems |
207 |
+ # systems with debuginfod library, bug #754753 |
208 |
+ --without-debuginfod |
209 |
+ |
210 |
+ # Allow user to opt into CET for host libraries. |
211 |
+ # Ideally we would like automagic-or-disabled here. |
212 |
+ # But the check does not quite work on i686: bug #760926. |
213 |
+ $(use_enable cet) |
214 |
+ ) |
215 |
+ local sysroot="${EPREFIX}/usr/${CTARGET}" |
216 |
+ is_cross && myconf+=( |
217 |
+ --with-sysroot="${sysroot}" |
218 |
+ --includedir="${sysroot}/usr/include" |
219 |
+ --with-gdb-datadir="\${datadir}/gdb/${CTARGET}" |
220 |
+ ) |
221 |
+ |
222 |
+ # gdbserver only works for native targets (CHOST==CTARGET). |
223 |
+ # it also doesn't support all targets, so rather than duplicate |
224 |
+ # the target list (which changes between versions), use the |
225 |
+ # "auto" value when things are turned on, which is triggered |
226 |
+ # whenever no --enable or --disable is given |
227 |
+ if is_cross || use !server ; then |
228 |
+ myconf+=( --disable-gdbserver ) |
229 |
+ fi |
230 |
+ |
231 |
+ myconf+=( |
232 |
+ --enable-64-bit-bfd |
233 |
+ --disable-install-libbfd |
234 |
+ --disable-install-libiberty |
235 |
+ # Disable guile for now as it requires guile-2.x #562902 |
236 |
+ --without-guile |
237 |
+ --enable-obsolete |
238 |
+ # This only disables building in the readline subdir. |
239 |
+ # For gdb itself, it'll use the system version. |
240 |
+ --disable-readline |
241 |
+ --with-system-readline |
242 |
+ # This only disables building in the zlib subdir. |
243 |
+ # For gdb itself, it'll use the system version. |
244 |
+ --without-zlib |
245 |
+ --with-system-zlib |
246 |
+ --with-separate-debug-dir="${EPREFIX}"/usr/lib/debug |
247 |
+ $(use_with xml expat) |
248 |
+ $(use_with lzma) |
249 |
+ $(use_enable nls) |
250 |
+ $(use_enable source-highlight) |
251 |
+ $(use multitarget && echo --enable-targets=all) |
252 |
+ $(use_with python python "${EPYTHON}") |
253 |
+ $(use_with xxhash) |
254 |
+ ) |
255 |
+ if use sparc-solaris || use x86-solaris ; then |
256 |
+ # disable largefile support |
257 |
+ # https://sourceware.org/ml/gdb-patches/2014-12/msg00058.html |
258 |
+ myconf+=( --disable-largefile ) |
259 |
+ fi |
260 |
+ |
261 |
+ # source-highlight is detected with pkg-config: bug #716558 |
262 |
+ export ac_cv_path_pkg_config_prog_path="$(tc-getPKG_CONFIG)" |
263 |
+ |
264 |
+ econf "${myconf[@]}" |
265 |
+} |
266 |
+ |
267 |
+src_install() { |
268 |
+ default |
269 |
+ find "${ED}"/usr -name libiberty.a -delete || die |
270 |
+ |
271 |
+ # Delete translations that conflict with binutils-libs. #528088 |
272 |
+ # Note: Should figure out how to store these in an internal gdb dir. |
273 |
+ if use nls ; then |
274 |
+ find "${ED}" \ |
275 |
+ -regextype posix-extended -regex '.*/(bfd|opcodes)[.]g?mo$' \ |
276 |
+ -delete || die |
277 |
+ fi |
278 |
+ |
279 |
+ # Don't install docs when building a cross-gdb |
280 |
+ if [[ ${CTARGET} != ${CHOST} ]] ; then |
281 |
+ rm -rf "${ED}"/usr/share/{doc,info,locale} || die |
282 |
+ local f |
283 |
+ for f in "${ED}"/usr/share/man/*/* ; do |
284 |
+ if [[ ${f##*/} != ${CTARGET}-* ]] ; then |
285 |
+ mv "${f}" "${f%/*}/${CTARGET}-${f##*/}" || die |
286 |
+ fi |
287 |
+ done |
288 |
+ return 0 |
289 |
+ fi |
290 |
+ # Install it by hand for now: |
291 |
+ # https://sourceware.org/ml/gdb-patches/2011-12/msg00915.html |
292 |
+ # Only install if it exists due to the twisted behavior (see |
293 |
+ # notes in src_configure above). |
294 |
+ [[ -e gdbserver/gdbreplay ]] && dobin gdbserver/gdbreplay |
295 |
+ |
296 |
+ docinto gdb |
297 |
+ dodoc gdb/CONTRIBUTE gdb/README gdb/MAINTAINERS \ |
298 |
+ gdb/NEWS gdb/ChangeLog gdb/PROBLEMS |
299 |
+ docinto sim |
300 |
+ dodoc sim/{ChangeLog,MAINTAINERS,README-HACKING} |
301 |
+ if use server ; then |
302 |
+ docinto gdbserver |
303 |
+ dodoc gdbserver/{ChangeLog,README} |
304 |
+ fi |
305 |
+ |
306 |
+ if [[ -n ${PATCH_VER} ]] ; then |
307 |
+ dodoc "${WORKDIR}"/extra/gdbinit.sample |
308 |
+ fi |
309 |
+ |
310 |
+ # Remove shared info pages |
311 |
+ rm -f "${ED}"/usr/share/info/{annotate,bfd,configure,standards}.info* |
312 |
+ |
313 |
+ # gcore is part of ubin on freebsd |
314 |
+ if [[ ${CHOST} == *-freebsd* ]]; then |
315 |
+ rm "${ED}"/usr/bin/gcore || die |
316 |
+ fi |
317 |
+ |
318 |
+ if use python; then |
319 |
+ python_optimize "${ED}"/usr/share/gdb/python/gdb |
320 |
+ fi |
321 |
+} |
322 |
+ |
323 |
+pkg_postinst() { |
324 |
+ # portage sucks and doesnt unmerge files in /etc |
325 |
+ rm -vf "${EROOT}"/etc/skel/.gdbinit |
326 |
+ |
327 |
+ if use prefix && [[ ${CHOST} == *-darwin* ]] ; then |
328 |
+ ewarn "gdb is unable to get a mach task port when installed by Prefix" |
329 |
+ ewarn "Portage, unprivileged. To make gdb fully functional you'll" |
330 |
+ ewarn "have to perform the following steps:" |
331 |
+ ewarn " % sudo chgrp procmod ${EPREFIX}/usr/bin/gdb" |
332 |
+ ewarn " % sudo chmod g+s ${EPREFIX}/usr/bin/gdb" |
333 |
+ fi |
334 |
+} |