NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-i386/47061: ld.elf_so does not understand R_386_TLS_TPOFF32



>Number:         47061
>Category:       port-i386
>Synopsis:       ld.elf_so does not understand R_386_TLS_TPOFF32
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-i386-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 12 10:20:00 +0000 2012
>Originator:     Alan Barrett
>Release:        NetBSD 6.99.11
>Organization:
Not much
>Environment:
System: NetBSD 6.99.11 i386
Architecture: i386
Machine: i386
>Description:
The base system's gcc-4.5 compiler and toolchain in NetBSD-current/i386
appears to produce relocation entries that ld.elf_so can't handle.

On a current i386 system, when I attempt to build pkgsrc/lang/gcc47 with
the "gcc-go" option, I get this error while the "go" compiler is being
built:

    .../pkgsrc/lang/gcc47/work/build/./gcc/go1: Unsupported relocation type 37 
in non-PLT relocations

That message appears to be printed by ld.elf_so.  Relocation type 37 is
R_386_TLS_TPOFF32.

According to objdump, the go1 executable contains these relocation
entries of that type:

    $ objdump -R build/./gcc/go1 | grep TLS
    08bd8a48 R_386_TLS_TPOFF32  _ZSt15__once_callable
    08bd8bec R_386_TLS_TPOFF32  _ZSt11__once_call

    $ objdump --demangle -R build/./gcc/go1 | grep TLS
    08bd8a48 R_386_TLS_TPOFF32  std::__once_callable
    08bd8bec R_386_TLS_TPOFF32  std::__once_call

Those symbols appear to come from the new libc++11 that comes with
gcc-4.7, and that is statically linked into the go1 executable The
library is built with "#define _GLIBCXX_HAVE_TLS 1".  Here are the
references to __once_call and __once_callable in the library source:

    gcc-4.7.0/libstdc++-v3/src/c++11/mutex.cc:
    42-_GLIBCXX_BEGIN_NAMESPACE_VERSION
    43-
    44-#ifdef _GLIBCXX_HAVE_TLS
    45:  __thread void* __once_callable;
    46:  __thread void (*__once_call)();
    47-#else
    48-  // Explicit instantiation due to -fno-implicit-instantiation.
    49-  template class function<void()>;
    --
    77-    void __once_proxy()
    78-    {
    79-#ifndef _GLIBCXX_HAVE_TLS
    80:      function<void()> __once_call = std::move(__once_functor);
    81-      if (unique_lock<mutex>* __lock = __get_once_functor_lock_ptr())
    82-      {
    83-        // caller is using new ABI and provided lock ptr
    --
    87-      else
    88-        __get_once_functor_lock().unlock();  // global lock
    89-#endif
    90:      __once_call();
    91-    }
    92-  }
    93-

>How-To-Repeat:
On a NetBSD/i386 system with a recent pkgsrc:

    cd pkgsrc/lang/gcc47
    make PKG_OPTIONS.gcc47=gcc-go

After a while, the build will fail with a message like this:

    .../pkgsrc/lang/gcc47/work/build/./gcc/go1: Unsupported relocation type 37 
in non-PLT relocations

>Fix:
Add support for relocation type 37 (R_386_TLS_TPOFF32) to ld.elf_so.



Home | Main Index | Thread Index | Old Index