]> git.ipfire.org Git - thirdparty/squid.git/commit
gcc-8+ build error: undefined reference to __atomic_is_lock_free (#625)
authorEduard Bagdasaryan <eduard.bagdasaryan@measurement-factory.com>
Tue, 12 May 2020 14:50:10 +0000 (14:50 +0000)
committerAmos Jeffries <yadij@users.noreply.github.com>
Fri, 29 May 2020 18:38:59 +0000 (06:38 +1200)
commitf187e5cf415604d4fe839ba57120d846bfa1e672
tree7d99d27c06562791cbdc753a76ea34492b6616f0
parent2ac097033b6154ee803982900711b7f0a6629284
gcc-8+ build error: undefined reference to __atomic_is_lock_free (#625)

Compilers warned about AC_SEARCH_LIBS(__atomic_load_8)-generated code.
Newer, stricter compilers (e.g., gcc-8), exit with an error, resulting
in AC_SEARCH_LIBS failure when determining whether libatomic is needed.

More at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=907277#30

It is unclear whether autoconf will ever handle this case better. Let's
use a custom-made test for now. The current test refuses to build Squid
on platforms where a program using std::atomic<T>::is_lock_free() cannot
be successfully linked (either with or without libatomic) for a the
largest atomic T used by Squid (i.e. a 64 bit integer).

Linking with libatomic may be required for many reasons that we do not
fully understand, but we know that std::atomic<T>::is_lock_free() does
require linking with libatomic in some environments, even where T is an
inlineable atomic. That is why we use that as a test case.
configure.ac