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

Building with -Z dwarf-version=5 causes lto debuginfo test failures #130041

Closed
khuey opened this issue Sep 6, 2024 · 0 comments · Fixed by #136659
Closed

Building with -Z dwarf-version=5 causes lto debuginfo test failures #130041

khuey opened this issue Sep 6, 2024 · 0 comments · Fixed by #136659
Assignees
Labels
-Zdwarf-version Unstable option: set dwarf version A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-LTO Area: Link-time optimization (LTO) requires-nightly This issue requires a nightly compiler in some way.

Comments

@khuey
Copy link
Contributor

khuey commented Sep 6, 2024

Specifically

    [ui] tests/ui/lto/debuginfo-lto.rs
    [ui] tests/ui/sepcomp/sepcomp-lib-lto.rs

I'm not planning to investigate this at the moment, just getting it on record.

@rustbot label +A-debuginfo

@rustbot rustbot added needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) labels Sep 6, 2024
@lolbinarycat lolbinarycat added the A-compiletest Area: The compiletest test runner label Sep 6, 2024
@lolbinarycat lolbinarycat added -Zdwarf-version Unstable option: set dwarf version requires-nightly This issue requires a nightly compiler in some way. A-LTO Area: Link-time optimization (LTO) and removed needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. labels Sep 6, 2024
@jieyouxu jieyouxu removed the A-compiletest Area: The compiletest test runner label Oct 17, 2024
@wesleywiser wesleywiser self-assigned this Feb 6, 2025
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this issue Feb 7, 2025
…e_behavior, r=jieyouxu

Pick the max DWARF version when LTO'ing modules with different versions

Currently, when rustc compiles code with `-Clto` enabled that was built
with different choices for `-Zdwarf-version`, a warning will be
reported. It's very easy to observe this by compiling most anything (eg,
"hello world") and specifying `-Clto -Zdwarf-version=5` since the
standard library is distributed with `-Zdwarf-version=4`.

This behavior isn't actually useful for a few reasons:
- From observation, LLVM chooses to pick the highest DWARF version
  anyway after issuing the warning.
- Clang specifies that in this case, the max version should be picked
  without a warning and as a general principle, we want to support
  x-lang LTO with Clang which implies using the same module flag merge
  behaviors.
- Debuggers need to be able to handle a variety of versions within the
  same debugging session as you can easily have some parts of a binary
  (or some dynamic libraries within an application) all compiled with
  different DWARF versions.

This commit changes the module flag merge behavior to match Clang and
use the highest version of DWARF. It also adds a test to ensure this
behavior is respected in the case of two crates being LTO'd together and
adds a test to ensure no warning is printed.

Fixes rust-lang#130041 which fails due to these warnings being printed

cc rust-lang#103057
Urgau added a commit to Urgau/rust that referenced this issue Feb 8, 2025
…e_behavior, r=jieyouxu

Pick the max DWARF version when LTO'ing modules with different versions

Currently, when rustc compiles code with `-Clto` enabled that was built
with different choices for `-Zdwarf-version`, a warning will be
reported. It's very easy to observe this by compiling most anything (eg,
"hello world") and specifying `-Clto -Zdwarf-version=5` since the
standard library is distributed with `-Zdwarf-version=4`.

This behavior isn't actually useful for a few reasons:
- From observation, LLVM chooses to pick the highest DWARF version
  anyway after issuing the warning.
- Clang specifies that in this case, the max version should be picked
  without a warning and as a general principle, we want to support
  x-lang LTO with Clang which implies using the same module flag merge
  behaviors.
- Debuggers need to be able to handle a variety of versions within the
  same debugging session as you can easily have some parts of a binary
  (or some dynamic libraries within an application) all compiled with
  different DWARF versions.

This commit changes the module flag merge behavior to match Clang and
use the highest version of DWARF. It also adds a test to ensure this
behavior is respected in the case of two crates being LTO'd together and
adds a test to ensure no warning is printed.

Fixes rust-lang#130041 which fails due to these warnings being printed

cc rust-lang#103057
@bors bors closed this as completed in 5ec56e5 Feb 9, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this issue Feb 9, 2025
Rollup merge of rust-lang#136659 - wesleywiser:dwarf_version_lto_merge_behavior, r=jieyouxu

Pick the max DWARF version when LTO'ing modules with different versions

Currently, when rustc compiles code with `-Clto` enabled that was built
with different choices for `-Zdwarf-version`, a warning will be
reported. It's very easy to observe this by compiling most anything (eg,
"hello world") and specifying `-Clto -Zdwarf-version=5` since the
standard library is distributed with `-Zdwarf-version=4`.

This behavior isn't actually useful for a few reasons:
- From observation, LLVM chooses to pick the highest DWARF version
  anyway after issuing the warning.
- Clang specifies that in this case, the max version should be picked
  without a warning and as a general principle, we want to support
  x-lang LTO with Clang which implies using the same module flag merge
  behaviors.
- Debuggers need to be able to handle a variety of versions within the
  same debugging session as you can easily have some parts of a binary
  (or some dynamic libraries within an application) all compiled with
  different DWARF versions.

This commit changes the module flag merge behavior to match Clang and
use the highest version of DWARF. It also adds a test to ensure this
behavior is respected in the case of two crates being LTO'd together and
adds a test to ensure no warning is printed.

Fixes rust-lang#130041 which fails due to these warnings being printed

cc rust-lang#103057
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
-Zdwarf-version Unstable option: set dwarf version A-debuginfo Area: Debugging information in compiled programs (DWARF, PDB, etc.) A-LTO Area: Link-time optimization (LTO) requires-nightly This issue requires a nightly compiler in some way.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants