Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [git commit] utils/genrandconfig: disable libopenssl without atomics
@ 2022-09-18 13:36 Arnout Vandecappelle
  2022-09-18 15:18 ` Yann E. MORIN
  2022-09-29 13:54 ` Peter Korsgaard
  0 siblings, 2 replies; 3+ messages in thread
From: Arnout Vandecappelle @ 2022-09-18 13:36 UTC (permalink / raw)
  To: buildroot

commit: https://git.buildroot.net/buildroot/commit/?id=af494d92d3d065a8939f0567bfbf312d177048f2
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

libopenssl needs atomic or the build will fail (e.g. on sparcv8 without
libatomic):

${LDCMD:-/nvmedata/autobuild/instance-7/output-1/host/bin/sparc-buildroot-linux-uclibc-gcc}  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -O0 -g2  -g2  -L.   \
	-o apps/openssl apps/asn1pars.o apps/ca.o apps/ciphers.o apps/cms.o apps/crl.o apps/crl2p7.o apps/dgst.o apps/dhparam.o apps/dsa.o apps/dsaparam.o apps/ec.o apps/ecparam.o apps/enc.o apps/engine.o apps/errstr.o apps/gendsa.o apps/genpkey.o apps/genrsa.o apps/nseq.o apps/ocsp.o apps/openssl.o apps/passwd.o apps/pkcs12.o apps/pkcs7.o apps/pkcs8.o apps/pkey.o apps/pkeyparam.o apps/pkeyutl.o apps/prime.o apps/rand.o apps/rehash.o apps/req.o apps/rsa.o apps/rsautl.o apps/s_client.o apps/s_server.o apps/s_time.o apps/sess_id.o apps/smime.o apps/speed.o apps/spkac.o apps/srp.o apps/storeutl.o apps/ts.o apps/verify.o apps/version.o apps/x509.o \
	 apps/libapps.a -lssl -lcrypto -ldl
/nvmedata/autobuild/instance-7/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/10.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: ./libssl.so: undefined reference to `__atomic_fetch_sub_4'

It should be noted that openssl3 has added OPENSSL_DEV_NO_ATOMICS but
"this is intended for internal development only, to check the
refcounting is properly coded.  It should never become a configuration
option, hence the name of the macro.":
https://github.com/openssl/openssl/commit/503d4745a115b82db01c1fb22baaddb153d27cdb

Atomics are not available in Buildroot if:
 - architecture is 32 bit and something other than ARM or xtensa, and
 - GCC < 4.8 or no threads or FLAT.

The nothreads case can theoretically happen in many different
situations, but in practice nobody disables threads. So the only
interesting case is the FLAT case. Since ARM and RISC-V 64 both have
atomics intrinsics, that leaves just m68k NOMMU as FLAT. So this is
truly a corner case.

The proper solution would be to patch GCC to also provide libatomic in
those cases.
- For nothreads, atomics are in fact not needed, so libatomic can simply
  be implemented as stubs.
- For FLAT, it's probably just a matter of having a match to uclinux in
  libatomic/configure.tgt.

Again, though, this happens only in such niche cases that it's not worth
working on it.

Fixes:
 - http://autobuild.buildroot.org/results/bce526d538f43a541fdfbc0c9b4a7cecebbbc539

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
---
 utils/genrandconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/utils/genrandconfig b/utils/genrandconfig
index 7fd17239c5..efa73e938d 100755
--- a/utils/genrandconfig
+++ b/utils/genrandconfig
@@ -247,6 +247,11 @@ def fixup_config(sysinfo, configfile):
     if 'BR2_ARM_CPU_ARMV7M=y\n' in configlines and \
        'BR2_PACKAGE_LIBFFI=y\n' in configlines:
         return False
+    # libopenssl needs atomic, but propagating this dependency in
+    # Buildroot is really too much work, so we handle this here.
+    if 'BR2_PACKAGE_LIBOPENSSL=y\n' in configlines and \
+       not 'BR2_TOOLCHAIN_HAS_ATOMIC=y\n' in configlines:
+        return False
     if 'BR2_PACKAGE_SUNXI_BOARDS=y\n' in configlines:
         configlines.remove('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE=""\n')
         configlines.append('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/hackberry.fex"\n')
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [git commit] utils/genrandconfig: disable libopenssl without atomics
  2022-09-18 13:36 [Buildroot] [git commit] utils/genrandconfig: disable libopenssl without atomics Arnout Vandecappelle
@ 2022-09-18 15:18 ` Yann E. MORIN
  2022-09-29 13:54 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Yann E. MORIN @ 2022-09-18 15:18 UTC (permalink / raw)
  To: Fabrice Fontaine; +Cc: buildroot

Fabrice, All,

On 2022-09-18 15:36 +0200, Arnout Vandecappelle spake thusly:
> commit: https://git.buildroot.net/buildroot/commit/?id=af494d92d3d065a8939f0567bfbf312d177048f2
> branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master
> 
> libopenssl needs atomic or the build will fail (e.g. on sparcv8 without
> libatomic):
[--SNIP--]
> diff --git a/utils/genrandconfig b/utils/genrandconfig
> index 7fd17239c5..efa73e938d 100755
> --- a/utils/genrandconfig
> +++ b/utils/genrandconfig
> @@ -247,6 +247,11 @@ def fixup_config(sysinfo, configfile):
>      if 'BR2_ARM_CPU_ARMV7M=y\n' in configlines and \
>         'BR2_PACKAGE_LIBFFI=y\n' in configlines:
>          return False
> +    # libopenssl needs atomic, but propagating this dependency in
> +    # Buildroot is really too much work, so we handle this here.
> +    if 'BR2_PACKAGE_LIBOPENSSL=y\n' in configlines and \
> +       not 'BR2_TOOLCHAIN_HAS_ATOMIC=y\n' in configlines:

