View | Details | Return to bug 17621 | Differences between
and this patch

Collapse All | Expand All

(-)gcc/ChangeLog (+11 lines)
Lines 1-3 Link Here
1
2006-08-22  Carlos O'Donell  <carlos@codesourcery.com>
2
3
	* gcc.c: Organize search path variables into $prefix relative,
4
	and well-known native. Add comments.
5
	(add_sysrooted_prefix): Add comment.
6
	(process_command): If !gcc_exec_prefix add $prefix based paths.
7
	If *cross_compile == '0', add native well-known paths.
8
	Assert tooldir_base_prefix is always relative.
9
	(main): If print_search_dirs, and if gcc_exec_prefix is set,
10
	use this value for 'install:' path.
11
1
2006-08-22  Jan Hubicka  <jh@suse.cz>
12
2006-08-22  Jan Hubicka  <jh@suse.cz>
2
13
3
	Patch by Paolo Bonzini
14
	Patch by Paolo Bonzini
(-)gcc/gcc.c (-66 / +67 lines)
Lines 1472-1496 static const char *gcc_libexec_prefix; Link Here
1472
#define MD_STARTFILE_PREFIX_1 ""
1472
#define MD_STARTFILE_PREFIX_1 ""
1473
#endif
1473
#endif
1474
1474
1475
/* These directories are locations set at configure-time based on the
1476
   --prefix option provided to configure.  Their initializers are
1477
   defined in Makefile.in.  These paths are not *directly* used when
1478
   gcc_exec_prefix is set because, in that case, we know where the
1479
   compiler has been installed, and use paths relative to that
1480
   location instead.  */
1475
static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
1481
static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
1482
static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
1483
static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
1484
static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
1485
1486
/* For native compilers, these are well-known paths containing
1487
   components that may be provided by the system.  For cross
1488
   compilers, these paths are not used.  */
1476
static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";
1489
static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";
1477
static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
1490
static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
1478
static const char *md_exec_prefix = MD_EXEC_PREFIX;
1491
static const char *md_exec_prefix = MD_EXEC_PREFIX;
1479
1480
static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
1492
static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
1481
static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
1493
static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
1482
static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
1494
static const char *const standard_startfile_prefix_1 
1483
static const char *const standard_startfile_prefix_1
1484
  = STANDARD_STARTFILE_PREFIX_1;
1495
  = STANDARD_STARTFILE_PREFIX_1;
1485
static const char *const standard_startfile_prefix_2
1496
static const char *const standard_startfile_prefix_2
1486
  = STANDARD_STARTFILE_PREFIX_2;
1497
  = STANDARD_STARTFILE_PREFIX_2;
1487
1498
1499
/* A relative path to be used in finding the location of tools
1500
   relative to the driver.  */
1488
static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
1501
static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
1489
static const char *tooldir_prefix;
1490
1491
static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
1492
1493
static const char *standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
1494
1502
1495
/* Subdirectory to use for locating libraries.  Set by
1503
/* Subdirectory to use for locating libraries.  Set by
1496
   set_multilib_dir based on the compilation options.  */
1504
   set_multilib_dir based on the compilation options.  */
Lines 2749-2754 add_prefix (struct path_prefix *pprefix, Link Here
2749
}
2757
}
2750
2758
2751
/* Same as add_prefix, but prepending target_system_root to prefix.  */
2759
/* Same as add_prefix, but prepending target_system_root to prefix.  */
2760
/* The target_system_root prefix has been relocated by gcc_exec_prefix.  */
2752
static void
2761
static void
2753
add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
2762
add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
2754
		      const char *component,
2763
		      const char *component,
Lines 3278-3283 process_command (int argc, const char ** Link Here
3278
  int is_modify_target_name;
3287
  int is_modify_target_name;
3279
  unsigned int j;
3288
  unsigned int j;
3280
#endif
3289
#endif
3290
  const char *tooldir_prefix;
3281
3291
3282
  GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
3292
  GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
3283
3293
Lines 3387-3392 process_command (int argc, const char ** Link Here
3387
    }
3397
    }
