This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
add_sysrooted_prefix
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 18 Mar 2003 09:43:49 +1030
- Subject: add_sysrooted_prefix
This patch allows STARTFILE_PREFIX_SPEC to specify relative paths,
handling such paths as for relative STANDARD_STARTFILE_PREFIX paths.
ie. relative paths root at standard_exec_prefix/machine_suffix and
gcc_exec_prefix/machine_suffix.
I've also trimmed off add_sysrooted_prefix excess params, since
this function is called with the same last four params every time.
* gcc.c (add_sysrooted_prefix): Remove priority,
require_machine_suffix, warn, os_multilib params. Adjust add_prefix
call. Insert code handling relative prefix..
(main): ..from here. Adjust calls to add_sysrooted_prefix.
Index: gcc/gcc.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcc.c,v
retrieving revision 1.371
diff -u -p -r1.371 gcc.c
--- gcc/gcc.c 11 Mar 2003 06:42:18 -0000 1.371
+++ gcc/gcc.c 17 Mar 2003 11:41:56 -0000
@@ -300,7 +300,7 @@ static char *find_a_file PARAMS ((struct
static void add_prefix PARAMS ((struct path_prefix *, const char *,
const char *, int, int, int *, int));
static void add_sysrooted_prefix PARAMS ((struct path_prefix *, const char *,
- const char *, int, int, int *, int));
+ const char *));
static void translate_options PARAMS ((int *, const char *const **));
static char *skip_whitespace PARAMS ((char *));
static void delete_if_ordinary PARAMS ((const char *));
@@ -2577,22 +2577,27 @@ add_prefix (pprefix, prefix, component,
(*prev) = pl;
}
-/* Same as add_prefix, but prepending target_system_root to prefix. */
+/* For an absolute PREFIX, call add_prefix with target_system_root
+ prepended.
+ For a relative PREFIX, prepend standard_exec_prefix/machine_suffix,
+ and if gcc_exec_prefix is defined, call add_prefix with
+ gcc_exec_prefix/machine_suffix prepended as well. */
static void
-add_sysrooted_prefix (pprefix, prefix, component, priority,
- require_machine_suffix, warn, os_multilib)
+add_sysrooted_prefix (pprefix, prefix, component)
struct path_prefix *pprefix;
const char *prefix;
const char *component;
- /* enum prefix_priority */ int priority;
- int require_machine_suffix;
- int *warn;
- int os_multilib;
{
if (!IS_ABSOLUTE_PATHNAME (prefix))
- abort ();
+ {
+ if (gcc_exec_prefix)
+ add_prefix (pprefix,
+ concat (gcc_exec_prefix, machine_suffix, prefix, NULL),
+ component, PREFIX_PRIORITY_LAST, 0, NULL, 1);
- if (target_system_root)
+ prefix = concat (standard_exec_prefix, machine_suffix, prefix, NULL);
+ }
+ else if (target_system_root)
{
prefix = concat (target_system_root, prefix, NULL);
/* We have to override this because GCC's notion of sysroot
@@ -2600,8 +2605,7 @@ add_sysrooted_prefix (pprefix, prefix, c
component = "GCC";
}
- add_prefix (pprefix, prefix, component, priority,
- require_machine_suffix, warn, os_multilib);
+ add_prefix (pprefix, prefix, component, PREFIX_PRIORITY_LAST, 0, NULL, 1);
}
/* Execute the command specified by the arguments on the current line of spec.
@@ -6218,51 +6222,29 @@ main (argc, argv)
{
int ndx;
for (ndx = 0; ndx < argbuf_index; ndx++)
- add_sysrooted_prefix (&startfile_prefixes, argbuf[ndx], "BINUTILS",
- PREFIX_PRIORITY_LAST, 0, NULL, 1);
+ add_sysrooted_prefix (&startfile_prefixes, argbuf[ndx], "BINUTILS");
}
/* We should eventually get rid of all these and stick to
startfile_prefix_spec exclusively. */
else if (*cross_compile == '0' || target_system_root)
{
if (*md_exec_prefix)
- add_sysrooted_prefix (&startfile_prefixes, md_exec_prefix, "GCC",
- PREFIX_PRIORITY_LAST, 0, NULL, 1);
+ add_sysrooted_prefix (&startfile_prefixes, md_exec_prefix, "GCC");
if (*md_startfile_prefix)
- add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix,
- "GCC", PREFIX_PRIORITY_LAST, 0, NULL, 1);
+ add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix, "GCC");
if (*md_startfile_prefix_1)
add_sysrooted_prefix (&startfile_prefixes, md_startfile_prefix_1,
- "GCC", PREFIX_PRIORITY_LAST, 0, NULL, 1);
+ "GCC");
- /* If standard_startfile_prefix is relative, base it on
- standard_exec_prefix. This lets us move the installed tree
- as a unit. If GCC_EXEC_PREFIX is defined, base
- standard_startfile_prefix on that as well. */
- if (IS_ABSOLUTE_PATHNAME (standard_startfile_prefix))
- add_sysrooted_prefix (&startfile_prefixes,
- standard_startfile_prefix, "BINUTILS",
- PREFIX_PRIORITY_LAST, 0, NULL, 1);
- else
- {
- if (gcc_exec_prefix)
- add_prefix (&startfile_prefixes,
- concat (gcc_exec_prefix, machine_suffix,
- standard_startfile_prefix, NULL),
- NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
- add_prefix (&startfile_prefixes,
- concat (standard_exec_prefix,
- machine_suffix,
- standard_startfile_prefix, NULL),
- NULL, PREFIX_PRIORITY_LAST, 0, NULL, 1);
- }
+ add_sysrooted_prefix (&startfile_prefixes,
+ standard_startfile_prefix, "BINUTILS");
add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_1,
- "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
+ "BINUTILS");
add_sysrooted_prefix (&startfile_prefixes, standard_startfile_prefix_2,
- "BINUTILS", PREFIX_PRIORITY_LAST, 0, NULL, 1);
+ "BINUTILS");
#if 0 /* Can cause surprises, and one can use -B./ instead. */
add_prefix (&startfile_prefixes, "./", NULL,
PREFIX_PRIORITY_LAST, 1, NULL, 0);
--
Alan Modra
IBM OzLabs - Linux Technology Centre