This triggers a flake8 warning:
    https://gitlab.com/buildroot.org/buildroot/-/jobs/3045260108

    $ make check-flake8
    utils/genrandconfig:253:8: E713 test for membership should be 'not in'
    1     E713 test for membership should be 'not in'

I've pushed a fix with commit fa538315dc02 (utils/genrandconfig: fix
flake8).

Regards,
Yann E. MORIN.

> +        return False
>      if 'BR2_PACKAGE_SUNXI_BOARDS=y\n' in configlines:
>          configlines.remove('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE=""\n')
>          configlines.append('BR2_PACKAGE_SUNXI_BOARDS_FEX_FILE="a10/hackberry.fex"\n')
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Buildroot] [git commit] utils/genrandconfig: disable libopenssl without atomics
  2022-09-18 13:36 [Buildroot] [git commit] utils/genrandconfig: disable libopenssl without atomics Arnout Vandecappelle
  2022-09-18 15:18 ` Yann E. MORIN
@ 2022-09-29 13:54 ` Peter Korsgaard
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Korsgaard @ 2022-09-29 13:54 UTC (permalink / raw)
  To: Arnout Vandecappelle; +Cc: buildroot

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

 > commit: https://git.buildroot.net/buildroot/commit/?id=af494d92d3d065a8939f0567bfbf312d177048f2
 > branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

 > libopenssl needs atomic or the build will fail (e.g. on sparcv8 without
 > libatomic):

 > ${LDCMD:-/nvmedata/autobuild/instance-7/output-1/host/bin/sparc-buildroot-linux-uclibc-gcc}  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64  -O0 -g2  -g2  -L.   \
 > 	-o apps/openssl apps/asn1pars.o apps/ca.o apps/ciphers.o apps/cms.o apps/crl.o apps/crl2p7.o apps/dgst.o apps/dhparam.o apps/dsa.o apps/dsaparam.o apps/ec.o apps/ecparam.o apps/enc.o apps/engine.o apps/errstr.o apps/gendsa.o apps/genpkey.o apps/genrsa.o apps/nseq.o apps/ocsp.o apps/openssl.o apps/passwd.o apps/pkcs12.o apps/pkcs7.o apps/pkcs8.o apps/pkey.o apps/pkeyparam.o apps/pkeyutl.o apps/prime.o apps/rand.o apps/rehash.o apps/req.o apps/rsa.o apps/rsautl.o apps/s_client.o apps/s_server.o apps/s_time.o apps/sess_id.o apps/smime.o apps/speed.o apps/spkac.o apps/srp.o apps/storeutl.o apps/ts.o apps/verify.o apps/version.o apps/x509.o \
 > 	 apps/libapps.a -lssl -lcrypto -ldl
 > /nvmedata/autobuild/instance-7/output-1/host/lib/gcc/sparc-buildroot-linux-uclibc/10.3.0/../../../../sparc-buildroot-linux-uclibc/bin/ld: ./libssl.so: undefined reference to `__atomic_fetch_sub_4'

 > It should be noted that openssl3 has added OPENSSL_DEV_NO_ATOMICS but
 > "this is intended for internal development only, to check the
 > refcounting is properly coded.  It should never become a configuration
 > option, hence the name of the macro.":
 > https://github.com/openssl/openssl/commit/503d4745a115b82db01c1fb22baaddb153d27cdb

 > Atomics are not available in Buildroot if:
 >  - architecture is 32 bit and something other than ARM or xtensa, and
 >  - GCC < 4.8 or no threads or FLAT.

 > The nothreads case can theoretically happen in many different
 > situations, but in practice nobody disables threads. So the only
 > interesting case is the FLAT case. Since ARM and RISC-V 64 both have
 > atomics intrinsics, that leaves just m68k NOMMU as FLAT. So this is
 > truly a corner case.

 > The proper solution would be to patch GCC to also provide libatomic in
 > those cases.
 > - For nothreads, atomics are in fact not needed, so libatomic can simply
 >   be implemented as stubs.
 > - For FLAT, it's probably just a matter of having a match to uclinux in
 >   libatomic/configure.tgt.

 > Again, though, this happens only in such niche cases that it's not worth
 > working on it.

 > Fixes:
 >  - http://autobuild.buildroot.org/results/bce526d538f43a541fdfbc0c9b4a7cecebbbc539

 > Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
 > Signed-off-by: Arnout Vandecappelle <arnout@mind.be>

Committed to 2022.08.x, thanks.

-- 
Bye, Peter Korsgaard
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-29 13:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-18 13:36 [Buildroot] [git commit] utils/genrandconfig: disable libopenssl without atomics Arnout Vandecappelle
2022-09-18 15:18 ` Yann E. MORIN
2022-09-29 13:54 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox