Help: GOLD unable to find logf() in libm.so when sysroot is enabled

Ian Lance Taylor iant@google.com
Thu Nov 3 13:33:00 GMT 2016


On Thu, Nov 3, 2016 at 3:15 AM, Nick Clifton <nickc@redhat.com> wrote:
>
>   Do you have a minute to help me with a Fedora binutils bug which I
>   think might be a generic GOLD problem ?
>
>     https://bugzilla.redhat.com/show_bug.cgi?id=1386126
>
>   The problem appears to be that an ARM native GOLD linker built with
>   --with-sysroot=/ enabled reports that it cannot resolve a reference to
>   the logf symbol (in libm.so), despite the fact that it has found the
>   library:
>
>   SYSROOT GOLD
> /usr/lib/ghc-7.10.3/text_HmqVQnZSpjaC156ABqPhne/libHStext-1.2.2.1-HmqVQnZSpjaC156ABqPhne-ghc7.10.3.so: reference to logf
> /usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/libHSbase-4.8.2.0-HQfYBxpPvuw8OunzQu6JGM-ghc7.10.3.so: reference to logf
> /usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3/libHSghc-prim-0.4.0.0-8TmvWUcS1U1IKHT0levwg3-ghc7.10.3.so: reference to logf
> /usr/lib/gcc/armv7hl-redhat-linux-gnueabi/6.2.1/../../../libm.so: definition of logf
> /usr/lib/ghc-7.10.3/text_HmqVQnZSpjaC156ABqPhne/libHStext-1.2.2.1-HmqVQnZSpjaC156ABqPhne-ghc7.10.3.so: error: undefined reference to 'logf'
>
>   NON-SYSROOT GOLD
> /usr/lib/ghc-7.10.3/text_HmqVQnZSpjaC156ABqPhne/libHStext-1.2.2.1-HmqVQnZSpjaC156ABqPhne-ghc7.10.3.so: reference to logf
> /usr/lib/ghc-7.10.3/base_HQfYBxpPvuw8OunzQu6JGM/libHSbase-4.8.2.0-HQfYBxpPvuw8OunzQu6JGM-ghc7.10.3.so: reference to logf
> /usr/lib/ghc-7.10.3/ghcpr_8TmvWUcS1U1IKHT0levwg3/libHSghc-prim-0.4.0.0-8TmvWUcS1U1IKHT0levwg3-ghc7.10.3.so: reference to logf
> /usr/lib/gcc/armv7hl-redhat-linux-gnueabi/6.2.1/../../../libm.so: definition of logf
>
>   Apparently this problem is restricted to the ARM and AARCH64 targets,
>   although I have not verified this.  It may be a factor of the build
>   systems involved, in that the build for non-arm targets might use a
>   different location for the application libraries.  That is just a
>   guess however.
>
>   Also I do not know if the logf symbol is special, or it just happens
>   that this is the only symbol in libm.so that is needed by the
>   libHStext-1.2.2.1-HmqVQnZSpjaC156ABqPhne-ghc7.10.3.so library.  I
>   suspect the latter however.
>
>   I have found that if I add a second reference to logf in an ordinary
>   object file that the link then works.

gold only warns about undefined references from shared libraries in
specific circumstances.  See
Symbol_table::warn_about_undefined_dynobj_symbol in symtab.cc.  I
think that particularly relevant here is that gold does not warn about
an undefined reference in a shared library that it finds in a "system
directory", which basically means a directory found in the sysroot.
I'm guessing that that is somehow the difference between your two
links.  But I don't know why the definition of logf found in libm.so
is not satisfying the references from the other shared libraries.
Could there be any versions involved?

Ian



More information about the Binutils mailing list