Commit f4c0a303 by Carlos O'Donell Committed by Carlos O'Donell

gcc.c: Organize search path variables into $prefix relative, and well-known native.

gcc/

2006-11-13  Carlos O'Donell  <carlos@codesourcery.com>
	    Mark Mitchell  <mark@codesourcery.com>

	* gcc.c: Organize search path variables into $prefix relative,
	and well-known native. Add comments.
	(add_sysrooted_prefix): Add comment.
	(process_command): If !gcc_exec_prefix add $prefix based paths.
	If *cross_compile == '0', add native well-known paths.
	Assert tooldir_base_prefix is always relative.
	(main): If print_search_dirs, and if gcc_exec_prefix is set,
	use this value for 'install:' path.
	* Makefile.in: Add GCC_EXEC_PREFIX to generated site.exp.

gcc/testsuite/

2006-11-13  Carlos O'Donell  <carlos@codesourcery.com>

	* lib/c-torture.exp: Use target-libpath.exp.
	* lib/target-libpath.exp (set_ld_library_path_env_vars): If present,
	set GCC_EXEC_PREFIX env var from global variable of same name.


Co-Authored-By: Mark Mitchell <mark@codesourcery.com>

From-SVN: r118765
parent 8fbbf354
2006-11-13 Carlos O'Donell <carlos@codesourcery.com>
Mark Mitchell <mark@codesourcery.com>
* gcc.c: Organize search path variables into $prefix relative,
and well-known native. Add comments.
(add_sysrooted_prefix): Add comment.
(process_command): If !gcc_exec_prefix add $prefix based paths.
If *cross_compile == '0', add native well-known paths.
Assert tooldir_base_prefix is always relative.
(main): If print_search_dirs, and if gcc_exec_prefix is set,
use this value for 'install:' path.
* Makefile.in: Add GCC_EXEC_PREFIX to generated site.exp.
2006-11-13 H.J. Lu <hongjiu.lu@intel.com> 2006-11-13 H.J. Lu <hongjiu.lu@intel.com>
* config/i386/i386.c: Fix a typo in comment. * config/i386/i386.c: Fix a typo in comment.
......
...@@ -3986,6 +3986,7 @@ site.exp: ./config.status Makefile ...@@ -3986,6 +3986,7 @@ site.exp: ./config.status Makefile
@echo "set HOSTCFLAGS \"$(CFLAGS)\"" >> ./tmp0 @echo "set HOSTCFLAGS \"$(CFLAGS)\"" >> ./tmp0
@echo "set TESTING_IN_BUILD_TREE 1" >> ./tmp0 @echo "set TESTING_IN_BUILD_TREE 1" >> ./tmp0
@echo "set HAVE_LIBSTDCXX_V3 1" >> ./tmp0 @echo "set HAVE_LIBSTDCXX_V3 1" >> ./tmp0
@echo "set GCC_EXEC_PREFIX \"$(libdir)/gcc/\"" >> ./tmp0
# If newlib has been configured, we need to pass -B to gcc so it can find # If newlib has been configured, we need to pass -B to gcc so it can find
# newlib's crt0.o if it exists. This will cause a "path prefix not used" # newlib's crt0.o if it exists. This will cause a "path prefix not used"
# message if it doesn't, but the testsuite is supposed to ignore the message - # message if it doesn't, but the testsuite is supposed to ignore the message -
......
...@@ -1472,25 +1472,33 @@ static const char *gcc_libexec_prefix; ...@@ -1472,25 +1472,33 @@ static const char *gcc_libexec_prefix;
#define MD_STARTFILE_PREFIX_1 "" #define MD_STARTFILE_PREFIX_1 ""
#endif #endif
/* These directories are locations set at configure-time based on the
--prefix option provided to configure. Their initializers are
defined in Makefile.in. These paths are not *directly* used when
gcc_exec_prefix is set because, in that case, we know where the
compiler has been installed, and use paths relative to that
location instead. */
static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX; static const char *const standard_exec_prefix = STANDARD_EXEC_PREFIX;
static const char *const standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX;
/* For native compilers, these are well-known paths containing
components that may be provided by the system. For cross
compilers, these paths are not used. */
static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/"; static const char *const standard_exec_prefix_1 = "/usr/libexec/gcc/";
static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/"; static const char *const standard_exec_prefix_2 = "/usr/lib/gcc/";
static const char *md_exec_prefix = MD_EXEC_PREFIX; static const char *md_exec_prefix = MD_EXEC_PREFIX;
static const char *md_startfile_prefix = MD_STARTFILE_PREFIX; static const char *md_startfile_prefix = MD_STARTFILE_PREFIX;
static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1; static const char *md_startfile_prefix_1 = MD_STARTFILE_PREFIX_1;
static const char *const standard_startfile_prefix = STANDARD_STARTFILE_PREFIX; static const char *const standard_startfile_prefix_1
static const char *const standard_startfile_prefix_1
= STANDARD_STARTFILE_PREFIX_1; = STANDARD_STARTFILE_PREFIX_1;
static const char *const standard_startfile_prefix_2 static const char *const standard_startfile_prefix_2
= STANDARD_STARTFILE_PREFIX_2; = STANDARD_STARTFILE_PREFIX_2;
/* A relative path to be used in finding the location of tools
relative to the driver. */
static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX; static const char *const tooldir_base_prefix = TOOLDIR_BASE_PREFIX;
static const char *tooldir_prefix;
static const char *const standard_bindir_prefix = STANDARD_BINDIR_PREFIX;
static const char *standard_libexec_prefix = STANDARD_LIBEXEC_PREFIX;
/* Subdirectory to use for locating libraries. Set by /* Subdirectory to use for locating libraries. Set by
set_multilib_dir based on the compilation options. */ set_multilib_dir based on the compilation options. */
...@@ -2749,6 +2757,7 @@ add_prefix (struct path_prefix *pprefix, const char *prefix, ...@@ -2749,6 +2757,7 @@ add_prefix (struct path_prefix *pprefix, const char *prefix,
} }
/* Same as add_prefix, but prepending target_system_root to prefix. */ /* Same as add_prefix, but prepending target_system_root to prefix. */
/* The target_system_root prefix has been relocated by gcc_exec_prefix. */
static void static void
add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix, add_sysrooted_prefix (struct path_prefix *pprefix, const char *prefix,
const char *component, const char *component,
...@@ -3278,6 +3287,7 @@ process_command (int argc, const char **argv) ...@@ -3278,6 +3287,7 @@ process_command (int argc, const char **argv)
int is_modify_target_name; int is_modify_target_name;
unsigned int j; unsigned int j;
#endif #endif
const char *tooldir_prefix;
GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX"); GET_ENVIRONMENT (gcc_exec_prefix, "GCC_EXEC_PREFIX");
...@@ -3383,10 +3393,18 @@ process_command (int argc, const char **argv) ...@@ -3383,10 +3393,18 @@ process_command (int argc, const char **argv)
gcc_libexec_prefix = make_relative_prefix (tmp_prefix, gcc_libexec_prefix = make_relative_prefix (tmp_prefix,
standard_exec_prefix, standard_exec_prefix,
standard_libexec_prefix); standard_libexec_prefix);
/* The path is unrelocated, so fallback to the original setting. */
if (!gcc_libexec_prefix)
gcc_libexec_prefix = standard_libexec_prefix;
free (tmp_prefix); free (tmp_prefix);
} }
#else #else
#endif #endif
/* From this point onward, gcc_exec_prefix is non-null if the toolchain
is relocated. The toolchain was either relocated using GCC_EXEC_PREFIX
or an automatically created GCC_EXEC_PREFIX from argv[0]. */
if (gcc_exec_prefix) if (gcc_exec_prefix)
{ {
...@@ -3936,62 +3954,50 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n" ...@@ -3936,62 +3954,50 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n"
use_pipes = 0; use_pipes = 0;
} }
/* Set up the search paths before we go looking for config files. */ /* Set up the search paths. We add directories that we expect to
contain GNU Toolchain components before directories specified by
the machine description so that we will find GNU components (like
the GNU assembler) before those of the host system. */
/* These come before the md prefixes so that we will find gcc's subcommands /* If we don't know where the toolchain has been installed, use the
(such as cpp) rather than those of the host system. */ configured-in locations. */
/* Use 2 as fourth arg meaning try just the machine as a suffix, if (!gcc_exec_prefix)
as well as trying the machine and the version. */ {
#ifndef OS2 #ifndef OS2
add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC", add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC",
PREFIX_PRIORITY_LAST, 1, 0); PREFIX_PRIORITY_LAST, 1, 0);
add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS", add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, 0); PREFIX_PRIORITY_LAST, 2, 0);
add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS", add_prefix (&exec_prefixes, standard_exec_prefix, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, 0); PREFIX_PRIORITY_LAST, 2, 0);
add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, 0);
add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, 0);
#endif #endif
add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS",
PREFIX_PRIORITY_LAST, 1, 0);
}
add_prefix (&startfile_prefixes, standard_exec_prefix, "BINUTILS", /* If not cross-compiling, search well-known system locations. */
PREFIX_PRIORITY_LAST, 1, 0); if (*cross_compile == '0')
add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS", {
PREFIX_PRIORITY_LAST, 1, 0); #ifndef OS2
add_prefix (&exec_prefixes, standard_exec_prefix_1, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, 0);
add_prefix (&exec_prefixes, standard_exec_prefix_2, "BINUTILS",
PREFIX_PRIORITY_LAST, 2, 0);
#endif
add_prefix (&startfile_prefixes, standard_exec_prefix_2, "BINUTILS",
PREFIX_PRIORITY_LAST, 1, 0);
}
gcc_assert (!IS_ABSOLUTE_PATH (tooldir_base_prefix));
tooldir_prefix = concat (tooldir_base_prefix, spec_machine, tooldir_prefix = concat (tooldir_base_prefix, spec_machine,
dir_separator_str, NULL); dir_separator_str, NULL);
/* If tooldir is relative, base it on exec_prefixes. A relative /* Look for tools relative to the location from which the driver is
tooldir lets us move the installed tree as a unit. running, or, if that is not available, the configured prefix. */
tooldir_prefix
If GCC_EXEC_PREFIX is defined, then we want to add two relative = concat (gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix,
directories, so that we can search both the user specified directory spec_machine, dir_separator_str,
and the standard place. */ spec_version, dir_separator_str, tooldir_prefix, NULL);
if (!IS_ABSOLUTE_PATH (tooldir_prefix))
{
if (gcc_exec_prefix)
{
char *gcc_exec_tooldir_prefix
= concat (gcc_exec_prefix, spec_machine, dir_separator_str,
spec_version, dir_separator_str, tooldir_prefix, NULL);
add_prefix (&exec_prefixes,
concat (gcc_exec_tooldir_prefix, "bin",
dir_separator_str, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, 0);
add_prefix (&startfile_prefixes,
concat (gcc_exec_tooldir_prefix, "lib",
dir_separator_str, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, 1);
}
tooldir_prefix = concat (standard_exec_prefix, spec_machine,
dir_separator_str, spec_version,
dir_separator_str, tooldir_prefix, NULL);
}
add_prefix (&exec_prefixes, add_prefix (&exec_prefixes,
concat (tooldir_prefix, "bin", dir_separator_str, NULL), concat (tooldir_prefix, "bin", dir_separator_str, NULL),
...@@ -6314,18 +6320,16 @@ main (int argc, char **argv) ...@@ -6314,18 +6320,16 @@ main (int argc, char **argv)
PREFIX_PRIORITY_LAST, 0, 1); PREFIX_PRIORITY_LAST, 0, 1);
else if (*cross_compile == '0') else if (*cross_compile == '0')
{ {
if (gcc_exec_prefix)
add_prefix (&startfile_prefixes,
concat (gcc_exec_prefix, machine_suffix,
standard_startfile_prefix, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, 1);
add_prefix (&startfile_prefixes, add_prefix (&startfile_prefixes,
concat (standard_exec_prefix, concat (gcc_exec_prefix
machine_suffix, ? gcc_exec_prefix : standard_exec_prefix,
machine_suffix,
standard_startfile_prefix, NULL), standard_startfile_prefix, NULL),
NULL, PREFIX_PRIORITY_LAST, 0, 1); NULL, PREFIX_PRIORITY_LAST, 0, 1);
} }
/* Sysrooted prefixes are relocated because target_system_root is
also relocated by gcc_exec_prefix. */
if (*standard_startfile_prefix_1) if (*standard_startfile_prefix_1)
add_sysrooted_prefix (&startfile_prefixes, add_sysrooted_prefix (&startfile_prefixes,
standard_startfile_prefix_1, "BINUTILS", standard_startfile_prefix_1, "BINUTILS",
...@@ -6369,7 +6373,9 @@ main (int argc, char **argv) ...@@ -6369,7 +6373,9 @@ main (int argc, char **argv)
if (print_search_dirs) if (print_search_dirs)
{ {
printf (_("install: %s%s\n"), standard_exec_prefix, machine_suffix); printf (_("install: %s%s\n"),
gcc_exec_prefix ? gcc_exec_prefix : standard_exec_prefix,
gcc_exec_prefix ? "" : machine_suffix);
printf (_("programs: %s\n"), printf (_("programs: %s\n"),
build_search_list (&exec_prefixes, "", false, false)); build_search_list (&exec_prefixes, "", false, false));
printf (_("libraries: %s\n"), printf (_("libraries: %s\n"),
......
2006-11-13 Carlos O'Donell <carlos@codesourcery.com>
* lib/c-torture.exp: Use target-libpath.exp.
* lib/target-libpath.exp (set_ld_library_path_env_vars): If present,
set GCC_EXEC_PREFIX env var from global variable of same name.
2006-11-12 Andrew Pinski <andrew_pinski@playstation.sony.com> 2006-11-12 Andrew Pinski <andrew_pinski@playstation.sony.com>
PR fortran/26994 PR fortran/26994
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
# This file was written by Rob Savoye. (rob@cygnus.com) # This file was written by Rob Savoye. (rob@cygnus.com)
load_lib file-format.exp load_lib file-format.exp
load_lib target-libpath.exp
# The default option list can be overridden by # The default option list can be overridden by
# TORTURE_OPTIONS="{ { list1 } ... { listN } }" # TORTURE_OPTIONS="{ { list1 } ... { listN } }"
...@@ -40,6 +41,19 @@ if ![info exists TORTURE_OPTIONS] { ...@@ -40,6 +41,19 @@ if ![info exists TORTURE_OPTIONS] {
{ -Os } ] { -Os } ]
} }
global GCC_UNDER_TEST
if ![info exists GCC_UNDER_TEST] {
set GCC_UNDER_TEST "[find_gcc]"
}
global orig_environment_saved
# This file may be sourced, so don't override environment settings
# that have been previously setup.
if { $orig_environment_saved == 0 } {
append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
set_ld_library_path_env_vars
}
# Split TORTURE_OPTIONS into two choices: one for testcases with loops and # Split TORTURE_OPTIONS into two choices: one for testcases with loops and
# one for testcases without loops. # one for testcases without loops.
......
...@@ -50,6 +50,12 @@ proc set_ld_library_path_env_vars { } { ...@@ -50,6 +50,12 @@ proc set_ld_library_path_env_vars { } {
global orig_ld_library_path_32 global orig_ld_library_path_32
global orig_ld_library_path_64 global orig_ld_library_path_64
global orig_dyld_library_path global orig_dyld_library_path
global GCC_EXEC_PREFIX
# Set the relocated compiler prefix, but only if the user hasn't specified one.
if { [info exists GCC_EXEC_PREFIX] && ![info exists env(GCC_EXEC_PREFIX)] } {
setenv GCC_EXEC_PREFIX "$GCC_EXEC_PREFIX"
}
# Setting the ld library path causes trouble when testing cross-compilers. # Setting the ld library path causes trouble when testing cross-compilers.
if { [is_remote target] } { if { [is_remote target] } {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment