[llvm-dev] How to debug a missing symbol with ThinLTO?

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Wed Jul 22 00:11:28 PDT 2020


Got a link to the source/build instructions?

This sort of thing happens more often in C++ with templates where one
object depends (incorrectly) on an implicit instantiation created in
another object, rather than carrying its own instantiation.

Not sure what might cause it in C code.

On Tue, Jul 21, 2020 at 11:47 PM Tobias Hieta via llvm-dev
<llvm-dev at lists.llvm.org> wrote:
>
> Hello,
>
> I am building libogg with clang (10.0.1) on macOS and if I pass
> "-flto=thin" to C and LDFLAGS it will not link correctly claiming
> missing symbols when linking to the archive (libogg.a).
>
> undef: _ogg_stream_init
> Undefined symbols for architecture x86_64:
> "_ogg_stream_init", referenced from:
> _main in lto.o
>
> Removing lto=thin fixes the problem. Inspecting the AR libs with
> llvm-nm I see the symbol there (but without address):
>
> not working archive:
> ---------------- T _ogg_stream_init
>
> working archive:
> 0000000000000200 T _ogg_stream_init
>
> My guess is that this output is correct since the archive contains
> bitcode in the thin lto case and otherwise it's the finished object.
>
> It seems to me that the LTO decides to not include this symbol? It's
> defined like this:
>
> extern int ogg_stream_init(ogg_stream_state *os,int serialno);
>
> llvm-ar is used to create the archive.
>
> Is there any good way to debug this?
>
> Thanks,
> Tobias
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev


More information about the llvm-dev mailing list