whither specs?

Theodore Papadopoulo Theodore.Papadopoulo@sophia.inria.fr
Fri Jun 14 11:29:00 GMT 2002


Here is the concept patch for allowing gcc, optionnaly, to add run 
path specifications for its own library. This patch is dependant on 
the previous one that I already posted. It works very simply by 
modifying the do_lib_spec function (now that everything is in one 
place this is simple) to add the required directives.

The idea is that you can specify --enable-runpath at configure time 
and then run path directive are added by gcc for its own libraries.

I have two open questions:

1) in which config file should I specify the appropriate runpath flag.
For this simple example, I have used the file i386/linux.h but I'm 
not sure this is the most appropriate choice. What is the rule ??

2) until all configs have been updated to have the 
RUNPATH_FLAG definition, what is the best way to warn that the
--enable-runpath does not have any effect. It would be best if it 
could be done at configure time...

All ideas/comments are welcome....

	Theo.

PS: yes there are two lines too long in configure.in, I'll correct that.


Index: gcc/configure.in
===================================================================
RCS file: /cvs/gcc/egcs/gcc/configure.in,v
retrieving revision 1.603
diff -c -3 -p -r1.603 configure.in
*** gcc/configure.in	12 Jun 2002 01:36:13 -0000	1.603
--- gcc/configure.in	14 Jun 2002 18:05:49 -0000
*************** changequote([, ])dnl
*** 176,181 ****
--- 176,186 ----
    fi
  fi
  
+ # Enable the insertion of runpath directives for GCC libraries.
+ AC_ARG_ENABLE(runpath,
+ [  --enable-runpath        enable to insert run path directives in the spec file],
+ [AC_DEFINE(ENABLE_RUNPATH, 1, [Define if you want run path directives to be inserted in the spec file.])], [])
+ 
  # Determine whether or not multilibs are enabled.
  AC_ARG_ENABLE(multilib,
  [  --enable-multilib       enable library support for multiple ABIs],
Index: gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/gcc.c,v
retrieving revision 1.323
diff -c -3 -p -r1.323 gcc.c
*** /u/atlantis/1/egcs/clean/gcc/gcc/gcc.c      Fri Jun 14 19:45:24 2002
--- gcc.c       Fri Jun 14 20:18:56 2002
*************** do_lib_spec (path)
*** 4197,4202 ****
--- 4197,4219 ----
        do_spec_1 (path, 1, NULL);
        /* Make this a separate argument.  */
        do_spec_1 (" ", 0, NULL);
+ 
+ #ifdef ENABLE_RUNPATH
+ #ifndef RUNPATH_FLAG
+ #define RUNPATH_FLAG 0
+ #endif
+ #else
+ #undef RUNPATH_FLAG
+ #define RUNPATH_FLAG 0
+ #endif
+ 
+       if (RUNPATH_FLAG)
+         {
+           do_spec_1 (RUNPATH_FLAG, 0, NULL);
+           do_spec_1 (path, 1, NULL);
+           /* Make this a separate argument.  */
+           do_spec_1 (" ", 0, NULL);
+         }
      }
  }
Index: gcc/config/i386/linux.h
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/i386/linux.h,v
retrieving revision 1.40
diff -c -3 -p -r1.40 linux.h
*** gcc/config/i386/linux.h	5 Jun 2002 17:01:30 -0000	1.40
--- gcc/config/i386/linux.h	14 Jun 2002 18:05:52 -0000
*************** the Free Software Foundation, 59 Temple 
*** 22,27 ****
--- 22,28 ----
  Boston, MA 02111-1307, USA.  */
  
  #define LINUX_DEFAULT_ELF
+ #define RUNPATH_FLAG "-rpath "
  
  /* Output at beginning of assembler file.  */
  /* The .file command should always begin the output.  */



 --------------------------------------------------------------------
 Theodore Papadopoulo
 Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------





More information about the Gcc-patches mailing list