Pick the max DWARF version when LTO'ing modules with different versions #136659
Merged
bors merged 2 commits intorust-lang:masterfrom Feb 9, 2025
Merged
Pick the max DWARF version when LTO'ing modules with different versions #136659bors merged 2 commits intorust-lang:masterfrom
bors merged 2 commits intorust-lang:masterfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, when rustc compiles code with
-Cltoenabled that was builtwith different choices for
-Zdwarf-version, a warning will bereported. It's very easy to observe this by compiling most anything (eg,
"hello world") and specifying
-Clto -Zdwarf-version=5since thestandard library is distributed with
-Zdwarf-version=4.This behavior isn't actually useful for a few reasons:
anyway after issuing the warning.
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.
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 #130041 which fails due to these warnings being printed
cc #103057