3388
#else
3398
#else
3389
#endif
3399
#endif
3400
  /* From this point onward, gcc_exec_prefix is non-null if the toolchain
3401
     is relocated. The toolchain was either relocated using GCC_EXEC_PREFIX
3402
     or an automatically created GCC_EXEC_PREFIX from argv[0].  */
3390
3403
3391
  if (gcc_exec_prefix)
3404
  if (gcc_exec_prefix)
3392
    {
3405
    {
Lines 3933-3994 warranty; not even for MERCHANTABILITY o Link Here
3933
      use_pipes = 0;
3946
      use_pipes = 0;
3934
    }
3947
    }
3935
3948
3936
  /* Set up the search paths before we go looking for config files.  */
3949
  /* Set up the search paths.  We add directories that we expect to
3950
     contain GNU Toolchain components before directories specified by
3951
     the machine description so that we will find GNU components (like
3952
     the GNU assembler) before those of the host system.  */ 
3953
3954
  /* If we don't know where the toolchain has been installed, use the
3955
     configured-in locations.  */
3956
  if (!gcc_exec_prefix)
3957
    {
3958
#ifndef OS2
3959
      add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC",
3960
		  PREFIX_PRIORITY_LAST, 1, 0);
3961
      add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS",
3962
		  PREFIX_PRIORITY_LAST, 2, 0);
3963
      add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
3964
		  PREFIX_PRIORITY_LAST, 2, 0);
3965
#endif
3966
      add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
3967
		  PREFIX_PRIORITY_LAST, 1, 0);
3968
    }
3937
3969
3938
  /* These come before the md prefixes so that we will find gcc's subcommands
3970
  /* If not cross-compiling, search well-known system locations.  */
3939
     (such as cpp) rather than those of the host system.  */
3971
  if (*cross_compile == '0')
3940
  /* Use 2 as fourth arg meaning try just the machine as a suffix,
3972
    {
3941
     as well as trying the machine and the version.  */
3942
#ifndef OS2
3973
#ifndef OS2
3943
  add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC",
3974
      add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
3944
	      PREFIX_PRIORITY_LAST, 1, 0);
3975
		  PREFIX_PRIORITY_LAST, 2, 0);
3945
  add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS",
3976
      add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS",
3946
	      PREFIX_PRIORITY_LAST, 2, 0);
3977
		  PREFIX_PRIORITY_LAST, 2, 0);
3947
  add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
3978
#endif
3948
	      PREFIX_PRIORITY_LAST, 2, 0);
3979
      add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
3949
  add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
3980
		  PREFIX_PRIORITY_LAST, 1, 0);
3950
	      PREFIX_PRIORITY_LAST, 2, 0);
3981
    }
3951
  add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS",
3952
	      PREFIX_PRIORITY_LAST, 2, 0);
3953
#endif
3954
3955
  add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
3956
	      PREFIX_PRIORITY_LAST, 1, 0);
3957
  add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
3958
	      PREFIX_PRIORITY_LAST, 1, 0);
3959
3982
3983
  gcc_assert (!IS_ABSOLUTE_PATH (tooldir_base_prefix));
3960
  tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
3984
  tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
3961
			   dir_separator_str, NULL);
3985
			   dir_separator_str, NULL);
3962
3986
3963
  /* If tooldir is relative, base it on exec_prefixes.  A relative
3987
  /* Look for tools relative to the location from which the driver is
3964
     tooldir lets us move the installed tree as a unit.
3988
     running, or, if that is not available, the configured prefix.  */
3965
3989
  tooldir_prefix
3966
     If GCC_EXEC_PREFIX is defined, then we want to add two relative
3990
    = concat (gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix,
3967
     directories, so that we can search both the user specified directory
3991
	      spec_machine, dir_separator_str,
3968
     and the standard place.  */
3992
	      spec_version, dir_separator_str, tooldir_prefix, NULL);
3969
3970
  if (!IS_ABSOLUTE_PATH (tooldir_prefix))
3971
    {
3972
      if (gcc_exec_prefix)
3973
	{
3974
	  char *gcc_exec_tooldir_prefix
3975
	    = concat (gcc_exec_prefix, spec_machine, dir_separator_str,
3976
		      spec_version, dir_separator_str, tooldir_prefix, NULL);
3977
3978
	  add_prefix (&exec_prefixes,
3979
		      concat (gcc_exec_tooldir_prefix, "bin",
3980
			      dir_separator_str, NULL),
3981
		      NULL, PREFIX_PRIORITY_LAST, 0, 0);
3982
	  add_prefix (&startfile_prefixes,
3983
		      concat (gcc_exec_tooldir_prefix, "lib",
3984
			      dir_separator_str, NULL),
3985
		      NULL, PREFIX_PRIORITY_LAST, 0, 1);
3986
	}
3987
3988
      tooldir_prefix = concat (standard_exec_prefix, spec_machine,
3989
			       dir_separator_str, spec_version,
3990
			       dir_separator_str, tooldir_prefix, NULL);
3991
    }
3992
3993
3993
  add_prefix (&exec_prefixes,
3994
  add_prefix (&exec_prefixes,
3994
	      concat (tooldir_prefix, "bin", dir_separator_str, NULL),
3995
	      concat (tooldir_prefix, "bin", dir_separator_str, NULL),
Lines 6311-6328 main (int argc, char **argv) Link Here
6311
			      PREFIX_PRIORITY_LAST, 0, 1);
6312
			      PREFIX_PRIORITY_LAST, 0, 1);
6312
      else if (*cross_compile == '0')
6313
      else if (*cross_compile == '0')
6313
	{
6314
	{
6314
	  if (gcc_exec_prefix)
6315
	    add_prefix (&startfile_prefixes,
6316
			concat (gcc_exec_prefix, machine_suffix,
6317
				standard_startfile_prefix, NULL),
6318
			NULL, PREFIX_PRIORITY_LAST, 0, 1);
6319
	  add_prefix (&startfile_prefixes,
6315
	  add_prefix (&startfile_prefixes,
6320
		      concat (standard_exec_prefix,
6316
		      concat (gcc_exec_prefix 
6321
			      machine_suffix,
6317
			      ? gcc_exec_prefix : standard_exec_prefix, 
6318
			      machine_suffix, 
6322
			      standard_startfile_prefix, NULL),
6319
			      standard_startfile_prefix, NULL),
6323
		      NULL, PREFIX_PRIORITY_LAST, 0, 1);
6320
		      NULL, PREFIX_PRIORITY_LAST, 0, 1);
6324
	}
6321
	}
6325
6322
6323
      /* Sysrooted prefixes are relocated because target_system_root is
6324
	 also relocated by gcc_exec_prefix.  */
6326
      if (*standard_startfile_prefix_1)
6325
      if (*standard_startfile_prefix_1)
6327
 	add_sysrooted_prefix (&startfile_prefixes,
6326
 	add_sysrooted_prefix (&startfile_prefixes,
6328
			      standard_startfile_prefix_1, "BINUTILS",
6327
			      standard_startfile_prefix_1, "BINUTILS",
Lines 6366-6372 main (int argc, char **argv) Link Here
6366
6365
6367
  if (print_search_dirs)
6366
  if (print_search_dirs)
6368
    {
6367
    {
6369
      printf (_("install: %s%s\n"), standard_exec_prefix, machine_suffix);
6368
      printf (_("install: %s%s\n"),
6369
	      gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix,
6370
	      gcc_exec_prefix ? "" : machine_suffix);
6370
      printf (_("programs: %s\n"),
6371
      printf (_("programs: %s\n"),
6371
	      build_search_list (&exec_prefixes, "", false, false));
6372
	      build_search_list (&exec_prefixes, "", false, false));
6372
      printf (_("libraries: %s\n"),
6373
      printf (_("libraries: %s\n"),

Return to bug 17621