Building in release mode with LTO breaks RPM build process for some code #78445
Labels
A-linkage
Area: linking into static, shared libraries and binaries
A-lto
Area: Link Time Optimization
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
When building a dynamic library from my Rust code with LTO enabled, the resulting binary includes a seemingly invalid slash-terminated directory table entry, which in turn prevents building an RPM from the library on RHEL (details follow below).
The Rust code (reduced to the minimal code that reproduces the issue) in
src/lib.rs
:The
Cargo.toml
:The build command:
I expected to see this happen: Get a valid binary for the dynamic library.
Instead, this happened:
The resulting binary includes a directory table entry that ends with a slash, which in turn breaks the RPM build process.
The output of
objdump -g target/release/liblto_bug.so
includes:Entry 4 ends with a slash, which wreaks havoc with RPM's
debugedit
utility that is run while building an RPM.Reproducing this:
See this Red Hat bug report that describes the problem.
It could be considered a bug in
debugedit
, but it's very longstanding and would be great if Rust didn't do this.It seems to be some an unintentional side effect that the directory
/rustc/18bf6b4f01a6feaf7259ba7cdae58031af1b7b39/
is added to the directory table, certainly with the terminating slash.I tried to see if I could work around this by using
--remap-path-prefix
, but that seems to have no effect at all on this path.Meta
rustc --version --verbose
:Also happens with nightly:
The text was updated successfully, but these errors were encountered: