diff options
author | gp <gp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-19 20:18:22 +0000 |
---|---|---|
committer | gp <gp@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-06-19 20:18:22 +0000 |
commit | 4ea7092218d384d0adb449ce200524b35beea036 (patch) | |
tree | 2024f46158cf2fe259848bc8db2acaa1646bba0c /gcc | |
parent | 7cf03db460c0edd5ce27df501e7ca18e621655a4 (diff) | |
download | gcc-4ea7092218d384d0adb449ce200524b35beea036.tar.gz |
* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@68223 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 13 | ||||
-rw-r--r-- | gcc/gcc.c | 57 |
3 files changed, 77 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6190238099e..161cbf0a03f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +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> * c-aux-info.c: Convert to ISO C90. diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 4ba28b5dccc..52697e157b6 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -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 @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 @item EXTRA_SPECS Define this macro to provide additional specifications to put in the diff --git a/gcc/gcc.c b/gcc/gcc.c index e35ffc614ab..d599e4a84e8 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -212,6 +212,14 @@ static const char *target_system_root = 0; 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 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. */ # define STARTFILE_PREFIX_SPEC "" #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 *cpp_spec = CPP_SPEC; static const char *cc1_spec = CC1_SPEC; @@ -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_libgcc_spec = LINK_LIBGCC_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. There should be no need to override these in target dependent files, @@ -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_1", &md_startfile_prefix_1), 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 */ @@ -2611,7 +2631,10 @@ add_sysrooted_prefix (pprefix, prefix, component, priority, if (target_system_root) { + if (target_sysroot_suffix) + prefix = concat (target_sysroot_suffix, prefix, NULL); prefix = concat (target_system_root, prefix, NULL); + /* We have to override this because GCC's notion of sysroot moves along with GCC. */ component = "GCC"; @@ -4824,12 +4847,15 @@ do_spec_1 (spec, inswitch, soft_matched_part) 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); /* Make this a separate argument. */ do_spec_1 (" ", 0, 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); } @@ -5040,8 +5066,13 @@ do_spec_1 (spec, inswitch, soft_matched_part) /* We assume there is a directory separator at the end of this string. */ 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; case 'S': @@ -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. */ if (*startfile_prefix_spec != 0 && do_spec_2 (startfile_prefix_spec) == 0 |