Open zzsergant opened 1 week ago
Does it work on nightly with RUSTFLAGS="-Zlinker-features=-lld"
?
Does it work on nightly with
RUSTFLAGS="-Zlinker-features=-lld"
?
yes, it works with that flag on nightly.
What is the output of readelf -aW
on the object file that is supposed to provide this symbol?
What is the output of
readelf -aW
on the object file that is supposed to provide this symbol?
Here is output:
__tracepoint_ptr_hello_world___my_first_tracepoint
is a local symbol, I think it ends up in a separate section (-ffunction-sections
/-fdata-sections
, at least several other symbols do) and there don't seem to be any relocation referencing it. I'm surprised the system linker doesn't omit this symbol too. Note that rustc passes --gc-sections
to the linker to remove functions and statics which aren't referenced anywhere nor exported.
The __tracepoint_ptr_hello_world___my_first_tracepoint
was mentioned as one of the difference between nm
symbols of resulting binary when built in stable
vs nightly
. I'm not sure why exactly it is not working (tracing) when building on nightly
. Maybe some other symbol or section is missing in resulting binary on which lltng
toolkit is relied.
I don't think this should get the regression-from-stable-to-nightly label. We only enable lld on nightly, right? So it will keep working on stable and beta until we make lld the default there too.
After some research I've found an option to link successfully with nightly linker with following flags in .cargo/config.toml
:
[target.'cfg(unix)']
rustflags = ["-C", "link-args=-z nostart-stop-gc"]
That way the tracing works with resulting binary and __tracepoint_ptr_hello_world___my_first_tracepoint
also stay in it.
I'm using Ubuntu Linux 20.04.
I have a project which build some
.c
files (lttng tracepoints) inbuild.rs
withcc::Build
and link it to executable. Instable
version of Rust toolchain everything works fine.But when compiling it with
nightly
Rust toolchain some tracepoint data is missing in resulting executable and tracing does not working.Code
Here is the archive of minimal project which have a link problem on
nightly
: lttng_link_test.zipTo build the code you may need to install
liblttng-ust-dev
package. The Rust toolchain is specified inrust-toolchain.toml
file of the project.I tried this code:
I expected to see this happen:
Instead, this happened:
The
__tracepoint_ptr_hello_world___my_first_tracepoint
is missing.Version it worked on
It most recently worked on:
Version with regression