[Rpm-maint] [PATCH] drop rtld(GNU_HASH) hack

Thierry Vignaud thierry.vignaud at gmail.com
Tue Sep 16 12:55:25 UTC 2014


Hi

The attached patch drops the drop rtld(GNU_HASH) hack

Drop automatically generated rtld(GNU_HASH) dependencies.
It's been provided by glibc for 7 years now and can safely be assumed
that there's no longer any need for it, reducing ~5K packages'
dependency in repository metadata on it during next rebuild.

See you
-------------- next part --------------
commit 12d6f89719c06e05ca186ade116608f7ba60c8ae
Author: Thierry Vignaud <thierry.vignaud at gmail.com>
Date:   Tue Sep 16 14:52:06 2014 +0200

    drop rtld(GNU_HASH) hack
    
    Drop automatically generated rtld(GNU_HASH) dependencies.
    It's been provided by glibc for 7 years now and can safely be assumed
    that there's no longer any need for it, reducing ~5K packages'
    dependency in repository metadata on it during next rebuild.
    
    basically reverting commit 8b8e27ec

diff --git a/lib/tagexts.c b/lib/tagexts.c
index 0d2b1d3..2d20fd5 100644
--- a/lib/tagexts.c
+++ b/lib/tagexts.c
@@ -735,6 +735,27 @@ static int epochnumTag(Header h, rpmtd td, headerGetFlags hgflags)
     return 1;
 }
 
+static int depnameTag(Header h, rpmtd td, headerGetFlags hgflags,
+			rpmTagVal tag)
+{
+    rpmds ds = rpmdsNew(h, tag, 0);
+    int ndeps = rpmdsCount(ds);
+
+    if (ndeps > 0) {
+	char **deps = xmalloc(sizeof(*deps) * ndeps);
+	int i;
+	while ((i = rpmdsNext(ds)) >= 0) {
+	    deps[i] = rpmdsN(ds);
+	}
+	td->data = deps;
+	td->type = RPM_STRING_ARRAY_TYPE;
+	td->count = ndeps;
+	td->flags |= (RPMTD_ALLOCED | RPMTD_PTR_ALLOCED);
+    }
+    rpmdsFree(ds);
+    return (ndeps > 0);
+}
+
 static int depnevrsTag(Header h, rpmtd td, headerGetFlags hgflags,
 			rpmTagVal tag)
 {
@@ -758,6 +779,32 @@ static int depnevrsTag(Header h, rpmtd td, headerGetFlags hgflags,
 
 #define RPMSENSE_STRONG (1 << 27)
 
+
+static int depnameTagFiltered(Header h, rpmtd td, headerGetFlags hgflags,
+			rpmTagVal tag, int strong)
+{
+    rpmds ds = rpmdsNew(h, tag, 0);
+    int ndeps = rpmdsCount(ds);
+
+    if (ndeps > 0) {
+	char **deps = xmalloc(sizeof(*deps) * ndeps);
+	ndeps = 0;
+	while (rpmdsNext(ds) >= 0) {
+	    if ((rpmdsFlags(ds) & RPMSENSE_STRONG) == (strong ? RPMSENSE_STRONG : 0))
+		deps[ndeps++] = rpmdsN(ds);
+	}
+	if (ndeps) {
+	    td->data = deps;
+	    td->type = RPM_STRING_ARRAY_TYPE;
+	    td->count = ndeps;
+	    td->flags |= (RPMTD_ALLOCED | RPMTD_PTR_ALLOCED);
+	} else {
+	    _free(deps);
+        }
+    }
+    rpmdsFree(ds);
+    return (ndeps > 0);
+
 static int depnevrsTagFiltered(Header h, rpmtd td, headerGetFlags hgflags,
 			rpmTagVal tag, int strong)
 {
@@ -789,6 +836,12 @@ static int requirenevrsTag(Header h, rpmtd td, headerGetFlags hgflags)
     return depnevrsTag(h, td, hgflags, RPMTAG_REQUIRENAME);
 }
 
+static int recommendnameTag(Header h, rpmtd td, headerGetFlags hgflags)
+{
+    return depnameTag(h, td, hgflags, RPMTAG_RECOMMENDNAME) ||
+           depnameTagFiltered(h, td, hgflags, RPMTAG_OLDSUGGESTSNAME, 0);
+}
+
 static int recommendnevrsTag(Header h, rpmtd td, headerGetFlags hgflags)
 {
     return depnevrsTag(h, td, hgflags, RPMTAG_RECOMMENDNAME) ||
@@ -875,6 +928,7 @@ static const struct headerTagFunc_s rpmHeaderTagExtensions[] = {
     { RPMTAG_EPOCHNUM,		epochnumTag },
     { RPMTAG_INSTFILENAMES,	instfilenamesTag },
     { RPMTAG_REQUIRENEVRS,	requirenevrsTag },
+    { RPMTAG_RECOMMENDNAME,	recommendnameTag},
     { RPMTAG_RECOMMENDNEVRS,	recommendnevrsTag},
     { RPMTAG_SUGGESTNEVRS,	suggestnevrsTag},
     { RPMTAG_SUPPLEMENTNEVRS,	supplementnevrsTag},
diff --git a/tools/elfdeps.c b/tools/elfdeps.c
index cf22cc6..5a25090 100644
--- a/tools/elfdeps.c
+++ b/tools/elfdeps.c
@@ -306,14 +306,6 @@ static int processFile(const char *fn, int dtype)
     }
 
     /*
-     * For DSOs which use the .gnu_hash section and don't have a .hash
-     * section, we need to ensure that we have a new enough glibc.
-     */
-    if (ei->isExec && ei->gotGNUHASH && !ei->gotHASH && !soname_only) {
-	argvAdd(&ei->requires, "rtld(GNU_HASH)");
-    }
-
-    /*
      * For DSOs, add DT_SONAME as provide. If its missing, we can fake
      * it from the basename if requested. The bizarre looking DT_DEBUG
      * check is used to avoid adding basename provides for PIE executables.


More information about the Rpm-maint mailing list