[Bug libstdc++/78968] New: conflict gnu's __cxa_thread_atexit and LLVM's/FreeBSD's

h2+bugs at fsfe dot org gcc-bugzilla@gcc.gnu.org
Mon Jan 2 16:36:00 GMT 2017


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78968

            Bug ID: 78968
           Summary: conflict gnu's __cxa_thread_atexit and
                    LLVM's/FreeBSD's
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: h2+bugs at fsfe dot org
  Target Milestone: ---

I originally reported this here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=215709

libc++ / FreeBSD has recently acquired it's own implementation of
__cxa_thread_atexit so that thread_local storage now works. This is great,
except that it breaks static linkage with GCC which now complains about double
definition:

cd /home/mi/h4nn3s/devel/lambda-build/pkg/src && /usr/local/bin/cmake -E
cmake_link_script CMakeFiles/lambda.dir/link.txt --verbose=1
/usr/local/libexec/ccache/g++6     -fopenmp -Wno-vla -O3 -DNDEBUG -flto=8 -s  
-static CMakeFiles/lambda.dir/lambda.cpp.o  -o ../bin/lambda  -lpthread
-lexecinfo -lelf -lz -lbz2 
//usr/lib/libc.a(cxa_thread_atexit.o): In function `__cxa_thread_atexit':
/usr/src/lib/libc/stdlib/cxa_thread_atexit.c:(.text+0x0): multiple definition
of `__cxa_thread_atexit'
/usr/local/lib/gcc6/gcc/x86_64-portbld-freebsd11.0/6.3.0/../../../libstdc++.a(atexit_thread.o):/wrkdirs/usr/ports/lang/gcc6/work/gcc-6.3.0/libstdc++-v3/libsupc++/atexit_thread.cc:117:
first defined here
collect2: error: ld returned 1 exit status

The FreeBSD maintainer responded with:
This is a bug in gcc.  The libsupc++ configuration assumes that there are
exactly two possibilities: either libc is glibc and implements
__cxa_thread_atexit() using __cxa_thread_atexit_impl(), or libsupc++ must
provide an implementation on its own.  Right solution is to add detection of
__cxa_thread_atexit() in libc, to libstdc++ configure.ac and
libsupc++/atexit_thread.cc.

What is your opinion on the matter?

Thanks!


More information about the Gcc-bugs mailing list