[MDEV-19696] Cleanup gcc sync builtins Created: 2019-06-05  Updated: 2019-11-16  Resolved: 2019-07-03

Status: Closed
Project: MariaDB Server
Component/s: Server
Fix Version/s: 10.4.7

Type: Task Priority: Major
Reporter: Sergey Vojtovich Assignee: Robert Bindar
Resolution: Fixed Votes: 0
Labels: None


 Description   

Since 10.4 requires C++11 capable compiler, gcc sync builtins became dead code. Remove relevant cmake checks and cleanup include files.



 Comments   
Comment by VVD [ 2019-11-16 ]

This change broke build on FreeBSD i386 (12.0 and 12.1):
In file included from /usr/obj/usr/ports/databases/mariadb104-client/work/mariadb-10.4.7/mysys/my_new.cc:25:
In file included from /usr/obj/usr/ports/databases/mariadb104-client/work/mariadb-10.4.7/mysys/mysys_priv.h:20:
In file included from /usr/obj/usr/ports/databases/mariadb104-client/work/mariadb-10.4.7/include/my_sys.h:34:
/usr/obj/usr/ports/databases/mariadb104-client/work/mariadb-10.4.7/include/my_pthread.h:822:10: error: use of undeclared
identifier 'my_atomic_add32'
(void) my_atomic_add32_explicit(value, 1, MY_MEMORY_ORDER_RELAXED);
^
/usr/obj/usr/ports/databases/mariadb104-client/work/mariadb-10.4.7/include/my_atomic.h:153:43: note: expanded from macro
'my_atomic_add32_explicit'
#define my_atomic_add32_explicit(P, A, O) my_atomic_add32((P), (A))

Details are here: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=239981#c2

Comment by Sergey Vojtovich [ 2019-11-16 ]

VVD, no surprise if that's gcc 4.2. Wasn't clang default FreeBSD compiler?

Comment by VVD [ 2019-11-16 ]

clang 8.0.1 is in 12.1, clang 6.0 is in 12.0. gcc 9.2.0 installed too.
But it build fine on same version of FreeBSD (12.0 and 12.1) but amd64. Only difference is arch - i386 vs amd64.

Comment by Sergey Vojtovich [ 2019-11-16 ]

VVD, we observed similar problem on CentOS 5 amd64 vs x86, where we had gcc 4.1.

Could you identify which compiler version triggered this failure?

Comment by VVD [ 2019-11-16 ]

– Running cmake version 3.15.5
– The C compiler identification is Clang 8.0.1
– The CXX compiler identification is Clang 8.0.1
– Check for working C compiler: /usr/bin/cc
– Check for working C compiler: /usr/bin/cc – works
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Detecting C compile features
– Detecting C compile features - done
– Check for working CXX compiler: /usr/bin/c++
– Check for working CXX compiler: /usr/bin/c++ – works

$ /usr/bin/cc --version
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: i386-unknown-freebsd12.1
Thread model: posix
InstalledDir: /usr/bin
$ /usr/bin/c++ --version
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: i386-unknown-freebsd12.1
Thread model: posix
InstalledDir: /usr/bin

Comment by Sergey Vojtovich [ 2019-11-16 ]

Alright, it is something different. clang 7.0 is recent enough to support everything we need, but there was some change wrt atomic handling on 32bit systems. There're quite a few FreeBSD bug reports about it, e.g. https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=230888

It is unlikely, but I wonder if this change is going to help?
https://salsa.debian.org/mariadb-team/mariadb-10.3/blob/master/debian/patches/c11_atomics.patch

Not sure how sync builtins worked in this case, but they're in no way less buggy than what was described in bug 230888. Even worse they lack atomic load/store, which are heavily used by MariaDB. Remember that famous data race of 64bit variable update on 32bit system...

Generated at Thu Feb 08 08:53:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.