Pass -pg to linker when using -Zinstrument-mcount#152457
Pass -pg to linker when using -Zinstrument-mcount#152457pmur wants to merge 1 commit intorust-lang:mainfrom
Conversation
|
r? @davidtwco rustbot has assigned @davidtwco. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
The change itself is correct, but perhaps it deserves a test?
|
|
Is this also correct for musl and other targets that use a gnu toolchain? |
|
Good question. |
That's maybe a detail about the glibc specific implementation which can be redacted? non-gnu targets seem to have a little more varied behavior.
musl, no. Linking should fail with unresolved |
Clang and gcc use this option to control linking behavior too. Some targets need to be linked against a special crt which enables profiling at runtime. This makes using gprof a little easier with Rust binaries. Otherwise, rustc must be passed `-Clink-args=-pg` to ensure the correct startup code is linked.
78a8cde to
a4a5208
Compare
|
Just to double check we don't regress here. FreeBSD seems to support it: https://man.freebsd.org/cgi/man.cgi?query=moncontrol&sektion=3&apropos=0&manpath=freebsd Even mingw-w64 provides the necessary objects. |
I verified musl will fail to compile in the same way with and without |
|
ping |
This selects a slightly different crt on gnu targets which enables the profiler within glibc.
This makes using gprof a little easier with Rust binaries. Otherwise, rustc must be passed
-Clink-args=-pgto ensure the correct startup code is linked.