pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: openssl: "architecture lacks an FPU" on Debian 12/armv7



Hi,

Quoting both previous mails here:

Am Samstag, 13. Juli 2024, 02:28:17 CEST schrieb Greg Troxel:
> NetBSD earmv7hf-el is the build that runs on the RPI2/3, and that
> assumes float.   I bet there are armv7 that do not have hardware
> floating point.
> 
> It seems that RaspiOS is targetting an armv7 w/o FP.  This is very
> strange to me.
>
> [...]
>
> This feels wrong.  If building for a target w/o FP, then the fix is to
> not pass -mfloat-abi-hard.
> 
> But the real fix is that RaspiOS for RPI2 should target hardfloat.

I don't think this is about what the OS targets. The issue is caused by
the addition of soft-float target -march=armv7-a to CFLAGS by Configure
which it shouldn't be doing, as you write:

> So I would say
> 
>   > It turns out having to with openssl's configure adding
>   > -march=armv7-a
> 
> that it is buggy of openssl to add that, rather than building for the
> cpu that the compiler is configured to build for.
> 
> This is the comment that seems right to me
> 
>   https://github.com/openssl/openssl/issues/21630#issuecomment-2153338
>   377
> 
> With a native compilation, the target should be the default target of
> the compiler.  The OS/packaging system has already chosen what that
> target should be.

Yes I agree. On armv[7-9]m util/perl/OpenSSL/config.pm adds the -march
(note that linux2 is Linux[2-9], not just 2.x):

   656        [ 'armv[1-3].*-.*-linux2',  { target => "linux-generic32" } ],
   657        [ 'armv[7-9].*-.*-linux2',  { target => "linux-armv4",
   658                                      cflags => [ '-march=armv7-a' ],
   659                                      cxxflags => [ '-march=armv7-a' ] } ],
   660        [ 'arm.*-.*-linux2',        { target => "linux-armv4" } ]

Picking the linux-armv4 target directly avoids that. We could also:

 1. Patch out those two lines.

 2. Go the Debian route by patching in our own target list
    (debian/patches/debian-targets.patch):

      "debian" => {
              cflags => add("-Wa,--noexecstack -Wall -fzero-call-used-regs=used-gpr -DOPENSSL_TLS_SECURITY_LEVEL=2"),
      },
      ...
      "debian-armhf" => {
              inherit_from => [ "linux-armv4", "debian" ],
      }

    Configure is then called with target debian-$(DEB_HOST_ARCH), which
    in this case is debian-armhf which ends up being the linux-armv4
    target again (plus the global extra Debian flags).

Note that each of these end up essentially using OpenSSL's armv4 target.

Sijmen




Home | Main Index | Thread Index | Old Index