* [Buildroot] [PATCH 2/3] package/libopenssl: add -latomic to libcrypto.pc when needed
2023-07-21 18:06 [Buildroot] [PATCH 1/3] package/libopenssl: remove deprecated options Bernd Kuhls
@ 2023-07-21 18:06 ` Bernd Kuhls
2023-07-21 21:04 ` Thomas Petazzoni via buildroot
2023-07-21 18:06 ` [Buildroot] [PATCH 3/3] package/libopenssl: enable threads on static builds Bernd Kuhls
2023-07-21 21:02 ` [Buildroot] [PATCH 1/3] package/libopenssl: remove deprecated options Thomas Petazzoni via buildroot
2 siblings, 1 reply; 5+ messages in thread
From: Bernd Kuhls @ 2023-07-21 18:06 UTC (permalink / raw)
To: buildroot
Without this patch openssl adds -latomic only to Libs.private in
libcrypto.pc.
Instead of passing -latomic to Configure we use the target arch
"linux-latomic" which is provided by upstream especially for libatomic
handling and add $LIB_ATOMIC_LIBS to be used for creating libcrypto.pc.
Fixes:
http://autobuild.buildroot.net/results/fb4/fb4c6a97ac666a3a75345229a320769df6c0a909/
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
...-latomic-to-libcrypto.pc-when-needed.patch | 87 +++++++++++++++++++
package/libopenssl/Config.in | 1 +
package/libopenssl/libopenssl.mk | 1 -
3 files changed, 88 insertions(+), 1 deletion(-)
create mode 100644 package/libopenssl/0005-Add-latomic-to-libcrypto.pc-when-needed.patch
diff --git a/package/libopenssl/0005-Add-latomic-to-libcrypto.pc-when-needed.patch b/package/libopenssl/0005-Add-latomic-to-libcrypto.pc-when-needed.patch
new file mode 100644
index 0000000000..180755434a
--- /dev/null
+++ b/package/libopenssl/0005-Add-latomic-to-libcrypto.pc-when-needed.patch
@@ -0,0 +1,87 @@
+From f403579bb85c293d4b469b70dadb2865e17e5ebe Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd@kuhls.net>
+Date: Fri, 21 Jul 2023 18:37:34 +0200
+Subject: [PATCH] Add -latomic to libcrypto.pc when needed
+
+Upstream: https://github.com/openssl/openssl/pull/21521
+
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+---
+ Configurations/10-main.conf | 3 +++
+ Configurations/unix-Makefile.tmpl | 5 ++++-
+ Configure | 1 +
+ 3 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
+index 8010087b46..c4102e6adb 100644
+--- a/Configurations/10-main.conf
++++ b/Configurations/10-main.conf
+@@ -701,6 +701,7 @@ my %targets = (
+ },
+ "linux-latomic" => {
+ inherit_from => [ "linux-generic32" ],
++ atomic_libs => threads("-latomic"),
+ ex_libs => add(threads("-latomic")),
+ },
+ "linux-generic64" => {
+@@ -864,6 +865,7 @@ my %targets = (
+ inherit_from => [ "linux-x86" ],
+ CC => "clang",
+ CXX => "clang++",
++ atomic_libs => threads("-latomic"),
+ ex_libs => add(threads("-latomic")),
+ },
+ "linux-x86_64" => {
+@@ -959,6 +961,7 @@ my %targets = (
+ cflags => add("-m64 -mcpu=ultrasparc"),
+ cxxflags => add("-m64 -mcpu=ultrasparc"),
+ lib_cppflags => add("-DB_ENDIAN"),
++ atomic_libs => threads("-latomic"),
+ ex_libs => add(threads("-latomic")),
+ bn_ops => "BN_LLONG RC4_CHAR",
+ asm_arch => 'sparcv9',
+diff --git a/Configurations/unix-Makefile.tmpl b/Configurations/unix-Makefile.tmpl
+index 17e194f1ef..b7783cd536 100644
+--- a/Configurations/unix-Makefile.tmpl
++++ b/Configurations/unix-Makefile.tmpl
+@@ -382,6 +382,8 @@ CNF_CXXFLAGS={- join(' ', $target{cxxflags} || (),
+ @{$config{cxxflags}}) -}
+ CNF_LDFLAGS={- join(' ', $target{lflags} || (),
+ @{$config{lflags}}) -}
++CNF_ATOMIC_LIBS={- join(' ', $target{atomic_libs} || (),
++ @{$config{atomic_libs}}) -}
+ CNF_EX_LIBS={- join(' ', $target{ex_libs} || (),
+ @{$config{ex_libs}}) -}
+
+@@ -425,6 +427,7 @@ LIB_CXXFLAGS={- join(' ', $target{lib_cxxflags} || (),
+ LIB_LDFLAGS={- join(' ', $target{shared_ldflag} || (),
+ $config{shared_ldflag} || (),
+ '$(CNF_LDFLAGS)', '$(LDFLAGS)') -}
++LIB_ATOMIC_LIBS=$(CNF_ATOMIC_LIBS) $(ATOMIC_LIBS)
+ LIB_EX_LIBS=$(CNF_EX_LIBS) $(EX_LIBS)
+ DSO_CPPFLAGS={- join(' ', $target{dso_cppflags} || (),
+ $target{module_cppflags} || (),
+@@ -1406,7 +1409,7 @@ libcrypto.pc:
+ echo 'Name: OpenSSL-libcrypto'; \
+ echo 'Description: OpenSSL cryptography library'; \
+ echo 'Version: '$(VERSION); \
+- echo 'Libs: -L$${libdir} -lcrypto'; \
++ echo 'Libs: -L$${libdir} -lcrypto $(LIB_ATOMIC_LIBS)'; \
+ echo 'Libs.private: $(LIB_EX_LIBS)'; \
+ echo 'Cflags: -I$${includedir}' ) > libcrypto.pc
+
+diff --git a/Configure b/Configure
+index dd06aa4898..5009495804 100755
+--- a/Configure
++++ b/Configure
+@@ -3307,6 +3307,7 @@ sub print_table_entry
+ "ld",
+ "lflags",
+ "loutflag",
++ "atomic_libs",
+ "ex_libs",
+ "bn_ops",
+ "enable",
+--
+2.39.2
+
diff --git a/package/libopenssl/Config.in b/package/libopenssl/Config.in
index 26c8f4c085..fdfa135f52 100644
--- a/package/libopenssl/Config.in
+++ b/package/libopenssl/Config.in
@@ -26,6 +26,7 @@ config BR2_PACKAGE_LIBOPENSSL_TARGET_ARCH
# linux-generic{32,64}, see
# https://github.com/openssl/openssl/issues/9839
default "linux-generic64 no-asm" if BR2_ARCH_IS_64 && !BR2_MIPS_NABI32
+ default "linux-latomic no-asm" if BR2_TOOLCHAIN_HAS_LIBATOMIC
default "linux-generic32 no-asm"
config BR2_PACKAGE_LIBOPENSSL_BIN
diff --git a/package/libopenssl/libopenssl.mk b/package/libopenssl/libopenssl.mk
index 06eac8f3d9..41626d20e1 100644
--- a/package/libopenssl/libopenssl.mk
+++ b/package/libopenssl/libopenssl.mk
@@ -73,7 +73,6 @@ define LIBOPENSSL_CONFIGURE_CMDS
$(LIBOPENSSL_TARGET_ARCH) \
--prefix=/usr \
--openssldir=/etc/ssl \
- $(if $(BR2_TOOLCHAIN_HAS_LIBATOMIC),-latomic) \
$(if $(BR2_TOOLCHAIN_HAS_THREADS),threads,no-threads) \
$(if $(BR2_STATIC_LIBS),no-shared,shared) \
$(if $(BR2_PACKAGE_CRYPTODEV_LINUX),enable-devcryptoeng) \
--
2.39.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 5+ messages in thread* [Buildroot] [PATCH 3/3] package/libopenssl: enable threads on static builds
2023-07-21 18:06 [Buildroot] [PATCH 1/3] package/libopenssl: remove deprecated options Bernd Kuhls
2023-07-21 18:06 ` [Buildroot] [PATCH 2/3] package/libopenssl: add -latomic to libcrypto.pc when needed Bernd Kuhls
@ 2023-07-21 18:06 ` Bernd Kuhls
2023-07-21 21:02 ` [Buildroot] [PATCH 1/3] package/libopenssl: remove deprecated options Thomas Petazzoni via buildroot
2 siblings, 0 replies; 5+ messages in thread
From: Bernd Kuhls @ 2023-07-21 18:06 UTC (permalink / raw)
To: buildroot
Revert upstream commit as proposed on the upstream bugtracker.
Fixes:
http://autobuild.buildroot.net/results/b8e/b8efae5bf6ac3b51e8443951ef1dd88824af3f2b/
Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
.../0006-Revert-Fix-static-builds.patch | 43 +++++++++++++++++++
1 file changed, 43 insertions(+)
create mode 100644 package/libopenssl/0006-Revert-Fix-static-builds.patch
diff --git a/package/libopenssl/0006-Revert-Fix-static-builds.patch b/package/libopenssl/0006-Revert-Fix-static-builds.patch
new file mode 100644
index 0000000000..2bc0b961eb
--- /dev/null
+++ b/package/libopenssl/0006-Revert-Fix-static-builds.patch
@@ -0,0 +1,43 @@
+From 847a7b744e31b9f57d2a3de495187db1dc0ee6d7 Mon Sep 17 00:00:00 2001
+From: Bernd Kuhls <bernd@kuhls.net>
+Date: Fri, 21 Jul 2023 19:30:40 +0200
+Subject: [PATCH] Revert "Fix -static builds"
+
+This reverts commit cfd7225fbb9507b2e443a494459bdaab5236d29d.
+
+Upstream: https://github.com/openssl/openssl/issues/14574#issuecomment-817209126
+
+Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
+---
+ Configure | 8 ++++----
+ 1 file changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/Configure b/Configure
+index 2c17f4186b..94cab4c3c4 100755
+--- a/Configure
++++ b/Configure
+@@ -1438,10 +1438,6 @@ foreach (keys %useradd) {
+ # At this point, we can forget everything about %user and %useradd,
+ # because it's now all been merged into the corresponding $config entry
+
+-if (grep { $_ =~ /(?:^|\s)-static(?:\s|$)/ } @{$config{LDFLAGS}}) {
+- disable('static', 'pic', 'threads');
+-}
+-
+ # Allow overriding the build file name
+ $config{build_file} = env('BUILDFILE') || $target{build_file} || "Makefile";
+
+@@ -1728,6 +1724,10 @@ if ($strict_warnings)
+ }
+ }
+
++if (grep { $_ =~ /(?:^|\s)-static(?:\s|$)/ } @{$config{LDFLAGS}}) {
++ disable('static', 'pic', 'threads');
++}
++
+ $config{CFLAGS} = [ map { $_ eq '--ossl-strict-warnings'
+ ? @strict_warnings_collection
+ : ( $_ ) }
+--
+2.39.2
+
--
2.39.2
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 5+ messages in thread