Open Quuxplusone opened 2 years ago
Bugzilla Link | PR51737 |
Status | NEW |
Importance | P enhancement |
Reported by | Ye Luo (xw111luoye@gmail.com) |
Reported on | 2021-09-03 10:51:49 -0700 |
Last modified on | 2021-09-10 09:21:48 -0700 |
Version | unspecified |
Hardware | PC Linux |
CC | huberjn@ornl.gov, jdoerfert@anl.gov, llvm-bugs@lists.llvm.org |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
The first problem, when compiling with `-g`, is that the device runtime bitcode
doesn't have debugging symbols, so when we link it in we seem to get some mixed
debug information. LLVM sees that the module has debug information so it tries
to access it to generate the DWARF debugging symbols, but since not everything
has a valid debug symbol it will eventually get a null pointer and crash.
I tried compiling the runtime library with debugging symbols but that lead to
other problems. It seems that there are call instructions in NVPTX that have no
argument. So when we try to generate debugging symbols we will try to create
symbols for the called function, and then crash because there is no called
function to access. This is in addition to some other weird errors I've
encountered where it will talk about missing debug information. I created a
simple module that shows the crash in the back-end but I'm not sure what the
root cause is, I have minimal experience with the back-end.
https://godbolt.org/z/M1WfPP78K
I tried to build bitcode library with debug on and it leads to new issues as
you mentioned. I got crash in
4. Running pass 'NVPTX Assembly Printer' on function '@__kmpc_target_init'
back to the original issue, do you by change bisect into a commit that breaks
this? I'm wondering if we can just restore the old behavior without fixing all
the debug symbol related issue.
I think this working on a previous commit is superficial, LLVM expects valid debug information on everything if the module specifies it supports debugging. Ideally the solution would be to maintain two bitcode libraries, one with debugging and one without, and use each accordingly. However, this doesn't work right now as I mentioned previously. So I don't think there's a real solution until that gets fixed.