Skip to content

Commit

Permalink
Modify QNX NTO platform support
Browse files Browse the repository at this point in the history
Modify QNX NTO `dl_iterate_phdr` to toke `* mut`
All other platforms use `* mut`, and while this is technically a breaking change, most likely noone is using it directly.

NTO does not define last four fields of the `dl_phdr_info`, so might as well exclude them for cleanliness.

v7.0: [link](https://www.qnx.com/developers/docs/7.0.0/index.html#com.qnx.doc.neutrino.lib_ref/topic/d/dl_iterate_phdr.html)
v7.1: [link](https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.lib_ref/topic/d/dl_iterate_phdr.html)
v8.0: [link](https://www.qnx.com/developers/docs/8.0/com.qnx.doc.neutrino.lib_ref/topic/d/dl_iterate_phdr.html?hl=dl_phdr_info)

See also rust-lang/backtrace-rs#648

(backport <#3815>)
(cherry picked from commit 4edd266)
  • Loading branch information
nyurik authored and tgross35 committed Aug 13, 2024
1 parent 98f13d9 commit 16431da
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,13 +327,14 @@ s! {
// to false. So I'm just removing these, and if uClibc changes
// the #if block in the future to include the following fields, these
// will probably need including here. tsidea, skrap
#[cfg(not(target_env = "uclibc"))]
// QNX (NTO) platform does not define these fields
#[cfg(not(any(target_env = "uclibc", target_os = "nto")))]
pub dlpi_adds: ::c_ulonglong,
#[cfg(not(target_env = "uclibc"))]
#[cfg(not(any(target_env = "uclibc", target_os = "nto")))]
pub dlpi_subs: ::c_ulonglong,
#[cfg(not(target_env = "uclibc"))]
#[cfg(not(any(target_env = "uclibc", target_os = "nto")))]
pub dlpi_tls_modid: ::size_t,
#[cfg(not(target_env = "uclibc"))]
#[cfg(not(any(target_env = "uclibc", target_os = "nto")))]
pub dlpi_tls_data: *mut ::c_void,
}

Expand Down
5 changes: 4 additions & 1 deletion src/unix/nto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3340,7 +3340,10 @@ extern "C" {
pub fn dl_iterate_phdr(
callback: ::Option<
unsafe extern "C" fn(
info: *const dl_phdr_info,
// The original .h file declares this as *const, but for consistency with other platforms,
// changing this to *mut to make it easier to use.
// Maybe in v0.3 all platforms should use this as a *const.
info: *mut dl_phdr_info,
size: ::size_t,
data: *mut ::c_void,
) -> ::c_int,
Expand Down

0 comments on commit 16431da

Please sign in to comment.