Write MD_*PREFIX* into specs file

Richard Kenner kenner@vlsi1.ultra.nyu.edu
Thu Oct 5 13:33:00 GMT 2000


Since these differ from port to port, -b needs to select the right ones.
We turn these off for cross-compilation, so this doesnt' usually
cause problems but with -b is used to select one of multiple native
compilers (e.g., 32 or 64 bit), it uses the wrong files.

Thu Oct  5 16:16:57 2000  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* gcc.c: Move data on prefixes forward in file and reorganize.
	(md_exec_prefix, md_startfile_prefix, md_startfile_prefix_1):
	Always define, but make null if no value.
	(static_specs): Add "md_exec_prefix", "md_startfile_prefix",
	and "md_startfile_prefix_1".
	(main): Check whether md_exec_prefix and the others are the
	null string rather than whether the macro is defined.

*** gcc.c	2000/09/26 17:28:06	1.169
--- gcc.c	2000/10/05 17:15:22
*************** skip_whitespace (p)
*** 1066,1069 ****
--- 1066,1167 ----
    return p;
  }
+ /* Structures to keep track of prefixes to try when looking for files.  */
+ 
+ struct prefix_list
+ {
+   char *prefix;               /* String to prepend to the path.  */
+   struct prefix_list *next;   /* Next in linked list.  */
+   int require_machine_suffix; /* Don't use without machine_suffix.  */
+   /* 2 means try both machine_suffix and just_machine_suffix.  */
+   int *used_flag_ptr;	      /* 1 if a file was found with this prefix.  */
+   int priority;		      /* Sort key - priority within list */
+ };
+ 
+ struct path_prefix
+ {
+   struct prefix_list *plist;  /* List of prefixes to try */
+   int max_len;                /* Max length of a prefix in PLIST */
+   const char *name;           /* Name of this list (used in config stuff) */
+ };
+ 
+ /* List of prefixes to try when looking for executables.  */
+ 
+ static struct path_prefix exec_prefixes = { 0, 0, "exec" };
+ 
+ /* List of prefixes to try when looking for startup (crt0) files.  */
+ 
+ static struct path_prefix startfile_prefixes = { 0, 0, "startfile" };
+ 
+ /* List of prefixes to try when looking for include files.  */
+ 
+ static struct path_prefix include_prefixes = { 0, 0, "include" };
+ 
+ /* Suffix to attach to directories searched for commands.
+    This looks like `MACHINE/VERSION/'.  */
+ 
+ static const char *machine_suffix = 0;
+ 
+ /* Suffix to attach to directories searched for commands.
+    This is just `MACHINE/'.  */
+ 
+ static const char *just_machine_suffix = 0;
+ 
+ /* Adjusted value of GCC_EXEC_PREFIX envvar.  */
+ 
+ static const char *gcc_exec_prefix;
+ 
+ /* Default prefixes to attach to command names.  */
+ 
+ #ifdef CROSS_COMPILE  /* Don't use these prefixes for a cross compiler.  */
+ #undef MD_EXEC_PREFIX
+ #undef MD_STARTFILE_PREFIX
+ #undef MD_STARTFILE_PREFIX_1
+ #endif
+ 
+ /* If no prefixes defined, use the null string, which will disable them.  */
+ #ifndef MD_EXEC_PREFIX
+ #define MD_EXEC_PREFIX ""
+ #endif
+ #ifndef MD_STARTFILE_PREFIX
+ #define MD_STARTFILE_PREFIX ""
+ #endif
+ #ifndef MD_STARTFILE_PREFIX_1
+ #define MD_STARTFILE_PREFIX_1 ""
+ #endif
+ 
+ /* Supply defaults for the standard prefixes.  */
+ 
+ #ifndef STANDARD_EXEC_PREFIX
+ #define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
+ #endif
+ #ifndef STANDARD_STARTFILE_PREFIX
+ #define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
+ #endif
+ #ifndef TOOLDIR_BASE_PREFIX
+ #define TOOLDIR_BASE_PREFIX "/usr/local/"
+ #endif
+ #ifndef STANDARD_BINDIR_PREFIX
+ #define STANDARD_BINDIR_PREFIX "/usr/local/bin"
+ #endif
+ 
+ static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
+ static const char *standard_exec_prefix_1 = "/usr/lib/gcc/";
+ static const char *md_exec_prefix = MD_EXEC_PREFIX;
+ 
+ static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
+ static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
+ static const char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
+ static const char *standard_startfile_prefix_1 = "/lib/";
+ static const char *standard_startfile_prefix_2 = "/usr/lib/";
+ 
+ static const char *tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
+ static const char *tooldir_prefix;
+ 
+ static const char *standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
+ 
+ /* Subdirectory to use for locating libraries.  Set by
+    set_multilib_dir based on the compilation options.  */
+ 
+ static const char *multilib_dir;
  
  /* Structure to keep track of the specs that have been defined so far.
*************** static struct spec_list static_specs[] =
*** 1119,1122 ****
--- 1217,1223 ----
    INIT_STATIC_SPEC ("linker",			&linker_name_spec),
    INIT_STATIC_SPEC ("link_libgcc",		&link_libgcc_spec),
+   INIT_STATIC_SPEC ("md_exec_prefix",		&md_exec_prefix),
+   INIT_STATIC_SPEC ("md_startfile_prefix",	&md_startfile_prefix),
+   INIT_STATIC_SPEC ("md_startfile_prefix_1",	&md_startfile_prefix_1),
  };
  
*************** static int signal_count;
*** 1280,1376 ****
  static const char *programname;
  
- /* Structures to keep track of prefixes to try when looking for files.  */
- 
- struct prefix_list
- {
-   char *prefix;               /* String to prepend to the path.  */
-   struct prefix_list *next;   /* Next in linked list.  */
-   int require_machine_suffix; /* Don't use without machine_suffix.  */
-   /* 2 means try both machine_suffix and just_machine_suffix.  */
-   int *used_flag_ptr;	      /* 1 if a file was found with this prefix.  */
-   int priority;		      /* Sort key - priority within list */
- };
- 
- struct path_prefix
- {
-   struct prefix_list *plist;  /* List of prefixes to try */
-   int max_len;                /* Max length of a prefix in PLIST */
-   const char *name;           /* Name of this list (used in config stuff) */
- };
- 
- /* List of prefixes to try when looking for executables.  */
- 
- static struct path_prefix exec_prefixes = { 0, 0, "exec" };
- 
- /* List of prefixes to try when looking for startup (crt0) files.  */
- 
- static struct path_prefix startfile_prefixes = { 0, 0, "startfile" };
- 
- /* List of prefixes to try when looking for include files.  */
- 
- static struct path_prefix include_prefixes = { 0, 0, "include" };
- 
- /* Suffix to attach to directories searched for commands.
-    This looks like `MACHINE/VERSION/'.  */
- 
- static const char *machine_suffix = 0;
- 
- /* Suffix to attach to directories searched for commands.
-    This is just `MACHINE/'.  */
- 
- static const char *just_machine_suffix = 0;
- 
- /* Adjusted value of GCC_EXEC_PREFIX envvar.  */
- 
- static const char *gcc_exec_prefix;
- 
- /* Default prefixes to attach to command names.  */
- 
- #ifdef CROSS_COMPILE  /* Don't use these prefixes for a cross compiler.  */
- #undef MD_EXEC_PREFIX
- #undef MD_STARTFILE_PREFIX
- #undef MD_STARTFILE_PREFIX_1
- #endif
- 
- #ifndef STANDARD_EXEC_PREFIX
- #define STANDARD_EXEC_PREFIX "/usr/local/lib/gcc-lib/"
- #endif /* !defined STANDARD_EXEC_PREFIX */
- 
- static const char *standard_exec_prefix = STANDARD_EXEC_PREFIX;
- static const char *standard_exec_prefix_1 = "/usr/lib/gcc/";
- #ifdef MD_EXEC_PREFIX
- static const char *md_exec_prefix = MD_EXEC_PREFIX;
- #endif
- 
- #ifndef STANDARD_STARTFILE_PREFIX
- #define STANDARD_STARTFILE_PREFIX "/usr/local/lib/"
- #endif /* !defined STANDARD_STARTFILE_PREFIX */
- 
- #ifdef MD_STARTFILE_PREFIX
- static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
- #endif
- #ifdef MD_STARTFILE_PREFIX_1
- static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
- #endif
- static const char *standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
- static const char *standard_startfile_prefix_1 = "/lib/";
- static const char *standard_startfile_prefix_2 = "/usr/lib/";
- 
- #ifndef TOOLDIR_BASE_PREFIX
- #define TOOLDIR_BASE_PREFIX "/usr/local/"
- #endif
- static const char *tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
- static const char *tooldir_prefix;
- 
- #ifndef STANDARD_BINDIR_PREFIX
- #define STANDARD_BINDIR_PREFIX "/usr/local/bin"
- #endif
- static const char *standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
- 
- /* Subdirectory to use for locating libraries.  Set by
-    set_multilib_dir based on the compilation options.  */
- 
- static const char *multilib_dir;
- 
  /* Clear out the vector of arguments (after a command is executed).  */
  
