mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
From: Christian Melki <christian.melki@t2data.com>
To: ptxdist@pengutronix.de
Subject: [ptxdist] [WIP: PATCH] glibc: Add workarounds for glibc-2.34.
Date: Tue,  1 Feb 2022 19:52:55 +0100	[thread overview]
Message-ID: <20220201185255.956746-1-christian.melki@t2data.com> (raw)

WIP. Not liking this much. Although it works.
I've tested this on a cross x86_64 which builds
and runs just fine.

1. Not really in need of a BUILTIN_SO workaround with
version checking. It doesn't hurt to install the "empty" .so,
esp. if you want to run older binaries with the sonames that end up
used through DT_NEEDED. Then it's a must.

2. Unknown how static the real sonames are. I prefer something
that will work over architectures and over time. Ergo, nack
on the glibc suggestion to use the sonames directly.

3. Would be much cleaner if the copying could resolve
libname.so manually instead of using -print-file-name.
Then this could go away.

Signed-off-by: Christian Melki <christian.melki@t2data.com>
---
 rules/glibc.make | 47 ++++++++++++++++++++++++++++++++---------------
 1 file changed, 32 insertions(+), 15 deletions(-)

diff --git a/rules/glibc.make b/rules/glibc.make
index d29f9e2ed..a0b8a2827 100644
--- a/rules/glibc.make
+++ b/rules/glibc.make
@@ -22,6 +22,15 @@ GLIBC_VERSION	:= $(call ptx/config-version, PTXCONF_GLIBC)
 # for license information
 -include $(PTXDIST_PLATFORMDIR)/selected_toolchain/../share/compliance/glibc.make
 
+glibc-version-split = $(subst -, ,$(subst ., ,$($(strip $(1))_VERSION)))
+glibc-major = $(word 1,$(call kernel-version-split, $(1)))
+glibc-minor = $(word 2,$(call kernel-version-split, $(1)))
+
+GLIBC_VERSION_MAJOR	:= $(call kernel-major,GLIBC)
+GLIBC_VERSION_MINOR	:= $(call kernel-minor,GLIBC)
+
+GLIBC_BUILTIN_SO	:= $(call ptx/force-sh, test $(GLIBC_VERSION_MAJOR) -ge 2 -a \( $(GLIBC_VERSION_MINOR) -ge 34 \) && echo y)
+
 # ----------------------------------------------------------------------------
 # Target-Install
 # ----------------------------------------------------------------------------
@@ -44,67 +53,75 @@ ifdef PTXCONF_GLIBC_C
 endif
 
 ifdef PTXCONF_GLIBC_PTHREAD
-	@$(call install_copy_toolchain_lib, glibc, libpthread.so)
+ifneq ($(GLIBC_BUILTIN_SO),y)
+	@$(call install_copy_toolchain_lib, glibc, libpthread.so.0)
+endif
 endif
 
 ifdef PTXCONF_GLIBC_THREAD_DB
-	@$(call install_copy_toolchain_lib, glibc, libthread_db.so)
+	@$(call install_copy_toolchain_lib, glibc, libthread_db.so.1)
 endif
 
 ifdef PTXCONF_GLIBC_RT
-	@$(call install_copy_toolchain_lib, glibc, librt.so)
+	@$(call install_copy_toolchain_lib, glibc, librt.so.1)
 endif
 
 ifdef PTXCONF_GLIBC_DL
+ifneq ($(GLIBC_BUILTIN_SO),y)
 	@$(call install_copy_toolchain_lib, glibc, libdl.so.2)
 endif
+endif
 
 ifdef PTXCONF_GLIBC_CRYPT
-	@$(call install_copy_toolchain_lib, glibc, libcrypt.so)
+	@$(call install_copy_toolchain_lib, glibc, libcrypt.so.1)
 endif
 
 ifdef PTXCONF_GLIBC_UTIL
-	@$(call install_copy_toolchain_lib, glibc, libutil.so)
+ifneq ($(GLIBC_BUILTIN_SO),y)
+	@$(call install_copy_toolchain_lib, glibc, libutil.so.1)
+endif
 endif
 
 ifdef PTXCONF_GLIBC_M
-	@$(call install_copy_toolchain_lib, glibc, libm.so)
+	@$(call install_copy_toolchain_lib, glibc, libm.so.6)
 endif
 
 ifdef PTXCONF_GLIBC_NSS_DNS
-	@$(call install_copy_toolchain_lib, glibc, libnss_dns.so)
+	@$(call install_copy_toolchain_lib, glibc, libnss_dns.so.2)
 endif
 
 ifdef PTXCONF_GLIBC_NSS_FILES
-	@$(call install_copy_toolchain_lib, glibc, libnss_files.so)
+	@$(call install_copy_toolchain_lib, glibc, libnss_files.so.2)
 endif
 
 ifdef PTXCONF_GLIBC_NSS_HESIOD
-	@$(call install_copy_toolchain_lib, glibc, libnss_hesiod.so)
+	@$(call install_copy_toolchain_lib, glibc, libnss_hesiod.so.2)
 endif
 
 ifdef PTXCONF_GLIBC_ANL
-	@$(call install_copy_toolchain_lib, glibc, libanl.so)
+ifneq ($(GLIBC_BUILTIN_SO),y)
+	@$(call install_copy_toolchain_lib, glibc, libanl.so.1)
+endif
 endif
 
 ifdef PTXCONF_GLIBC_NSS_NIS
-	@$(call install_copy_toolchain_lib, glibc, libnss_nis.so)
+	@$(call install_copy_toolchain_lib, glibc, libnss_nis.so.2)
 endif
 
 ifdef PTXCONF_GLIBC_NSS_NISPLUS
-	@$(call install_copy_toolchain_lib, glibc, libnss_nisplus.so)
+	@$(call install_copy_toolchain_lib, glibc, libnss_nisplus.so.2)
 endif
 
 ifdef PTXCONF_GLIBC_NSS_COMPAT
-	@$(call install_copy_toolchain_lib, glibc, libnss_compat.so)
+	@$(call install_copy_toolchain_lib, glibc, libnss_compat.so.2)
 endif
 
 ifdef PTXCONF_GLIBC_RESOLV
-	@$(call install_copy_toolchain_lib, glibc, libresolv.so)
+	@$(call install_copy_toolchain_lib, glibc, libresolv.so.2)
 endif
 
 ifdef PTXCONF_GLIBC_NSL
-	@$(call install_copy_toolchain_lib, glibc, libnsl.so)
+	@$(call install_copy_toolchain_lib, glibc, libnsl.so.1)
 endif
 
 ifdef PTXCONF_GLIBC_GCONF_BASE
-- 
2.30.2


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de
To unsubscribe, send a mail with subject "unsubscribe" to ptxdist-request@pengutronix.de


                 reply	other threads:[~2022-02-01 18:53 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220201185255.956746-1-christian.melki@t2data.com \
    --to=christian.melki@t2data.com \
    --cc=ptxdist@pengutronix.de \
    /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