pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/lang/rust lang/rust: add patches so that RUST_BACKTRAC...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/13e9e2e30d01
branches:  trunk
changeset: 379564:13e9e2e30d01
user:      he <he%pkgsrc.org@localhost>
date:      Wed May 18 20:57:28 2022 +0000

description:
lang/rust: add patches so that RUST_BACKTRACE works.

Add NetBSD to the systems which need dl_iterate_phdr(),
and make NetBSD find the debug libraries if present.
Also make the execinfo functions visible, but not sure
that's used by rust.

Back-ported from wip / 1.60.0, but we can't do != in
conditionals here.

diffstat:

 lang/rust/Makefile                                                                |   8 ++-
 lang/rust/distinfo                                                                |   7 ++-
 lang/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs                  |  22 +++++++
 lang/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs              |  24 ++++++++
 lang/rust/patches/patch-vendor_backtrace_src_symbolize_gimli.rs                   |  22 +++++++
 lang/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs               |  24 ++++++++
 lang/rust/patches/patch-vendor_libc-0.2.108_src_unix_bsd_netbsdlike_netbsd_mod.rs |  29 ++++++++++
 7 files changed, 133 insertions(+), 3 deletions(-)

diffs (197 lines):

diff -r 54a2c0eb2d89 -r 13e9e2e30d01 lang/rust/Makefile
--- a/lang/rust/Makefile        Wed May 18 20:45:52 2022 +0000
+++ b/lang/rust/Makefile        Wed May 18 20:57:28 2022 +0000
@@ -1,10 +1,10 @@
-# $NetBSD: Makefile,v 1.255 2022/04/30 21:02:39 nia Exp $
+# $NetBSD: Makefile,v 1.256 2022/05/18 20:57:28 he Exp $
 
 DISTNAME=      rustc-1.59.0-src
 PKGNAME=       ${DISTNAME:S/rustc/rust/:S/-src//}
 CATEGORIES=    lang
 MASTER_SITES=  https://static.rust-lang.org/dist/
-PKGREVISION=   1
+PKGREVISION=   2
 
 MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
 HOMEPAGE=      https://www.rust-lang.org/
@@ -387,6 +387,10 @@
 #CKSUMS+=      6dde684bdcc1bb03a808784ce8ccc0721f53bfdf87b84c607045aada916730ba
 #CKSUMS+=      1244e301c58e7f693f14ad23b02713cdd38259928a6ca905336891e869e6743e
 
+CKSUM_CRATES+= vendor/libc-0.2.108
+CKSUMS+=       ddbdc8526a0267ffeb0ab9bb5f01ebb38a14cf759c025b5c0b0ff1178fec889b
+CKSUMS+=       b8330ddc0af8fa8d57f715eebabf0b0e4bcbef85894eee4a0f7aa0f748c29106
+
 CKSUM_CRATES+= vendor/rustc-ap-rustc_target
 CKSUMS+=       673ac3b6875d487ace59b01725d83d2fab4af60615d1f8edd95bf21295947433
 CKSUMS+=       5a8bae7d5b6feb07a75226ad061455298f05627086a3b444cb2a1a6272899d88
diff -r 54a2c0eb2d89 -r 13e9e2e30d01 lang/rust/distinfo
--- a/lang/rust/distinfo        Wed May 18 20:45:52 2022 +0000
+++ b/lang/rust/distinfo        Wed May 18 20:57:28 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.143 2022/04/15 14:00:37 he Exp $
+$NetBSD: distinfo,v 1.144 2022/05/18 20:57:28 he Exp $
 
 BLAKE2s (rust-1.58.1-aarch64-apple-darwin.tar.gz) = 7b463dcd407f7281ad6f9418c26f4360685a6d49549165a7b76b41c1a4f39864
 SHA512 (rust-1.58.1-aarch64-apple-darwin.tar.gz) = 66e58a3efe201c1c954bf7f382c8a6a6a52399451ff6e3abd6ad797de32cbc8f01bb92f8512b93bacc2091554afd7de08f7900cfd68bd2e5cf99b68362e26de5
@@ -108,6 +108,8 @@
 SHA1 (patch-compiler_rustc__target_src_spec_i586__unknown__netbsd.rs) = efae710b37c089702802c3d5aa678d1cc5f88cc2
 SHA1 (patch-compiler_rustc__target_src_spec_mod.rs) = 8f1b5ced49fa66a646327a19f9eb0501fa2b01c7
 SHA1 (patch-compiler_rustc__target_src_spec_netbsd__base.rs) = 18e3cb9f32c4170679459b2c63c856abe0fac6a3
+SHA1 (patch-library_backtrace_src_symbolize_gimli.rs) = 94b6bf51fac39d3e28a261855fd747ad1e96b286
+SHA1 (patch-library_backtrace_src_symbolize_gimli_elf.rs) = a22d78f12ebb25fe3e549ce86e363acc095635ae
 SHA1 (patch-library_std_src_sys_unix_mod.rs) = f8669d680f169137ac2891af2977909619366a97
 SHA1 (patch-library_std_src_sys_unix_thread.rs) = e5f661b3dd00058e874fe60cd89d9e919325e99b
 SHA1 (patch-library_unwind_build.rs) = df092d5c07fa0be63a9510f1d6a77e5094ca3b15
@@ -125,7 +127,10 @@
 SHA1 (patch-src_tools_rls_rls_src_cmd.rs) = 8174664b7bce2e60e690bc20ab688606b60c55dc
 SHA1 (patch-src_tools_rls_rls_src_server_io.rs) = 5236eda97fa686b5661e4e5832102e2f010def7b
 SHA1 (patch-src_tools_rust-installer_install-template.sh) = ca769db07986ded26d92957e1055961895def546
+SHA1 (patch-vendor_backtrace_src_symbolize_gimli.rs) = c5f4217146483389fe664c8cbe70796ca601ab4d
+SHA1 (patch-vendor_backtrace_src_symbolize_gimli_elf.rs) = 9527dd4e72f951f55f31a87bdef803fc5d252b38
 SHA1 (patch-vendor_cc_src_lib.rs) = 2f6b0ad800b31cd33334f194651981491ecf7641
+SHA1 (patch-vendor_libc-0.2.108_src_unix_bsd_netbsdlike_netbsd_mod.rs) = a75d2729b96bd8a68c3ecf2e03f2daace737a229
 SHA1 (patch-vendor_libc_src_unix_solarish_mod.rs) = 8364e19ea09203d32494c37ff3db19fe3d6b9d8a
 SHA1 (patch-vendor_lzma-sys_config.h) = b654c7e129fa02697734bc87173f89b3056a5437
 SHA1 (patch-vendor_openssl-src_src_lib.rs) = e62697daa7e7fa3d7b89f338c3a26066b93d7b34
diff -r 54a2c0eb2d89 -r 13e9e2e30d01 lang/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs  Wed May 18 20:57:28 2022 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-library_backtrace_src_symbolize_gimli.rs,v 1.1 2022/05/18 20:57:28 he Exp $
+
+Do mmap also on NetBSD, and also do dl_iterate_phdr.
+
+--- library/backtrace/src/symbolize/gimli.rs.orig      2022-02-23 04:07:36.000000000 +0000
++++ library/backtrace/src/symbolize/gimli.rs
+@@ -38,6 +38,7 @@ cfg_if::cfg_if! {
+         target_os = "ios",
+         target_os = "linux",
+         target_os = "macos",
++        target_os = "netbsd",
+         target_os = "openbsd",
+         target_os = "solaris",
+         target_os = "illumos",
+@@ -177,6 +178,7 @@ cfg_if::cfg_if! {
+             target_os = "linux",
+             target_os = "fuchsia",
+             target_os = "freebsd",
++            target_os = "netbsd",
+             target_os = "openbsd",
+             all(target_os = "android", feature = "dl_iterate_phdr"),
+         ),
diff -r 54a2c0eb2d89 -r 13e9e2e30d01 lang/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-library_backtrace_src_symbolize_gimli_elf.rs      Wed May 18 20:57:28 2022 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-library_backtrace_src_symbolize_gimli_elf.rs,v 1.1 2022/05/18 20:57:28 he Exp $
+
+Make NetBSD also find its debug libraries, if present.
+
+--- library/backtrace/src/symbolize/gimli/elf.rs.orig  2022-02-23 04:07:36.000000000 +0000
++++ library/backtrace/src/symbolize/gimli/elf.rs
+@@ -276,11 +276,16 @@ fn decompress_zlib(input: &[u8], output:
+     }
+ }
+ 
++#[cfg(target_os = "netbsd")]
++const DEBUG_PATH: &[u8] = b"/usr/libdata/debug";
++#[cfg(any(target_os = "freebsd", target_os = "linux"))]
+ const DEBUG_PATH: &[u8] = b"/usr/lib/debug";
+ 
+ fn debug_path_exists() -> bool {
+     cfg_if::cfg_if! {
+-        if #[cfg(any(target_os = "freebsd", target_os = "linux"))] {
++        if #[cfg(any(target_os = "freebsd", 
++                     target_os = "netbsd",
++                     target_os = "linux"))] {
+             use core::sync::atomic::{AtomicU8, Ordering};
+             static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
+ 
diff -r 54a2c0eb2d89 -r 13e9e2e30d01 lang/rust/patches/patch-vendor_backtrace_src_symbolize_gimli.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-vendor_backtrace_src_symbolize_gimli.rs   Wed May 18 20:57:28 2022 +0000
@@ -0,0 +1,22 @@
+$NetBSD: patch-vendor_backtrace_src_symbolize_gimli.rs,v 1.1 2022/05/18 20:57:28 he Exp $
+
+Do mmap and dl_iterate_phdr() on NetBSD as well.
+
+--- vendor/backtrace/src/symbolize/gimli.rs.orig       2022-02-23 05:34:24.000000000 +0000
++++ vendor/backtrace/src/symbolize/gimli.rs
+@@ -38,6 +38,7 @@ cfg_if::cfg_if! {
+         target_os = "ios",
+         target_os = "linux",
+         target_os = "macos",
++        target_os = "netbsd",
+         target_os = "openbsd",
+         target_os = "solaris",
+         target_os = "illumos",
+@@ -177,6 +178,7 @@ cfg_if::cfg_if! {
+             target_os = "linux",
+             target_os = "fuchsia",
+             target_os = "freebsd",
++            target_os = "netbsd",
+             target_os = "openbsd",
+             all(target_os = "android", feature = "dl_iterate_phdr"),
+         ),
diff -r 54a2c0eb2d89 -r 13e9e2e30d01 lang/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs       Wed May 18 20:57:28 2022 +0000
@@ -0,0 +1,24 @@
+$NetBSD: patch-vendor_backtrace_src_symbolize_gimli_elf.rs,v 1.1 2022/05/18 20:57:28 he Exp $
+
+Make NetBSD also find its debug libraries, if present.
+
+--- vendor/backtrace/src/symbolize/gimli/elf.rs.orig   2022-02-23 05:34:24.000000000 +0000
++++ vendor/backtrace/src/symbolize/gimli/elf.rs
+@@ -276,11 +276,16 @@ fn decompress_zlib(input: &[u8], output:
+     }
+ }
+ 
++#[cfg(target_os = "netbsd")]
++const DEBUG_PATH: &[u8] = b"/usr/libdata/debug";
++#[cfg(any(target_os = "freebsd", target_os = "linux"))]
+ const DEBUG_PATH: &[u8] = b"/usr/lib/debug";
+ 
+ fn debug_path_exists() -> bool {
+     cfg_if::cfg_if! {
+-        if #[cfg(any(target_os = "freebsd", target_os = "linux"))] {
++        if #[cfg(any(target_os = "freebsd",
++                     target_os = "netbsd",
++                     target_os = "linux"))] {
+             use core::sync::atomic::{AtomicU8, Ordering};
+             static DEBUG_PATH_EXISTS: AtomicU8 = AtomicU8::new(0);
+ 
diff -r 54a2c0eb2d89 -r 13e9e2e30d01 lang/rust/patches/patch-vendor_libc-0.2.108_src_unix_bsd_netbsdlike_netbsd_mod.rs
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/lang/rust/patches/patch-vendor_libc-0.2.108_src_unix_bsd_netbsdlike_netbsd_mod.rs Wed May 18 20:57:28 2022 +0000
@@ -0,0 +1,29 @@
+$NetBSD: patch-vendor_libc-0.2.108_src_unix_bsd_netbsdlike_netbsd_mod.rs,v 1.1 2022/05/18 20:57:28 he Exp $
+
+Copy execinfo function definitions from openbsd's mod.rs.
+
+--- vendor/libc-0.2.108/src/unix/bsd/netbsdlike/netbsd/mod.rs.orig     2022-02-23 05:34:25.000000000 +0000
++++ vendor/libc-0.2.108/src/unix/bsd/netbsdlike/netbsd/mod.rs
+@@ -2700,6 +2700,22 @@ extern "C" {
+     pub fn kinfo_getvmmap(pid: ::pid_t, cntp: *mut ::size_t) -> *mut kinfo_vmentry;
+ }
+ 
++#[link(name = "execinfo")]
++extern "C" {
++    pub fn backtrace(addrlist: *mut *mut ::c_void, len: ::size_t) -> ::size_t;
++    pub fn backtrace_symbols(addrlist: *const *mut ::c_void, len: ::size_t) -> *mut *mut ::c_char;
++    pub fn backtrace_symbols_fd(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fd: ::c_int,
++    ) -> ::c_int;
++    pub fn backtrace_symbols_fmt(
++        addrlist: *const *mut ::c_void,
++        len: ::size_t,
++        fmt: *const ::c_char,
++    ) -> *mut *mut ::c_char;
++}
++
+ cfg_if! {
+     if #[cfg(target_arch = "aarch64")] {
+         mod aarch64;



Home | Main Index | Thread Index | Old Index