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

On riscv64gc linux, split-debuginfo ="unpacked" caused error: A dwo section may not contain relocations #110224

Closed
kxxt opened this issue Apr 12, 2023 · 4 comments · Fixed by #120518
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries A-target-specs Area: Compile-target specifications C-bug Category: This is a bug. O-riscv Target: RISC-V architecture T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@kxxt
Copy link
Contributor

kxxt commented Apr 12, 2023

Problem

On riscv64gc linux, split-debuginfo ="unpacked" caused error: A dwo section may not contain relocations.

  • For rust > 1.64, this error occurs.
  • For rust <=1.64, cargo didn't pass -C split-debuginfo=unpacked flag to rustc.
    • For rust 1.64, a segmentation fault happens in rustc.
    • For rust < 1.64, it builds fine

I think the behavior of rust < 1.64 is correct.

Steps

The following steps:

cargo new failure
cd failure
echo "[profile.dev]" >> Cargo.toml
echo 'split-debuginfo = "unpacked"' >> Cargo.toml
cargo build

caused the following failure:

Compiling failure v0.1.0 (/root/failure)
error: A dwo section may not contain relocations

error: could not compile `failure` due to previous error

Possible Solution(s)

No response

Notes

Related: llvm/llvm-project#56642

Version

cargo 1.67.1 (8ecd4f20a 2023-01-10)
release: 1.67.1
commit-hash: 8ecd4f20a9efb626975ac18a016d480dc7183d9b
commit-date: 2023-01-10
host: riscv64gc-unknown-linux-gnu
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0-DEV (sys:0.4.59+curl-7.86.0 vendored ssl:OpenSSL/1.1.1q)
os: Linux [64-bit]
@kxxt kxxt added the C-bug Category: This is a bug. label Apr 12, 2023
@ehuss ehuss transferred this issue from rust-lang/cargo Apr 12, 2023
@ehuss
Copy link
Contributor

ehuss commented Apr 12, 2023

Transferred to rust-lang/rust, since this looks to be a compiler issue.

@jyn514 jyn514 added A-linkage Area: linking into static, shared libraries and binaries A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. O-riscv Target: RISC-V architecture labels Apr 12, 2023
@jyn514
Copy link
Member

jyn514 commented Apr 12, 2023

@ehuss llvm/llvm-project#56642 (comment) says that LLVM doesn't support this combination of flags. It's unclear to me whether it's impossible or just not implemented yet, but in the meantime, cargo should probably stop passing -C split-debuginfo to proc-macros? there's some mention of -mrelax in the upstream issue, I'm not sure how that's related.

@ehuss
Copy link
Contributor

ehuss commented Apr 12, 2023

The report above doesn't mention proc-macros. It seems to happen for normal binaries. The following seems to fail for me:

rustc foo.rs -C split-debuginfo=unpacked -C debuginfo=2 --target riscv64gc-unknown-linux-gnu

If split-debuginfo isn't supported on this target, then rustc should report that it isn't supported (Cargo already tests for this). I believe that is defined by the supported_split_debuginfo field in the target definition.

@jyn514 jyn514 added the A-target-specs Area: Compile-target specifications label Apr 12, 2023
kxxt added a commit to kxxt/archriscv-packages that referenced this issue Sep 10, 2023
- Fix broken rust target.
- Workaround rustc bug: rust-lang/rust#110224
felixonmars pushed a commit to felixonmars/archriscv-packages that referenced this issue Sep 10, 2023
- Fix broken rust target.
- Workaround rustc bug: rust-lang/rust#110224
@VorpalBlade
Copy link

I'm getting the same issue with split-debuginfo = "packed" when cross compiling for riscv64gc-unknown-linux-gnu, it seems to be all values except off that causes issues.

kxxt added a commit to kxxt/rust that referenced this issue Jan 31, 2024
Disable packed/unpacked options for riscv linux/android. Other riscv targets already only have off option.

Fixes: rust-lang#110224
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 3, 2024
…piler-errors

riscv only supports split_debuginfo=off for now

Disable packed/unpacked options for riscv linux/android. Other riscv targets already only have the off option.

The packed/unpacked options might be supported in the future. See upstream issue for more details:
llvm/llvm-project#56642

Fixes rust-lang#110224
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 4, 2024
…piler-errors

riscv only supports split_debuginfo=off for now

Disable packed/unpacked options for riscv linux/android. Other riscv targets already only have the off option.

The packed/unpacked options might be supported in the future. See upstream issue for more details:
llvm/llvm-project#56642

Fixes rust-lang#110224
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 5, 2024
…piler-errors

riscv only supports split_debuginfo=off for now

Disable packed/unpacked options for riscv linux/android. Other riscv targets already only have the off option.

The packed/unpacked options might be supported in the future. See upstream issue for more details:
llvm/llvm-project#56642

Fixes rust-lang#110224
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 5, 2024
…piler-errors

riscv only supports split_debuginfo=off for now

Disable packed/unpacked options for riscv linux/android. Other riscv targets already only have the off option.

The packed/unpacked options might be supported in the future. See upstream issue for more details:
llvm/llvm-project#56642

Fixes rust-lang#110224
@bors bors closed this as completed in 471af8c Feb 5, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 5, 2024
Rollup merge of rust-lang#120518 - kxxt:riscv-split-debug-info, r=compiler-errors

riscv only supports split_debuginfo=off for now

Disable packed/unpacked options for riscv linux/android. Other riscv targets already only have the off option.

The packed/unpacked options might be supported in the future. See upstream issue for more details:
llvm/llvm-project#56642

Fixes rust-lang#110224
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-linkage Area: linking into static, shared libraries and binaries A-target-specs Area: Compile-target specifications C-bug Category: This is a bug. O-riscv Target: RISC-V architecture T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants