Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Print source filename when invalid debug info is found in LTO. #138201

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rastogishubham
Copy link
Contributor

When invalid debug info is found in a module during LTO, the debug info from that module is stripped. However, we do not print the source filename, which makes it impossible to figure out where the invalid debug info is coming from.

This patch prints the source file name.

When invalid debug info is found in a module during LTO, the debug info
from that module is stripped. However, we do not print the source
filename, which makes it impossible to figure out where the invalid
debug info is coming from.

This patch prints the source file name.
@llvmbot llvmbot added the LTO Link time optimization (regular/full LTO or ThinLTO) label May 1, 2025
@llvmbot
Copy link
Member

llvmbot commented May 1, 2025

@llvm/pr-subscribers-lto

Author: Shubham Sandeep Rastogi (rastogishubham)

Changes

When invalid debug info is found in a module during LTO, the debug info from that module is stripped. However, we do not print the source filename, which makes it impossible to figure out where the invalid debug info is coming from.

This patch prints the source file name.


Full diff: https://github.com/llvm/llvm-project/pull/138201.diff

2 Files Affected:

  • (modified) llvm/lib/LTO/LTOCodeGenerator.cpp (+1)
  • (modified) llvm/lib/LTO/ThinLTOCodeGenerator.cpp (+2)
diff --git a/llvm/lib/LTO/LTOCodeGenerator.cpp b/llvm/lib/LTO/LTOCodeGenerator.cpp
index 70b7135fcbef0..bd0dfed76e3d4 100644
--- a/llvm/lib/LTO/LTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/LTOCodeGenerator.cpp
@@ -548,6 +548,7 @@ void LTOCodeGenerator::verifyMergedModuleOnce() {
     report_fatal_error("Broken module found, compilation aborted!");
   if (BrokenDebugInfo) {
     emitWarning("Invalid debug info found, debug info will be stripped");
+    emitWarning("Source FileName: " + MergedModule->getSourceFileName());
     StripDebugInfo(*MergedModule);
   }
 }
diff --git a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
index 42dba0abe245f..5c4883c8ddae9 100644
--- a/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
+++ b/llvm/lib/LTO/ThinLTOCodeGenerator.cpp
@@ -182,6 +182,8 @@ static void verifyLoadedModule(Module &TheModule) {
   if (BrokenDebugInfo) {
     TheModule.getContext().diagnose(ThinLTODiagnosticInfo(
         "Invalid debug info found, debug info will be stripped", DS_Warning));
+    TheModule.getContext().diagnose(ThinLTODiagnosticInfo(
+        "Source File Name: " + TheModule.getSourceFileName(), DS_Warning));
     StripDebugInfo(TheModule);
   }
 }

@@ -182,6 +182,8 @@ static void verifyLoadedModule(Module &TheModule) {
if (BrokenDebugInfo) {
TheModule.getContext().diagnose(ThinLTODiagnosticInfo(
"Invalid debug info found, debug info will be stripped", DS_Warning));
TheModule.getContext().diagnose(ThinLTODiagnosticInfo(
"Source File Name: " + TheModule.getSourceFileName(), DS_Warning));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the formatting is inconsistent with the one above

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
LTO Link time optimization (regular/full LTO or ThinLTO)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants