pkgsrc-WIP-changes archive

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

rust: make RUST_BACKTRACE work on NetBSD as well.



Module Name:	pkgsrc-wip
Committed By:	Havard Eidnes <he%NetBSD.org@localhost>
Pushed By:	he
Date:		Mon May 16 22:10:18 2022 +0000
Changeset:	5c8a552378a868042241aab6a7af3a14a2a7e102

Modified Files:
	rust/distinfo
Added Files:
	rust/patches/patch-library_backtrace_src_symbolize_gimli.rs
	rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
	rust/patches/patch_library_backtrace_src_symbolize_gimli_elf.rs

Log Message:
rust: make RUST_BACKTRACE work on NetBSD as well.

Thanks to rvp at https://www.unitedbsd.com/d/815-rust-backtrace/
for the relevant hints.

To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=5c8a552378a868042241aab6a7af3a14a2a7e102

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffstat:
 rust/distinfo                                      |  2 ++
 .../patch-library_backtrace_src_symbolize_gimli.rs | 14 +++++++++++++
 ...tch-vendor_backtrace_src_symbolize_gimli_elf.rs | 24 ++++++++++++++++++++++
 ...ch_library_backtrace_src_symbolize_gimli_elf.rs | 24 ++++++++++++++++++++++
 4 files changed, 64 insertions(+)

diffs:
diff --git a/rust/distinfo b/rust/distinfo
index b49a7f079c..73e740b658 100644
--- a/rust/distinfo
+++ b/rust/distinfo
@@ -108,6 +108,7 @@ SHA1 (patch-compiler_rustc__target_src_spec_aarch64__be__unknown__netbsd.rs) = a
 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) = 32ab8ea3809cd4f6fee9fc0df5db47d76ccbd9d2
 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
@@ -126,6 +127,7 @@ SHA1 (patch-src_tools_rls_rls_src_cmd.rs) = 8174664b7bce2e60e690bc20ab688606b60c
 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) = b93148ff72a60a17c6a444f2616386c40d872153
+SHA1 (patch-vendor_backtrace_src_symbolize_gimli_elf.rs) = 308538090d9ce11d206d6eef0e675581a1fc6e80
 SHA1 (patch-vendor_cc-1.0.69_src_lib.rs) = b5c0f795624b928b8b02fe01174e6a24e770adea
 SHA1 (patch-vendor_cc_src_lib.rs) = 2f6b0ad800b31cd33334f194651981491ecf7641
 SHA1 (patch-vendor_libc-0.2.112_src_unix_bsd_netbsdlike_netbsd_mod.rs) = c4d703bc084d8506afd8fed1428f59e578936f77
diff --git a/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs b/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs
new file mode 100644
index 0000000000..3f94f6b483
--- /dev/null
+++ b/rust/patches/patch-library_backtrace_src_symbolize_gimli.rs
@@ -0,0 +1,14 @@
+$NetBSD$
+
+Add NetBSD to the family who uses dl_iterate_phdr().
+
+--- library/backtrace/src/symbolize/gimli.rs.orig	2022-04-04 09:41:26.000000000 +0000
++++ library/backtrace/src/symbolize/gimli.rs
+@@ -177,6 +177,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 --git a/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs b/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
new file mode 100644
index 0000000000..ad3afcd8d1
--- /dev/null
+++ b/rust/patches/patch-vendor_backtrace_src_symbolize_gimli_elf.rs
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Make NetBSD also find its debug libraries, if present.
+
+--- vendor/backtrace/src/symbolize/gimli/elf.rs.orig	2022-04-04 11:10:55.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(target_os != "netbsd")]
+ 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 --git a/rust/patches/patch_library_backtrace_src_symbolize_gimli_elf.rs b/rust/patches/patch_library_backtrace_src_symbolize_gimli_elf.rs
new file mode 100644
index 0000000000..ec1654df68
--- /dev/null
+++ b/rust/patches/patch_library_backtrace_src_symbolize_gimli_elf.rs
@@ -0,0 +1,24 @@
+$NetBSD$
+
+Make NetBSD also find its debug libraries, if present.
+
+--- library/backtrace/src/symbolize/gimli/elf.rs.orig	2022-04-04 09:41:26.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(target_os != "netbsd")]
+ 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);
+ 


Home | Main Index | Thread Index | Old Index