This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Shared library runpath trouble in Solaris.


It seems that gcc does not specify any runpath for shared libraries.
At least if using multilibs the whole thing does not work, and
if `prefix' is not a standard one (I am using /usr/gnu), shared
libraries are not found at all.

I have made following changes to allow gcc automatically set -R
to all directories it adds itself.

Or am I missing something completely?

Teemu

1997-11-06  Teemu Torma  <tot@trema.com>

	* config/sparc/sol2.h: Define ADDITIONAL_LINKDIR_OPTION "-R".

	* gcc.c (do_spec_1): If ADDITIONAL_LINKDIR_OPTION is defined,
	add that option for each absolute link directories.

Index: gcc.c
===================================================================
RCS file: /trema/cvs/gnu/egcs/gcc/gcc.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -u -p -r1.1.1.1 -r1.2
--- gcc.c	1997/09/26 09:56:58	1.1.1.1
+++ gcc.c	1997/11/06 11:51:51	1.2
@@ -3226,6 +3226,19 @@ do_spec_1 (spec, inswitch, soft_matched_
 			      do_spec_1 (multilib_dir, 1, NULL_PTR);
 			      /* Make this a separate argument.  */
 			      do_spec_1 (" ", 0, NULL_PTR);
+
+#ifdef ADDITIONAL_LINKDIR_OPTION
+			      if (pl->prefix[0] == '/'
+				  || pl->prefix[0] == DIR_SEPARATOR)
+				{
+				  do_spec_1 (ADDITIONAL_LINKDIR_OPTION,
+					     0, NULL_PTR);
+				  do_spec_1 (buffer, 1, NULL_PTR);
+				  do_spec_1 (multilib_dir, 1, NULL_PTR);
+				  /* Make this a separate argument.  */
+				  do_spec_1 (" ", 0, NULL_PTR);
+				}			      
+#endif
 			    }
 			}
 		      if (!pl->require_machine_suffix)
@@ -3240,6 +3253,19 @@ do_spec_1 (spec, inswitch, soft_matched_
 			      do_spec_1 (multilib_dir, 1, NULL_PTR);
 			      /* Make this a separate argument.  */
 			      do_spec_1 (" ", 0, NULL_PTR);
+
+#ifdef ADDITIONAL_LINKDIR_OPTION
+			      if (pl->prefix[0] == '/'
+				  || pl->prefix[0] == DIR_SEPARATOR)
+				{
+				  do_spec_1 (ADDITIONAL_LINKDIR_OPTION,
+					     0, NULL_PTR);
+				  do_spec_1 (pl->prefix, 1, NULL_PTR);
+				  do_spec_1 (multilib_dir, 1, NULL_PTR);
+				  /* Make this a separate argument.  */
+				  do_spec_1 (" ", 0, NULL_PTR);
+				}
+#endif
 			    }
 			}
 		    }
@@ -3264,6 +3290,19 @@ do_spec_1 (spec, inswitch, soft_matched_
 			  do_spec_1 (buffer, 1, NULL_PTR);
 			  /* Make this a separate argument.  */
 			  do_spec_1 (" ", 0, NULL_PTR);
+
+#ifdef ADDITIONAL_LINKDIR_OPTION
+			  if (pl->prefix[0] == '/'
+			      || pl->prefix[0] == DIR_SEPARATOR)
+			    {
+			      do_spec_1 (ADDITIONAL_LINKDIR_OPTION,
+					 0, NULL_PTR);
+			      do_spec_1 (pl->prefix, 1, NULL_PTR);
+			      do_spec_1 (buffer, 1, NULL_PTR);
+			      /* Make this a separate argument.  */
+			      do_spec_1 (" ", 0, NULL_PTR);
+			    }
+#endif
 			}
 		    }
 		  if (!pl->require_machine_suffix)
@@ -3286,6 +3325,18 @@ do_spec_1 (spec, inswitch, soft_matched_
 			  do_spec_1 (buffer, 1, NULL_PTR);
 			  /* Make this a separate argument.  */
 			  do_spec_1 (" ", 0, NULL_PTR);
+
+#ifdef ADDITIONAL_LINKDIR_OPTION
+			  if (pl->prefix[0] == '/'
+			      || pl->prefix[0] == DIR_SEPARATOR)
+			    {
+			      do_spec_1 (ADDITIONAL_LINKDIR_OPTION,
+					 0, NULL_PTR);
+			      do_spec_1 (buffer, 1, NULL_PTR);
+			      /* Make this a separate argument.  */
+			      do_spec_1 (" ", 0, NULL_PTR);
+			    }
+#endif
 			}
 		    }
 		}
Index: config/sparc/sol2.h
===================================================================
RCS file: /trema/cvs/gnu/egcs/gcc/config/sparc/sol2.h,v
retrieving revision 1.1.1.2
retrieving revision 1.6
diff -u -u -p -r1.1.1.2 -r1.6
--- sol2.h	1997/10/24 09:12:33	1.1.1.2
+++ sol2.h	1997/11/10 12:11:04	1.6
@@ -157,6 +164,10 @@ Boston, MA 02111-1307, USA.  */
        %{pg:-Y P,/usr/ccs/lib/libp:/usr/lib/libp:/usr/ccs/lib:/usr/lib} \
        %{!p:%{!pg:-Y P,/usr/ccs/lib:/usr/lib}}}} \
    %{Qy:} %{!Qn:-Qy}"
+
+/* Add -R for each automatically included -L. */
+#undef ADDITIONAL_LINKDIR_OPTION
+#define ADDITIONAL_LINKDIR_OPTION "-R"
 
 /* This defines which switch letters take arguments.
    It is as in svr4.h but with -R added.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]