David Cantrell f71382
--- rpm-4.4.2/build/rpmfc.c.gnuhash	2006-07-14 16:59:43.000000000 -0400
David Cantrell f71382
+++ rpm-4.4.2/build/rpmfc.c	2006-07-14 17:01:40.000000000 -0400
Paul Nasrat d58cfe
@@ -12,6 +12,11 @@
Paul Nasrat d58cfe
 
Paul Nasrat d58cfe
 #if HAVE_GELF_H
Paul Nasrat d58cfe
 #include <gelf.h>
Paul Nasrat d58cfe
+
Paul Nasrat d58cfe
+#if !defined(DT_GNU_HASH)
Paul Nasrat d58cfe
+#define	DT_GNU_HASH		0x6ffffef5
Paul Nasrat d58cfe
+#endif
Paul Nasrat d58cfe
+
Paul Nasrat d58cfe
 #endif
Paul Nasrat d58cfe
 
Paul Nasrat d58cfe
 #include "debug.h"
Paul Nasrat d58cfe
@@ -879,6 +884,8 @@
Paul Nasrat a19af6
     int isDSO;
Paul Nasrat a19af6
     int gotSONAME = 0;
Paul Nasrat a19af6
     int gotDEBUG = 0;
Paul Nasrat a19af6
+    int gotHASH = 0;
Paul Nasrat a19af6
+    int gotGNUHASH = 0;
Paul Nasrat a19af6
     static int filter_GLIBC_PRIVATE = 0;
Paul Nasrat a19af6
     static int oneshot = 0;
Paul Nasrat a19af6
 
Paul Nasrat d58cfe
@@ -1051,6 +1058,12 @@
Paul Nasrat a19af6
 		    default:
Paul Nasrat a19af6
 			/*@innercontinue@*/ continue;
Paul Nasrat a19af6
 			/*@notreached@*/ /*@switchbreak@*/ break;
Paul Nasrat a19af6
+                    case DT_HASH:    
Paul Nasrat a19af6
+			gotHASH= 1;
Paul Nasrat a19af6
+			/*@innercontinue@*/ continue;
Paul Nasrat a19af6
+                    case DT_GNU_HASH:
Paul Nasrat a19af6
+			gotGNUHASH= 1;
Paul Nasrat a19af6
+			/*@innercontinue@*/ continue;
Paul Nasrat a19af6
                     case DT_DEBUG:    
Paul Nasrat a19af6
 			gotDEBUG = 1;
Paul Nasrat a19af6
 			/*@innercontinue@*/ continue;
David Cantrell f71382
@@ -1107,6 +1120,18 @@
Paul Nasrat a19af6
     }
Paul Nasrat a19af6
     /*@=branchstate =uniondef @*/
Paul Nasrat a19af6
 
Paul Nasrat a19af6
+    /* For DSOs which use the .gnu_hash section and don't have a .hash
Paul Nasrat a19af6
+     * section, we need to ensure that we have a new enough glibc. */ 
Paul Nasrat a19af6
+    if (gotGNUHASH && !gotHASH) {
Paul Nasrat a19af6
+        ds = rpmdsSingle(RPMTAG_REQUIRENAME, "rtld(GNU_HASH)", "", 
Paul Nasrat a19af6
+                         RPMSENSE_FIND_REQUIRES);
Paul Nasrat a19af6
+        rpmdsMerge(&fc->requires, ds);
David Cantrell f71382
+        buf[0] = '\0';
David Cantrell f71382
+        t = buf;
Paul Nasrat a19af6
+        rpmfcSaveArg(&fc->ddict, rpmfcFileDep(t, fc->ix, ds));
Paul Nasrat a19af6
+        ds = rpmdsFree(ds);
Paul Nasrat a19af6
+    }
Paul Nasrat a19af6
+
Paul Nasrat a19af6
     /* For DSO's, provide the basename of the file if DT_SONAME not found. */
Paul Nasrat a19af6
     if (!fc->skipProv && isDSO && !gotDEBUG && !gotSONAME) {
Paul Nasrat a19af6
 	depsp = &fc->provides;