Linux ppc64 - compatibility-ldbl.o can't find std::num_put

Brian Groose brian@groose.com
Tue Apr 23 20:33:00 GMT 2019
Thanks for the great analysis, Alan!

It sounds like I have a good workaround there by forcing -lstdc++ first there.

As I'd like to get to the bottom of this, I assume my next question
should be "why does boost have the same function that libstdc++
does?", right?  If so, I'll see if I can track one down, as it doesn't
sound like ld is doing anything unexpected here.

On Tue, Apr 23, 2019 at 6:49 AM Alan Modra <amodra@gmail.com> wrote:
>
> On Mon, Apr 22, 2019 at 12:04:25PM -0400, Brian Groose wrote:
> > Everything can be dropped into one directory and fails to link with this
> > /PATH/TO/NEWER/G++/g++ -L. -Wl,-z,noexecstack -static-libgcc
> > -static-libstdc++ -g *.o -lvirtualization -lagtframework
> > -lvirtualization -ldas -loracle -lgeneric -lnas -lsystemstate
> > -lstoragemgmt -lsmartcopy -lagtframework -lagentutils -ludplinuxutils
> > -ludpzfsutils -lpthread -lrt -Wl,-Bstatic -lACE -lssl -lcrypto -lz
> > -lxml2 -lboost_chrono -lboost_filesystem -lboost_locale
> > -lboost_program_options -lboost_system -lboost_thread -Wl,-Bdynamic
> > -ldl -lrt -lpam -o udsagent
>
> OK, minus the -lpam I can link this and reproduce the problem here.
>
> libboost_locale.a is the culprit.
>
> The first complaint about an undefined symbol (linking with
> -Wl,--no-demangle) is
> _ZNKSt7num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES3_S3_RSt8ios_basecT_
>
> This is actually defined in libstdc++.a(locale-inst.o) .opd section
> (it's a function descriptor) an alias for
> _ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_
> with the corresponding code in section
> .text._ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_
>
> That section is a member of a comdat group
> COMDAT group section [  206] `.group' [_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_] contains 2 sections:
>    [Index]    Name
>    [  837]   .text._ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_
>    [  838]   .rela.text._ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_base
>
> The trouble is, you have another copy of that group in
> libboost_locale.a(numeric.o)
> COMDAT group section [  139] `.group' [_ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_] contains 2 sections:
>    [Index]    Name
>    [  535]   .text._ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_basecT_
>    [  536]   .rela.text._ZNKSt17__gnu_cxx_ldbl1287num_putIcSt19ostreambuf_iteratorIcSt11char_traitsIcEEE13_M_insert_intIlEES4_S4_RSt8ios_base
>
> Only one of these groups gets linked in, the first.  Since you link
> libboost_locale.a before libstdc++.a you get the libboost_local.a
> version, which doesn't have the alias symbols defined.  I'll note that
> object files with different sets of global symbols in comdat groups is
> a worry, indicating that your libboost isn't properly compatible with
> your libstdc++.
>
> I found it was possible to link the static libstdc++ just before
> -lboost_locale without linker complaint (libstdc++.a will be linked
> afterwards too).
>
> powerpc64-linux-g++ -L. -Wl,-z,noexecstack -static-libgcc  -static-libstdc++ -g *.o -lvirtualization -lagtframework -lvirtualization -ldas -loracle -lgeneric -lnas -lsystemstate -lstoragemgmt -lsmartcopy -lagtframework -lagentutils -ludplinuxutils -ludpzfsutils -lpthread -lrt -Wl,-Bstatic -lACE -lssl -lcrypto -lz -lxml2 -lboost_chrono -lboost_filesystem -lstdc++ -lboost_locale -lboost_program_options -lboost_system -lboost_thread -Wl,-Bdynamic -ldl -lrt -o udsagent
>
> --
> Alan Modra
> Australia Development Lab, IBM



More information about the Binutils mailing list