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

            Bug ID: 67478
           Summary: gcc-5.1.0/gcc-5.2.0 undefined symbol
                    std::__once_callable in AIX 6.1
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tgard at opentext dot com
  Target Milestone: ---

Created attachment 36299
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36299&action=edit
libstdc++ config.log

When using std::call_once there are two undefined symbols in AIX 6.1 using
gcc-5.1.0 or gcc-5.2.0:

c++ -maix64 -pthread -std=c++11 -c start.cxx
c++ -maix64 -pthread -lstdc++ start.o -o start
ld: 0711-317 ERROR: Undefined symbol: std::__once_callable
ld: 0711-317 ERROR: Undefined symbol: std::__once_call

gcc 5.2.0 configured with:
/builds/gbgbuild/bld/gcc/gcc-5.2.0/configure --prefix=/usr/local/gcc-5.2.0
--enable-languages=c,c++ --with-as=/usr/bin/as --with-ld=/usr/bin/ld
--enable-threads --enable-cxa_atexit --enable-libstdcxx-threads --enable-tls
--with-gmp=/usr/local/lib32-static --with-mpfr=/usr/local/lib32-static
--with-mpc=/usr/local/lib32-static

gcc-5.1.0 produce the same output. This was configured without the parameters
"--enable-libstdcxx-threads --enable-tls".

The symbols are present in libstdc++.so.6 marked with "L" meaning Global
thread-local symbol (TLS)

The source is:

#include <stdio.h>
#include <mutex>

void print_once()
{
        static int cnt = 0;
        static std::once_flag flag;
        std::call_once(
                flag,
                [&]()
                {
                        printf("%d\n", cnt);
                        cnt++;
                } );
}

int main( void )
{
        print_once();
        print_once();
        return 0;
}

Reply via email to