Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rebuild std with frame pointers #213

Closed
YaLTeR opened this issue Feb 15, 2023 · 3 comments
Closed

Rebuild std with frame pointers #213

YaLTeR opened this issue Feb 15, 2023 · 3 comments

Comments

@YaLTeR
Copy link

YaLTeR commented Feb 15, 2023

At the moment, the official std binaries are built without frame pointers: rust-lang/rust#103711. This means that libraries and apps built with freedesktop SDK's Rust have clobbered frame pointers in std functions, even when building with -C force-frame-pointers=yes. This can be verified with a command from the issue:

$ objdump -Cd src/identity | grep -E '>:$|\$0x1,%bpl' | grep -B1 bpl | head -n 50
000000000080da60 <std::panicking::default_hook>:
  80dcea:	40 b5 01             	mov    $0x1,%bpl
--
000000000080fb30 <std::sys::unix::futex::futex_wait>:
  80fbd2:	40 b5 01             	mov    $0x1,%bpl
--
000000000080fcc0 <std::sys::unix::os::glibc_version>:
  80fdbf:	40 f6 c5 01          	test   $0x1,%bpl
  80fdc9:	40 f6 c5 01          	test   $0x1,%bpl
000000000080fe00 <<std::sys::unix::os_str::Slice as core::fmt::Display>::fmt>:
  80fe9d:	40 b5 01             	mov    $0x1,%bpl

<and so on>

Frame pointers in all functions are needed for fast profiling, and they are already enabled across the freedesktop SDK. To be able to profile Rust applications and applications depending on Rust libraries (e.g. Rust gstreamer plugins), they should also be built with frame pointers, including the standard library crates.

Until there are official binaries with frame pointers, would it be possible to rebuild the standard library crates with -C force-frame-pointers=yes for the freedesktop SDK extension?

You can verify that it worked if building an app with -C force-frame-pointers=yes produces empty output for the above command:

$ objdump -Cd src/identity | grep -E '>:$|\$0x1,%bpl' | grep -B1 bpl | head -n 50
$

cc @alatiera

@Erick555
Copy link

Right now this extension just re-packages official rust binaries so switching to source build would a be a major complication. This may require much more time effort than bumping version (which is done by bot).

Ideally this would be fixed by upstream at some point.

@alatiera
Copy link
Member

alatiera commented Jul 9, 2023

In the meantime, we can get builds with frame-pointers using the rust-nightly and -Zbuild-std

https://gitlab.gnome.org/World/podcasts/-/merge_requests/292/diffs

bash-5.2$ objdump -Cd _build/podcasts-gtk/src/x86_64-unknown-linux-gnu/debug/podcasts-gtk | grep -E '>:$|\$0x1,%bpl' | grep -B1 bpl | head -n 50
bash-5.2$ 

@alatiera
Copy link
Member

Fixed with rust-lang/rust#122646 and Rust 1.79.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants