[llvm-dev] lld/lto/win32 crash on DIE code

Evgeny Leviant via llvm-dev llvm-dev at lists.llvm.org
Wed Mar 21 02:28:19 PDT 2018


It looks the problem lies in how your compiler generates debug info. LLVM doesn't
expect DIDerivedType scope to be an instance of DICompileUnit. Here is a quick fix:

 DIE *DwarfUnit::getOrCreateContextDIE(const DIScope *Context) {
-  if (!Context || isa<DIFile>(Context))
+  if (!Context || isa<DIFile>(Context) || isa<DICompileUnit>(Context))

However, I suggest talking to someone with in-depth debug info experience, as the problem
itself seems to be not related to LTO.
________________________________________
От: Carlo Kok <ck at remobjects.com>
Отправлено: 20 марта 2018 г. 17:50
Кому: Evgeny Leviant; llvm-dev at lists.llvm.org
Тема: Re: [llvm-dev] lld/lto/win32 crash on DIE code

Op 20-3-2018 om 12:40 schreef Evgeny Leviant:
> This one triggers an assertion in calculateSEHStateNumbers due to weird catchpad instruction
> in @_island_debug_invoke and many other functions. The code expects either pointer to a filter
> function or null in first operand, while you're passing pointer to structure:
>
> catchpad within %80 [{i8*, i8*}* anon..., ...]
>
> ________________________________________


I used the wrong exception method name, using the regular one now
(__CxxFrameHandler3). Also tested it in latest clean llvm/debug and
crashes how I get it locally too.


https://www.dropbox.com/s/n3e2eystps9qvwx/repro.tar?dl=0


 >      lld.exe!HandleAbort(int Sig) Line 411   C++     Symbols loaded.
        ucrtbased.dll!raise(int signum) Line 541        C++     Symbols loaded.
        ucrtbased.dll!abort() Line 64   C++     Symbols loaded.
        ucrtbased.dll!common_assert_to_stderr_direct(const wchar_t * const
expression, const wchar_t * const file_name, const unsigned int
line_number) Line 161   C++     Symbols loaded.
        ucrtbased.dll!common_assert_to_stderr<wchar_t>(const wchar_t * const
expression, const wchar_t * const file_name, const unsigned int
line_number) Line 175   C++     Symbols loaded.
        ucrtbased.dll!common_assert<wchar_t>(const wchar_t * const
expression, const wchar_t * const file_name, const unsigned int
line_number, void * const return_address) Line 415      C++     Symbols loaded.
        ucrtbased.dll!_wassert(const wchar_t * expression, const wchar_t *
file_name, unsigned int line_number) Line 443   C++     Symbols loaded.
        lld.exe!llvm::DwarfUnit::getOrCreateTypeDIE(const llvm::MDNode *
TyNode) Line 753        C++     Symbols loaded.
        lld.exe!llvm::DwarfUnit::addType(llvm::DIE & Entity, const
llvm::DIType * Ty, llvm::dwarf::Attribute Attribute) Line 803   C++
Symbols loaded.
        lld.exe!llvm::DwarfCompileUnit::applyVariableAttributes(const
llvm::DbgVariable & Var, llvm::DIE & VariableDie) Line 980      C++     Symbols
loaded.
        lld.exe!llvm::DwarfCompileUnit::finishVariableDefinition(const
llvm::DbgVariable & Var) Line 808       C++     Symbols loaded.
        lld.exe!llvm::DwarfDebug::finishVariableDefinitions() Line 671  C++
Symbols loaded.
        lld.exe!llvm::DwarfDebug::finalizeModuleInfo() Line 693 C++     Symbols
loaded.
        lld.exe!llvm::DwarfDebug::endModule() Line 784  C++     Symbols loaded.
        lld.exe!llvm::AsmPrinter::doFinalization(llvm::Module & M) Line 1352
C++     Symbols loaded.
        lld.exe!llvm::FPPassManager::doFinalization(llvm::Module & M) Line
1559    C++     Symbols loaded.
        lld.exe!`anonymous
namespace'::MPPassManager::runOnModule(llvm::Module & M) Line 1615      C++
Symbols loaded.
        lld.exe!llvm::legacy::PassManagerImpl::run(llvm::Module & M) Line
1700    C++     Symbols loaded.
        lld.exe!llvm::legacy::PassManager::run(llvm::Module & M) Line 1732
C++     Symbols loaded.
        lld.exe!`anonymous namespace'::codegen(llvm::lto::Config & Conf,
llvm::TargetMachine * TM,
std::function<std::unique_ptr<llvm::lto::NativeObjectStream,std::default_delete<llvm::lto::NativeObjectStream>
 > __cdecl(unsigned int)> AddStream, unsigned int Task, llvm::Module &
Mod) Line 292   C++     Symbols loaded.
        lld.exe!llvm::lto::backend(llvm::lto::Config & C,
std::function<std::unique_ptr<llvm::lto::NativeObjectStream,std::default_delete<llvm::lto::NativeObjectStream>
 > __cdecl(unsigned int)> AddStream, unsigned int
ParallelCodeGenParallelismLevel,
std::unique_ptr<llvm::Module,std::default_delete<llvm::Module> > Mod,
llvm::ModuleSummaryIndex & CombinedIndex) Line 393      C++     Symbols loaded.

lld.exe!llvm::lto::LTO::runRegularLTO(std::function<std::unique_ptr<llvm::lto::NativeObjectStream,std::default_delete<llvm::lto::NativeObjectStream>
 > __cdecl(unsigned int)> AddStream) Line 860   C++     Symbols loaded.

lld.exe!llvm::lto::LTO::run(std::function<std::unique_ptr<llvm::lto::NativeObjectStream,std::default_delete<llvm::lto::NativeObjectStream>
 > __cdecl(unsigned int)> AddStream,
std::function<std::function<std::unique_ptr<llvm::lto::NativeObjectStream,std::default_delete<llvm::lto::NativeObjectStream>
 > __cdecl(unsigned int)> __cdecl(unsigned int,llvm::StringRef)> Cache)
Line 793        C++     Symbols loaded.
        lld.exe!lld::coff::BitcodeCompiler::compile() Line 141  C++     Symbols
loaded.
        lld.exe!lld::coff::SymbolTable::compileBitcodeFiles() Line 381  C++
Symbols loaded.
        lld.exe!lld::coff::SymbolTable::addCombinedLTOObjects() Line 389        C++
Symbols loaded.
        lld.exe!lld::coff::LinkerDriver::link(llvm::ArrayRef<char const *>
ArgsArr) Line 1366      C++     Symbols loaded.
        lld.exe!lld::coff::link(llvm::ArrayRef<char const *> Args, bool
CanExitEarly, llvm::raw_ostream & Diag) Line 75 C++     Symbols loaded.
        lld.exe!main(int Argc, const char * * Argv) Line 129    C++     Symbols loaded.
        lld.exe!invoke_main() Line 78   C++     Symbols loaded.
        lld.exe!__scrt_common_main_seh() Line 283       C++     Symbols loaded.
        lld.exe!__scrt_common_main() Line 326   C++     Symbols loaded.
        lld.exe!mainCRTStartup() Line 17        C++     Symbols loaded.
        kernel32.dll!75568654() Unknown No symbols loaded.
        [Frames below may be incorrect and/or missing, no symbols loaded for
kernel32.dll]           Annotated Frame
        ntdll.dll!__RtlUserThreadStart()        Unknown Symbols loaded.
        ntdll.dll!__RtlUserThreadStart at 8
()     Unknown Symbols loaded.


More information about the llvm-dev mailing list