[PATCH] D94976: [DWARF] Create subprogram's DIE in the unit specified by its DISubprogram
Jeremy Morse via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 9 09:09:24 PST 2021
jmorse added a comment.
The immediate cause of the failure in Maskrays reproducer is that a zero DIE offset is emitted to .debug_gnu_pubnames, which is interpreted as the (premature) end of the names list. Putting `assert(Entity->getOffset() != 0);` in [0] fails.
The reason why we get a zero offset is due to the following arrangements of debug-info:
- This function [1] has an inlined copy of "LowLevelCallOnce<(lambda at internal/sysinfo.cc:299:28)>"
- "LowLevelCallOnce" has a template type "Callable", with a type that's node !2140 in the input LLVM-IR,
- That type is in the scope of a subprogram, "NumCPUs", which is created in a separate CU,
- "NumCPUs" is in a namespace "base_internal", in another namespace "absl".
So far this is fine. With this patch applied we change the CU that "NumCPUs" is created in to another (from node !2 to !1446). However: this unit only has a skeleton DIE emitted. When the "absl" namespace is created, DwarfUnit adds it directly to the unit DIE (not the skeleton) and list of globals [2]. When emitting .debug_gnu_pubnames, we refer to a DIE that hasn't been (and won't be) emitted in the unit DIE, thus getting a zero offset.
Exactly which piece is at fault here is a bit opaque to me; I'll carry on studying what's going on.
[0] https://github.com/llvm/llvm-project/blob/79b222c39f0e4377b49191b6aba080b1607f3fa7/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp#L2394
[1] "_ZN4absl13base_internal12CallOnceImplIZNS0_8SpinLock8SpinLoopEvE3$_0JEEEvPNSt3__16atomicIjEENS0_14SchedulingModeEOT_DpOT0_"
[2] https://github.com/llvm/llvm-project/blob/79b222c39f0e4377b49191b6aba080b1607f3fa7/llvm/lib/CodeGen/AsmPrinter/DwarfUnit.cpp#L1066
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D94976/new/
https://reviews.llvm.org/D94976
More information about the llvm-commits
mailing list