From: Baruch Siach via buildroot <buildroot@buildroot.org>
To: Bernd Kuhls <bernd@kuhls.net>
Cc: buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH 1/2] package/libopenssl: disable atomic operations for m68k Coldfire
Date: Thu, 03 Sep 2026 07:02:58 +0300 [thread overview]
Message-ID: <874ig7nfrh.fsf@tarshish> (raw)
In-Reply-To: <20260902203317.2400170-1-bernd@kuhls.net> (Bernd Kuhls's message of "Wed, 2 Sep 2026 22:33:15 +0200")
Hi Bernd,
On Wed, Sep 02 2026, Bernd Kuhls wrote:
> 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
> $
git-commit strips lines starting with '#' from commit message. Try
committing with --cleanup=whitespace.
Thanks for the patch,
baruch
>
> 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@kuhls.net>
> ---
> package/libopenssl/libopenssl.mk | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/package/libopenssl/libopenssl.mk b/package/libopenssl/libopenssl.mk
> index 9ddc85c197..9b3eec4baa 100644
> --- a/package/libopenssl/libopenssl.mk
> +++ b/package/libopenssl/libopenssl.mk
> @@ -23,6 +23,10 @@ ifeq ($(BR2_m68k_cf),y)
> LIBOPENSSL_CFLAGS += -mxgot
> # resolves an assembler "out of range error" with blake2 and sha512 algorithms
> LIBOPENSSL_CFLAGS += -DOPENSSL_SMALL_FOOTPRINT
> +# disable atomic operations
> +ifeq ($(BR2_TOOLCHAIN_HAS_ATOMIC),)
> +LIBOPENSSL_CFLAGS += -DBROKEN_CLANG_ATOMICS
> +endif
> endif
>
> ifeq ($(BR2_USE_MMU),)
--
~. .~ Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
- baruch@tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
prev parent reply other threads:[~2026-09-03 4:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-02 20:33 [Buildroot] [PATCH 1/2] package/libopenssl: disable atomic operations for m68k Coldfire Bernd Kuhls
2026-09-02 20:33 ` [Buildroot] [PATCH 2/2] package/libcurl: security bump to version 8.22.0 Bernd Kuhls
2026-09-03 4:02 ` Baruch Siach via buildroot [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874ig7nfrh.fsf@tarshish \
--to=buildroot@buildroot.org \
--cc=baruch@tkos.co.il \
--cc=bernd@kuhls.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox