https://bugs.llvm.org/show_bug.cgi?id=49522

            Bug ID: 49522
           Summary: DebugInfo Stripping sometimes causes a Broken Input
                    Module
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: DebugInfo
          Assignee: unassignedb...@nondot.org
          Reporter: rever...@digital.ai
                CC: jdevliegh...@apple.com, keith.wal...@arm.com,
                    llvm-bugs@lists.llvm.org,
                    paul_robin...@playstation.sony.com

Created attachment 24619
  --> https://bugs.llvm.org/attachment.cgi?id=24619&action=edit
Source code from Boost::Spirit (I think) that leaves Debug Metadata after
stripping

With the latest LLVM source and the recent Xcode 12.5 betas, we've noticed that
stripping debug info from certain object files is broken both in the clang++
frontend and when directly calling llvm::StripDebugInfo or using
llvm::createStripSymbolsPass(true). The error seen after lowering a stripped
object file with embedded bitcode:

DICompileUnit not listed in llvm.dbg.cu
!3714 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !10,
producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project
023b5c1ed8d1577bf0cf298b64a0a047b13fc418)", isOptimized: false, runtimeVersion:
0, emissionKind: FullDebug, enums: !3715, retainedTypes: !3729, globals:
!29030, imports: !29860, splitDebugInlining: false, nameTableKind: None,
sysroot:
"/Applications/Xcode_12.5b2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
sdk: "MacOSX.sdk")
warning: ignoring invalid debug info in spirit.stripped.o
DICompileUnit not listed in llvm.dbg.cu
!3714 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !10,
producer: "clang version 13.0.0 (https://github.com/llvm/llvm-project
023b5c1ed8d1577bf0cf298b64a0a047b13fc418)", isOptimized: false, runtimeVersion:
0, emissionKind: FullDebug, enums: !3715, retainedTypes: !3729, globals:
!29030, imports: !29860, splitDebugInlining: false, nameTableKind: None,
sysroot:
"/Applications/Xcode_12.5b2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk",
sdk: "MacOSX.sdk")
llc: error: 'spirit.stripped.o': input module cannot be verified

With the latest Xcode 12.5 beta (or using the swift/release/5.4 branch), the
llc error becomes "error: input module is broken!"

Additionally after performing llvm::StripDebugInfo(), a subsequent call to
llvm::verifyModule() will not report any errors and debug_compile_units() is
empty. However writing the stripped bitcode to a file and then running llvm-dis
on said file, the DICompileUnits are clearly visible in the Debug Metadata.

I've attached a reproducible source file that can compiled with:
clang++ spirit.cpp -c -g -emit-llvm -isysroot "" spirit.o
opt spirit.o -strip-debug -o spirit.stripped.o
lld spirit.stripped.o -o spirit.out
Also I'm sorry the source file is rather large, but it's the only thing I've
found to consistently reproduce the problem.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to