[Buildroot] [PATCH v2 1/2] package/libopenssl: disable atomic operations for m68k Coldfire

Peter Korsgaard peter at korsgaard.com
Fri Sep 4 11:51:28 UTC 2026


>>>>> "Bernd" == Bernd Kuhls <bernd at kuhls.net> writes:

 > This patch fixes a build error with OpenSSL-enabled libcurl which was
 > detected by the Gitlab pipelines:

 > checking for openssl options with pkg-config... found
 > configure: pkg-config: SSL_LIBS: "-lssl -lcrypto -pthread"
 > configure: pkg-config: SSL_LDFLAGS: "-L/builds/bkuhls/buildroot/br-test-pkg/bootlin-m68k-5208-uclibc/host/bin/../m68k-buildroot-uclinux-uclibc/sysroot/usr/lib"
 > configure: pkg-config: SSL_CPPFLAGS: ""
 > checking for HMAC_Update in -lcrypto... no
 > checking for HMAC_Init_ex in -lcrypto... no
 > checking OpenSSL linking with -ldl... no
 > checking OpenSSL linking with -ldl and -lpthread... no
 > checking for SSL_set_quic_use_legacy_codepoint... no
 > checking for SSL_set_quic_tls_cbs... no
 > configure: OpenSSL version does not speak any known QUIC API
 > configure: OPT_OPENSSL: /builds/bkuhls/buildroot/br-test-pkg/bootlin-m68k-5208-uclibc/host/m68k-buildroot-uclinux-uclibc/sysroot/usr
 > configure: OPENSSL_ENABLED:
 > configure: error: --with-openssl was given but OpenSSL could not be detected
 > make[1]: *** [package/pkg-generic.mk:263: /builds/bkuhls/buildroot/br-test-pkg/bootlin-m68k-5208-uclibc/build/libcurl-8.21.0/.stamp_configured] Error 1

 > Although OpenSSL was found using pkg-config the build tests fail.

 > A local build shows the concrete error in config.log, for example:

 > configure:27577: checking for HMAC_Update in -lcrypto
 > configure:27599: /home/bernd/buildroot/output/host/bin/m68k-linux-gcc
 >  -o conftest -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
 >  -D_FILE_OFFSET_BITS=64 -O2 -g0 -fno-dwarf2-cfi-asm -Wl,-elf2flt=-r
 >  -static -Werror-implicit-function-declaration -Wno-system-headers
 >  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
 >  -D_GNU_SOURCE     -Wl,-elf2flt=-r -static
 >  -L/home/bernd/buildroot/output/host/bin/../m68k-buildroot-uclinux-uclibc/sysroot/usr/lib
 >  -L/home/bernd/buildroot/output/host/bin/../m68k-buildroot-uclinux-uclibc/sysroot/usr/lib
 >  conftest.c -lcrypto  -lssl -lcrypto -lz -pthread -lz  >&5
 > /home/bernd/buildroot/output/host/opt/ext-toolchain/m68k-buildroot-uclinux-uclibc/bin/ld.real:
 >  /home/bernd/buildroot/output/host/bin/../m68k-buildroot-uclinux-uclibc/sysroot/usr/lib/libcrypto.a(libcrypto-lib-threads_pthread.o):
 >  in function `ossl_rcu_read_lock':
 > threads_pthread.c:(.text+0xa4): undefined reference to `__atomic_fetch_add_8'

 > This error occurs many times for various atomic operations:

 > $ grep "undefined reference to \`__atomic" output/build/libcurl-8.20.0/config.log | sort -u | grep -v real
 > threads_pthread.c:(.text+0x28a): undefined reference to `__atomic_fetch_sub_8'
 > threads_pthread.c:(.text+0x3b4): undefined reference to `__atomic_fetch_add_8'
 > threads_pthread.c:(.text+0x9c8): undefined reference to `__atomic_is_lock_free'
 > threads_pthread.c:(.text+0xa4): undefined reference to `__atomic_fetch_add_8'
 > threads_pthread.c:(.text+0xa9c): undefined reference to `__atomic_is_lock_free'
 > threads_pthread.c:(.text+0xb66): undefined reference to `__atomic_is_lock_free'
 > threads_pthread.c:(.text+0xc30): undefined reference to `__atomic_is_lock_free'
 > threads_pthread.c:(.text+0xcdc): undefined reference to `__atomic_is_lock_free'

 > The build error can be reproduced with the current buildroot tree using
 > this defconfig:

 > BR2_m68k=y
 > BR2_m68k_cf5208=y
 > BR2_TOOLCHAIN_EXTERNAL=y
 > BR2_TOOLCHAIN_EXTERNAL_BOOTLIN_M68K_COLDFIRE_UCLIBC_STABLE=y
 > BR2_PACKAGE_OPENSSL=y
 > BR2_PACKAGE_LIBCURL=y

 > Although the toolchain lacks atomics support

 > $ grep ATOMIC .config
 > $

 > it emits atomic-related defines, for example:

 > $ echo | output/host/bin/m68k-linux-gcc -dM -E - | grep __ATOMIC_ACQ_REL
 > #define __ATOMIC_ACQ_REL 4
 > $

 > This specific define __ATOMIC_ACQ_REL is used in OpenSSL to enable
 > atomic support at various places:
 > https://github.com/openssl/openssl/blob/openssl-3.6.3/crypto/threads_pthread.c

 > causing the build errors we see with the mentioned defconfig.

 > To fix the problem we use an OpenSSL-provided define to forcefully
 > disable the usage of atomic intrinsics.

 > The misdetection of atomic intrinsics for m68k coldfire is not a new
 > problem:
 > https://lists.buildroot.org/pipermail/buildroot/2017-May/180841.html
 > https://lists.buildroot.org/pipermail/buildroot/2026-May/803110.html

 > Signed-off-by: Bernd Kuhls <bernd at kuhls.net>
 > ---
 > v2: fixed patch description (Baruch)

Committed, thanks.

-- 
Bye, Peter Korsgaard


More information about the buildroot mailing list