--- 1381,1384 ----
*************** main (argc, argv)
*** 5340,5359 ****
    if (*cross_compile == '0')
      {
! #ifdef MD_EXEC_PREFIX
!       add_prefix (&exec_prefixes, md_exec_prefix, "GCC",
! 		  PREFIX_PRIORITY_LAST, 0, NULL_PTR);
!       add_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
! 		  PREFIX_PRIORITY_LAST, 0, NULL_PTR);
! #endif
  
! #ifdef MD_STARTFILE_PREFIX
!       add_prefix (&startfile_prefixes, md_startfile_prefix, "GCC",
! 		  PREFIX_PRIORITY_LAST, 0, NULL_PTR);
! #endif
  
! #ifdef MD_STARTFILE_PREFIX_1
!       add_prefix (&startfile_prefixes, md_startfile_prefix_1, "GCC",
! 		  PREFIX_PRIORITY_LAST, 0, NULL_PTR);
! #endif
  
        /* If standard_startfile_prefix is relative, base it on
--- 5348,5366 ----
    if (*cross_compile == '0')
      {
!       if (*md_exec_prefix)
! 	{
! 	  add_prefix (&exec_prefixes, md_exec_prefix, "GCC",
! 		      PREFIX_PRIORITY_LAST, 0, NULL_PTR);
! 	  add_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
! 		      PREFIX_PRIORITY_LAST, 0, NULL_PTR);
! 	}
  
!       if (*md_startfile_prefix)
! 	add_prefix (&startfile_prefixes, md_startfile_prefix, "GCC",
! 		    PREFIX_PRIORITY_LAST, 0, NULL_PTR);
  
!       if (*md_startfile_prefix_1)
! 	add_prefix (&startfile_prefixes, md_startfile_prefix_1, "GCC",
! 		    PREFIX_PRIORITY_LAST, 0, NULL_PTR);
  
        /* If standard_startfile_prefix is relative, base it on


More information about the Gcc-patches mailing list