public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] gentoo-alt r1679 - trunk/toolchain-prefix-wrapper/ld
@ 2011-01-14 13:03 Michael Haubenwallner (haubi)
  0 siblings, 0 replies; only message in thread
From: Michael Haubenwallner (haubi) @ 2011-01-14 13:03 UTC (permalink / raw
  To: gentoo-commits

Author: haubi
Date: 2011-01-14 13:03:13 +0000 (Fri, 14 Jan 2011)
New Revision: 1679

Modified:
   trunk/toolchain-prefix-wrapper/ld/ldwrapper.c
Log:
For linkpath, add PREFIX/usr/lib:PREFIX/lib in that order,
but to runpath, add in reverse order.
This also is needed for AIX to allow (manual) workarounds, when updated
shared libraries have SONAME support while the old one does not, because
'libX.so' cannot be loaded any more when having SONAME support, as it
becomes either (a symlink to) an archive or a standalone import file.
This is related to http://bugs.gentoo.org/show_bug.cgi?id=213277


Modified: trunk/toolchain-prefix-wrapper/ld/ldwrapper.c
===================================================================
--- trunk/toolchain-prefix-wrapper/ld/ldwrapper.c	2011-01-13 12:35:06 UTC (rev 1678)
+++ trunk/toolchain-prefix-wrapper/ld/ldwrapper.c	2011-01-14 13:03:13 UTC (rev 1679)
@@ -784,14 +784,14 @@
 static inline void add_host_system(LdWrapperData* data)
 {
 	struct libdir {
-		char const *path; int len;
+		char const *path; int len; int exists;
 	};
-	struct libdir const libdirs[] = {
-		{ "/usr/lib",   strlen("/usr/lib"), },
-		{ "/lib",       strlen("/lib"), },
-		{ NULL, -1 },
+	struct libdir libdirs[] = {
+		{ "/usr/lib",   strlen("/usr/lib"), 0, },
+		{ "/lib",       strlen("/lib"),     0, },
+		{ NULL, -1, 0, },
 	};
-	struct libdir const * l = libdirs;
+	struct libdir * l = libdirs;
 
 	if (data->pluginIn.isCrossTriplet) {
 		/* native builds only */
@@ -809,6 +809,18 @@
 		  || ! data->pluginIn.haveRoot
 		 )
 		) {
+			l->exists = 1;
+		}
+		l++;
+	}
+
+	/* Add to runpath in reverse order: This is to replace existing shared
+	 * libraries without SONAME on AIX with ones that define a SONAME.
+	 * The old one can be found as lib/libz.so fex, while linking
+	 * against usr/lib/libz.so will record libz.so.1 into the binaries.
+	 */
+	while(--l >= libdirs) {
+		if (l->exists) {
 			/* add to runpath only when cross-prefix without ROOT */
 			add_libpath(data, data->pluginIn.sysRunpath, AddLibpath,
 				"append host system to runpath",
@@ -817,7 +829,6 @@
 				l->path, l->len,
 			NULL);
 		}
-		l++;
 	}
 }
 




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-01-14 13:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14 13:03 [gentoo-commits] gentoo-alt r1679 - trunk/toolchain-prefix-wrapper/ld Michael Haubenwallner (haubi)

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