Commit e7f13528 by Graeme Peterson Committed by Graeme Peterson

gcc.c (target_sysroot_suffix, [...]): New.

* gcc.c (target_sysroot_suffix, target_sysroot_hdrs_suffix,
SYSROOT_SUFFIX_SPEC, SYSROOT_HEADERS_SUFFIX_SPEC, sysroot_suffix_spec,
sysroot_hdrs_suffix_spec): New.
(static_specs): Initialize new variables.
(add_sysroot_suffix_prefix, do_spec_1, main): Use new variables.
* doc/tm.texi (SYSROOT_SUFFIX_SPEC, SYSROOT_HEADERS_SUFFIX_SPEC):
New macros.

From-SVN: r68223
parent 97460e9a
2003-06-19 Graeme Peterson <gp@qnx.com>
* gcc.c (target_sysroot_suffix, target_sysroot_hdrs_suffix,
SYSROOT_SUFFIX_SPEC, SYSROOT_HEADERS_SUFFIX_SPEC, sysroot_suffix_spec,
sysroot_hdrs_suffix_spec): New.
(static_specs): Initialize new variables.
(add_sysroot_suffix_prefix, do_spec_1, main): Use new variables.
* doc/tm.texi (SYSROOT_SUFFIX_SPEC, SYSROOT_HEADERS_SUFFIX_SPEC):
New macros.
2003-06-19 Andreas Jaeger <aj@suse.de> 2003-06-19 Andreas Jaeger <aj@suse.de>
* c-aux-info.c: Convert to ISO C90. * c-aux-info.c: Convert to ISO C90.
......
...@@ -320,6 +320,19 @@ blanks that names one of the recognized thread models. @code{%*}, the ...@@ -320,6 +320,19 @@ blanks that names one of the recognized thread models. @code{%*}, the
default value of this macro, will expand to the value of default value of this macro, will expand to the value of
@code{thread_file} set in @file{config.gcc}. @code{thread_file} set in @file{config.gcc}.
@findex SYSROOT_SUFFIX_SPEC
@item SYSROOT_SUFFIX_SPEC
Define this macro to add a suffix to the target sysroot when GCC is
configured with a sysroot. This will cause GCC to search for usr/lib,
et al, within sysroot+suffix.
@findex SYSROOT_HEADERS_SUFFIX_SPEC
@item SYSROOT_HEADERS_SUFFIX_SPEC
Define this macro to add a headers_suffix to the target sysroot when
GCC is configured with a sysroot. This will cause GCC to pass the
updated sysroot+headers_suffix to CPP@, causing it to search for
usr/include, et al, within sysroot+headers_suffix.
@findex EXTRA_SPECS @findex EXTRA_SPECS
@item EXTRA_SPECS @item EXTRA_SPECS
Define this macro to provide additional specifications to put in the Define this macro to provide additional specifications to put in the
......
...@@ -212,6 +212,14 @@ static const char *target_system_root = 0; ...@@ -212,6 +212,14 @@ static const char *target_system_root = 0;
static int target_system_root_changed; static int target_system_root_changed;
/* Nonzero means append this string to target_system_root. */
static const char *target_sysroot_suffix = 0;
/* Nonzero means append this string to target_system_root for headers. */
static const char *target_sysroot_hdrs_suffix = 0;
/* Nonzero means write "temp" files in source directory /* Nonzero means write "temp" files in source directory
and use the source file's name in them, and don't delete them. */ and use the source file's name in them, and don't delete them. */
...@@ -703,6 +711,14 @@ proper position among the other output files. */ ...@@ -703,6 +711,14 @@ proper position among the other output files. */
# define STARTFILE_PREFIX_SPEC "" # define STARTFILE_PREFIX_SPEC ""
#endif #endif
#ifndef SYSROOT_SUFFIX_SPEC
# define SYSROOT_SUFFIX_SPEC ""
#endif
#ifndef SYSROOT_HEADERS_SUFFIX_SPEC
# define SYSROOT_HEADERS_SUFFIX_SPEC ""
#endif
static const char *asm_debug; static const char *asm_debug;
static const char *cpp_spec = CPP_SPEC; static const char *cpp_spec = CPP_SPEC;
static const char *cc1_spec = CC1_SPEC; static const char *cc1_spec = CC1_SPEC;
...@@ -720,6 +736,8 @@ static const char *linker_name_spec = LINKER_NAME; ...@@ -720,6 +736,8 @@ static const char *linker_name_spec = LINKER_NAME;
static const char *link_command_spec = LINK_COMMAND_SPEC; static const char *link_command_spec = LINK_COMMAND_SPEC;
static const char *link_libgcc_spec = LINK_LIBGCC_SPEC; static const char *link_libgcc_spec = LINK_LIBGCC_SPEC;
static const char *startfile_prefix_spec = STARTFILE_PREFIX_SPEC; static const char *startfile_prefix_spec = STARTFILE_PREFIX_SPEC;
static const char *sysroot_suffix_spec = SYSROOT_SUFFIX_SPEC;
static const char *sysroot_hdrs_suffix_spec = SYSROOT_HEADERS_SUFFIX_SPEC;
/* Standard options to cpp, cc1, and as, to reduce duplication in specs. /* Standard options to cpp, cc1, and as, to reduce duplication in specs.
There should be no need to override these in target dependent files, There should be no need to override these in target dependent files,
...@@ -1499,6 +1517,8 @@ static struct spec_list static_specs[] = ...@@ -1499,6 +1517,8 @@ static struct spec_list static_specs[] =
INIT_STATIC_SPEC ("md_startfile_prefix", &md_startfile_prefix), INIT_STATIC_SPEC ("md_startfile_prefix", &md_startfile_prefix),
INIT_STATIC_SPEC ("md_startfile_prefix_1", &md_startfile_prefix_1), INIT_STATIC_SPEC ("md_startfile_prefix_1", &md_startfile_prefix_1),
INIT_STATIC_SPEC ("startfile_prefix_spec", &startfile_prefix_spec), INIT_STATIC_SPEC ("startfile_prefix_spec", &startfile_prefix_spec),
INIT_STATIC_SPEC ("sysroot_suffix_spec", &sysroot_suffix_spec),
INIT_STATIC_SPEC ("sysroot_hdrs_suffix_spec", &sysroot_hdrs_suffix_spec),
}; };
#ifdef EXTRA_SPECS /* additional specs needed */ #ifdef EXTRA_SPECS /* additional specs needed */
...@@ -2611,7 +2631,10 @@ add_sysrooted_prefix (pprefix, prefix, component, priority, ...@@ -2611,7 +2631,10 @@ add_sysrooted_prefix (pprefix, prefix, component, priority,
if (target_system_root) if (target_system_root)
{ {
if (target_sysroot_suffix)
prefix = concat (target_sysroot_suffix, prefix, NULL);
prefix = concat (target_system_root, prefix, NULL); prefix = concat (target_system_root, prefix, NULL);
/* We have to override this because GCC's notion of sysroot /* We have to override this because GCC's notion of sysroot
moves along with GCC. */ moves along with GCC. */
component = "GCC"; component = "GCC";
...@@ -4824,12 +4847,15 @@ do_spec_1 (spec, inswitch, soft_matched_part) ...@@ -4824,12 +4847,15 @@ do_spec_1 (spec, inswitch, soft_matched_part)
do_spec_1 (" ", 0, NULL); do_spec_1 (" ", 0, NULL);
} }
if (target_system_root_changed) if (target_system_root_changed ||
(target_system_root && target_sysroot_hdrs_suffix))
{ {
do_spec_1 ("-isysroot", 1, NULL); do_spec_1 ("-isysroot", 1, NULL);
/* Make this a separate argument. */ /* Make this a separate argument. */
do_spec_1 (" ", 0, NULL); do_spec_1 (" ", 0, NULL);
do_spec_1 (target_system_root, 1, NULL); do_spec_1 (target_system_root, 1, NULL);
if (target_sysroot_hdrs_suffix)
do_spec_1 (target_sysroot_hdrs_suffix, 1, NULL);
do_spec_1 (" ", 0, NULL); do_spec_1 (" ", 0, NULL);
} }
...@@ -5040,8 +5066,13 @@ do_spec_1 (spec, inswitch, soft_matched_part) ...@@ -5040,8 +5066,13 @@ do_spec_1 (spec, inswitch, soft_matched_part)
/* We assume there is a directory /* We assume there is a directory
separator at the end of this string. */ separator at the end of this string. */
if (target_system_root) if (target_system_root)
obstack_grow (&obstack, target_system_root, {
strlen (target_system_root)); obstack_grow (&obstack, target_system_root,
strlen (target_system_root));
if (target_sysroot_suffix)
obstack_grow (&obstack, target_sysroot_suffix,
strlen (target_sysroot_suffix));
}
break; break;
case 'S': case 'S':
...@@ -6124,6 +6155,26 @@ main (argc, argv) ...@@ -6124,6 +6155,26 @@ main (argc, argv)
} }
} }
/* Process sysroot_suffix_spec. */
if (*sysroot_suffix_spec != 0
&& do_spec_2 (sysroot_suffix_spec) == 0)
{
if (argbuf_index > 1)
error ("spec failure: more than one arg to SYSROOT_SUFFIX_SPEC.");
else if (argbuf_index == 1)
target_sysroot_suffix = xstrdup (argbuf[argbuf_index -1]);
}
/* Process sysroot_hdrs_suffix_spec. */
if (*sysroot_hdrs_suffix_spec != 0
&& do_spec_2 (sysroot_hdrs_suffix_spec) == 0)
{
if (argbuf_index > 1)
error ("spec failure: more than one arg to SYSROOT_HEADERS_SUFFIX_SPEC.");
else if (argbuf_index == 1)
target_sysroot_hdrs_suffix = xstrdup (argbuf[argbuf_index -1]);
}
/* Look for startfiles in the standard places. */ /* Look for startfiles in the standard places. */
if (*startfile_prefix_spec != 0 if (*startfile_prefix_spec != 0
&& do_spec_2 (startfile_prefix_spec) == 0 && do_spec_2 (startfile_prefix_spec) == 0
......
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