[PATCH] D43690: [ThinLTO] Keep available_externally symbols live

Xin Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 22 17:38:23 PDT 2018


trentxintong added a comment.

In https://reviews.llvm.org/D43690#1206134, @trentxintong wrote:

> In https://reviews.llvm.org/D43690#1206049, @vlad.tsyrklevich wrote:
>
> > In https://reviews.llvm.org/D43690#1201965, @twoh wrote:
> >
> > > Hello, I wonder if we need to keep linkonce_odr symbols live here as well. I observe a case that a vtable for template class initiated has linkonce_odr linkage and marked dead here, which results compiler crash at WholeProgramDevirt because the global variable for vtable doesn't have initializer (https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/IPO/WholeProgramDevirt.cpp#L676 assumes that GV has the initializer). Thanks!
> >
> >
> > I'm not sure why a linkonce_odr GV would be marked non-prevailing. Do you have a minimized example to look at?
>
>
> Hi @vlad.tsyrklevich, @twoh
>
> I am working on creating a reduced test case. Will get back to you.
> Thanks
>
> In https://reviews.llvm.org/D43690#1206049, @vlad.tsyrklevich wrote:
>
> > In https://reviews.llvm.org/D43690#1201965, @twoh wrote:
> >
> > > Hello, I wonder if we need to keep linkonce_odr symbols live here as well. I observe a case that a vtable for template class initiated has linkonce_odr linkage and marked dead here, which results compiler crash at WholeProgramDevirt because the global variable for vtable doesn't have initializer (https://github.com/llvm-mirror/llvm/blob/master/lib/Transforms/IPO/WholeProgramDevirt.cpp#L676 assumes that GV has the initializer). Thanks!
> >
> >
> > I'm not sure why a linkonce_odr GV would be marked non-prevailing. Do you have a minimized example to look at?
>


Hi @vlad.tsyrklevich @twoh

I file this bug report here. I would like to fix this bug. Can you help me ? In the bug, we have a file (main.cpp) that gets compiled to ELF directly, and (unknown.cpp) that gets compiled to IR object file. At link stage, the vtable for class B in the ELF file is the prevailing one and the one in the IR object files does not get picked and linked into Composite by the IRMover. WMD expects the the vtable to be a definition with initializer (we have a declaration for it after IR linking).  
As for the solution, I wonder whether we should/could change the linkage info in the GV summary information here since we changed the GV's linkage. https://github.com/llvm-mirror/llvm/blob/master/lib/LTO/LTO.cpp#L664

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

Thanks


Repository:
  rL LLVM

https://reviews.llvm.org/D43690





More information about the llvm-commits mailing list