Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni via buildroot <buildroot@buildroot.org>
To: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
Cc: buildroot@buildroot.org, Bernd Kuhls <bernd@kuhls.net>,
	 Fabrice Fontaine <fontaine.fabrice@gmail.com>,
	Giulio Benetti <giulio.benetti@benettiengineering.com>,
	 Ismael Luceno <ismael@iodev.co.uk>,
	Romain Naour <romain.naour@gmail.com>
Subject: Re: [Buildroot] [PATCH 06/11] package/libopenssl: extend m68k ColdFire support
Date: Fri, 29 May 2026 15:31:53 +0200	[thread overview]
Message-ID: <ahmScNri2ZIPLaVG@windsurf> (raw)
In-Reply-To: <20260424132326.825570-7-jeanmichel.hautbois@yoseli.org>

Hello Jean-Michel,

On Fri, Apr 24, 2026 at 03:23:21PM +0200, Jean-Michel Hautbois wrote:
> ColdFire has no hardware atomic instructions. Disable OpenSSL's
> atomic operations and inline assembly which assume a different m68k
> variant, and add -fno-strict-aliasing to prevent GCC from optimizing
> away type-punned pointer accesses used in OpenSSL internals.
> 
> Link with libatomic for the 64-bit atomic operations that OpenSSL 3.x
> requires, and force the linux-generic32 target to avoid arch-specific
> assembly paths.
> 
> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
> ---
>  package/libopenssl/libopenssl.mk | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/package/libopenssl/libopenssl.mk b/package/libopenssl/libopenssl.mk
> index bd4b889c88..6009cbb345 100644
> --- a/package/libopenssl/libopenssl.mk
> +++ b/package/libopenssl/libopenssl.mk
> @@ -23,6 +23,9 @@ 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
> +LIBOPENSSL_CFLAGS += -DOPENSSL_NO_ATOMICS -DOPENSSL_NO_ASM -fno-strict-aliasing
> +LIBOPENSSL_CONF_ENV += LDFLAGS="-latomic"
> +LIBOPENSSL_TARGET_ARCH = linux-generic32

Why is this needed now? It is correctly building at least for existing
Coldfire platforms that we support (I believe).

If it needs -latomic, it would most likely need that on other
architectures like Sparc for which atomic built-ins are implemented in
libatomic.

So essentially the problem that I see with your patch that it is
"just" fixing your particular issue in your particular case, but not
really taking a step back and see to which cases which fix/workaround
should apply. For example the -fno-strict-aliasing thing, why is that
Coldfire specific?

Also, have a look at config BR2_PACKAGE_LIBOPENSSL_TARGET_ARCH, it
should already use "linux-generic32 no-asm", which is basically what
you're doing here. Except perhaps you have
BR2_TOOLCHAIN_HAS_LIBATOMIC, which is why "linux-latomic no-asm" gets
used instead?

As you can see, a bit more investigation is needed to have a cleaner
solution.

Thanks!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2026-05-29 13:32 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-24 13:23 [Buildroot] [PATCH 00/11] Add ColdFire MCF5441x (m68k) support Jean-Michel Hautbois
2026-04-24 13:23 ` [Buildroot] [PATCH 01/11] arch/Config.in.m68k: add ColdFire MCF5441x support Jean-Michel Hautbois
2026-04-24 13:23 ` [Buildroot] [PATCH 02/11] package/gcc: force --with-arch=cf on m68k MCF5441x Jean-Michel Hautbois
2026-05-29 10:52   ` Thomas Petazzoni via buildroot
2026-05-30  7:31     ` Jean-Michel Hautbois
2026-05-30  8:09       ` Thomas Petazzoni via buildroot
2026-04-24 13:23 ` [Buildroot] [PATCH 03/11] package/Makefile.in: add global ColdFire workaround flags Jean-Michel Hautbois
2026-05-29 10:55   ` Thomas Petazzoni via buildroot
2026-04-24 13:23 ` [Buildroot] [PATCH 04/11] package/gmp: disable C++ bindings on m68k ColdFire Jean-Michel Hautbois
2026-05-29 11:10   ` Thomas Petazzoni via buildroot
2026-04-24 13:23 ` [Buildroot] [PATCH 05/11] package/gdb: use static libgcc " Jean-Michel Hautbois
2026-05-29 11:12   ` Thomas Petazzoni via buildroot
2026-04-24 13:23 ` [Buildroot] [PATCH 06/11] package/libopenssl: extend m68k ColdFire support Jean-Michel Hautbois
2026-05-29 13:31   ` Thomas Petazzoni via buildroot [this message]
2026-04-24 13:23 ` [Buildroot] [PATCH 07/11] package/dropbear: disable ML-KEM768 on m68k Jean-Michel Hautbois
2026-04-24 14:11   ` Baruch Siach via buildroot
2026-04-29  5:53     ` Jean-Michel Hautbois
2026-04-24 13:23 ` [Buildroot] [PATCH 08/11] package/ntp: Link libatomic when available Jean-Michel Hautbois
2026-05-29 13:35   ` Thomas Petazzoni via buildroot
2026-04-24 13:23 ` [Buildroot] [PATCH 09/11] package/nginx: add m68k ColdFire TLS support Jean-Michel Hautbois
2026-05-29 13:37   ` Thomas Petazzoni via buildroot
2026-04-24 13:23 ` [Buildroot] [PATCH 10/11] package/mawk: create awk symlink on install Jean-Michel Hautbois
2026-05-29 14:00   ` Thomas Petazzoni via buildroot
2026-05-30 15:52     ` Arnout Vandecappelle via buildroot
2026-06-04  5:10       ` Jean-Michel Hautbois
2026-04-24 13:23 ` [Buildroot] [PATCH 11/11] package/libglib2: add m68k ColdFire support Jean-Michel Hautbois
2026-05-29 13:44   ` Thomas Petazzoni via buildroot
2026-05-29 17:51     ` Jean-Michel Hautbois

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=ahmScNri2ZIPLaVG@windsurf \
    --to=buildroot@buildroot.org \
    --cc=bernd@kuhls.net \
    --cc=fontaine.fabrice@gmail.com \
    --cc=giulio.benetti@benettiengineering.com \
    --cc=ismael@iodev.co.uk \
    --cc=jeanmichel.hautbois@yoseli.org \
    --cc=romain.naour@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /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