Skip to content
  • Tor Didriksen's avatar
    d155853c
    Bug #30562248 ADD SUPPORT FOR GCC AND CLANG ON SOLARIS · d155853c
    Tor Didriksen authored
    Do not reject clang or gcc as unsupported compilers on Solaris.
    Note that both compilers are experimental, and cannot currently be used
    for production code.
    
    Add misc FLAGS settings for using clang on Solaris.
    It uses gcc9 libraries and headers, so we need explicit -Wl,-L... arguments.
    
    Fix a few cmake places where we assume that SunPro is the only compiler
    available on Solaris.
    
    Silence some gcc warnings previously only relevant on Linux.
    
    Note that clang is completely unusable at this point,
    'static thread_local' variables will cause segfault during atexit processing.
    There is a new test executable to prove it.
    
    For non-trivial uses of static thread_local, the compiler will give an error:
    storage/temptable/src/allocator.cc:45:32: error:
    cannot compile this non-trivial TLS destruction yet
    static thread_local End_thread end_thread;
    
    gcc seems to work reasonably well on Intel, except for GIS boost code.
    gcc on Sparc works OK for DEBUG builds. Non-DEBUG builds however fail
    to bootstrap. The stack is garbled when handle_bootstrap() does:
        if (handler) {
          args->m_bootstrap_error = (*handler)(thd);
    when called from Dictionary_impl::init() like this:
      // Creation of Data Dictionary through current server
      if (dd_init == enum_dd_init_type::DD_INITIALIZE)
        result = ::bootstrap::run_bootstrap_thread(
            nullptr, nullptr, &bootstrap::initialize, SYSTEM_THREAD_DD_INITIALIZE);
    
    Tested with clang on Intel:
    /bin/clang --version
    clang version 6.0.1 (tags/RELEASE_601/final)
    uname -a
    SunOS xxxxxx 5.11 11.4.15.5.0 i86pc i386 i86pc
    
    Tested with gcc on Intel and Sparc:
    /usr/gcc/9/bin/gcc --version
    gcc (GCC) 9.2.0
    uname -a
    SunOS xxxxxx 5.11 11.4.15.5.0 i86pc i386 i86pc
    uname -a
    SunOS xxxxxx 5.11 11.4.15.5.0 sun4v sparc sun4v
    
    Change-Id: Ia57ef8cd6e448804ece0dbfd66da1695a8e7361f
    d155853c
    Bug #30562248 ADD SUPPORT FOR GCC AND CLANG ON SOLARIS
    Tor Didriksen authored
    Do not reject clang or gcc as unsupported compilers on Solaris.
    Note that both compilers are experimental, and cannot currently be used
    for production code.
    
    Add misc FLAGS settings for using clang on Solaris.
    It uses gcc9 libraries and headers, so we need explicit -Wl,-L... arguments.
    
    Fix a few cmake places where we assume that SunPro is the only compiler
    available on Solaris.
    
    Silence some gcc warnings previously only relevant on Linux.
    
    Note that clang is completely unusable at this point,
    'static thread_local' variables will cause segfault during atexit processing.
    There is a new test executable to prove it.
    
    For non-trivial uses of static thread_local, the compiler will give an error:
    storage/temptable/src/allocator.cc:45:32: error:
    cannot compile this non-trivial TLS destruction yet
    static thread_local End_thread end_thread;
    
    gcc seems to work reasonably well on Intel, except for GIS boost code.
    gcc on Sparc works OK for DEBUG builds. Non-DEBUG builds however fail
    to bootstrap. The stack is garbled when handle_bootstrap() does:
        if (handler) {
          args->m_bootstrap_error = (*handler)(thd);
    when called from Dictionary_impl::init() like this:
      // Creation of Data Dictionary through current server
      if (dd_init == enum_dd_init_type::DD_INITIALIZE)
        result = ::bootstrap::run_bootstrap_thread(
            nullptr, nullptr, &bootstrap::initialize, SYSTEM_THREAD_DD_INITIALIZE);
    
    Tested with clang on Intel:
    /bin/clang --version
    clang version 6.0.1 (tags/RELEASE_601/final)
    uname -a
    SunOS xxxxxx 5.11 11.4.15.5.0 i86pc i386 i86pc
    
    Tested with gcc on Intel and Sparc:
    /usr/gcc/9/bin/gcc --version
    gcc (GCC) 9.2.0
    uname -a
    SunOS xxxxxx 5.11 11.4.15.5.0 i86pc i386 i86pc
    uname -a
    SunOS xxxxxx 5.11 11.4.15.5.0 sun4v sparc sun4v
    
    Change-Id: Ia57ef8cd6e448804ece0dbfd66da1695a8e7361f
Loading