Commit d7ee9e9b authored by nickc's avatar nickc
Browse files

* gcc.c (this_is_linker_script): New variable. Like

        this_is_library_file but for the %T constructor.
        (end_going_arg): If this_is_linker_script is set then locate the
        script and insert a --script switch before it
        (do_spec_2): Initialise this_is_linker_script.
        (do_spec_1): Likewise.  Handle %T construct.
        (eval_spec_function): Preserve this_is_linker_script.
        * doc/invoke.texi: Document %T construct in spec files.
        * config/m32c/m32c.h (LIB_SPEC): Use it.


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@151477 138bc75d-0d04-0410-961f-82ee72b054a4
parent 75bad54c
2009-09-07 Nick Clifton <nickc@redhat.com>
* gcc.c (this_is_linker_script): New variable. Like
this_is_library_file but for the %T constructor.
(end_going_arg): If this_is_linker_script is set then locate the
script and insert a --script switch before it
(do_spec_2): Initialise this_is_linker_script.
(do_spec_1): Likewise. Handle %T construct.
(eval_spec_function): Preserve this_is_linker_script.
* doc/invoke.texi: Document %T construct in spec files.
* config/m32c/m32c.h (LIB_SPEC): Use it.
2009-09-07 Andreas Krebbel <Andreas.Krebbel@de.ibm.com>
 
* rtl.h (PREFETCH_SCHEDULE_BARRIER_P): New macro.
......
......@@ -48,12 +48,12 @@
thing when no CPU is specified, which defaults to R8C. */
#undef LIB_SPEC
#define LIB_SPEC "-( -lc %{msim*:-lsim}%{!msim*:-lnosys} -) \
%{msim*:%{!T*: %{mcpu=m32cm:-Tsim24.ld}%{mcpu=m32c:-Tsim24.ld} \
%{!mcpu=m32cm:%{!mcpu=m32c:-Tsim16.ld}}}} \
%{!T*:%{!msim*: %{mcpu=m16c:-Tm16c.ld} \
%{mcpu=m32cm:-Tm32cm.ld} \
%{mcpu=m32c:-Tm32c.ld} \
%{!mcpu=m16c:%{!mcpu=m32cm:%{!mcpu=m32c:-Tr8c.ld}}}}} \
%{msim*:%{!T*: %{mcpu=m32cm:%Tsim24.ld}%{mcpu=m32c:%Tsim24.ld} \
%{!mcpu=m32cm:%{!mcpu=m32c:%Tsim16.ld}}}} \
%{!T*:%{!msim*: %{mcpu=m16c:%Tm16c.ld} \
%{mcpu=m32cm:%Tm32cm.ld} \
%{mcpu=m32c:%Tm32c.ld} \
%{!mcpu=m16c:%{!mcpu=m32cm:%{!mcpu=m32c:%Tr8c.ld}}}}} \
"
/* Run-time Target Specification */
......
......@@ -8840,7 +8840,16 @@ and @option{-imultilib} as necessary.
@item %s
Current argument is the name of a library or startup file of some sort.
Search for that file in a standard list of directories and substitute
the full name found.
the full name found. The current working directory is included in the
list of directories scanned.
@item %T
Current argument is the name of a linker script. Search for that file
in the current list of directories to scan for libraries. If the file
is located insert a @option{--script} option into the command line
followed by the full path name found. If the file is not found then
generate an error message. Note: the current working directory is not
searched.
 
@item %e@var{str}
Print @var{str} as an error message. @var{str} is terminated by a newline.
......
......@@ -4685,6 +4685,13 @@ static int this_is_output_file;
search dirs for it. */
static int this_is_library_file;
/* Nonzero means %T has been seen; the next arg to be terminated
is the name of a linker script and we should try all of the
standard search dirs for it. If it is found insert a --script
command line switch and then substitute the full path in place,
otherwise generate an error message. */
static int this_is_linker_script;
/* Nonzero means that the input of this command is coming from a pipe. */
static int input_from_pipe;
......@@ -4705,6 +4712,19 @@ end_going_arg (void)
string = XOBFINISH (&obstack, const char *);
if (this_is_library_file)
string = find_file (string);
if (this_is_linker_script)
{
char * full_script_path = find_a_file (&startfile_prefixes, string, R_OK, true);
if (full_script_path == NULL)
{
error (_("unable to locate default linker script '%s' in the library search paths"), string);
/* Script was not found on search path. */
return;
}
store_arg ("--script", false, false);
string = full_script_path;
}
store_arg (string, delete_this_arg, this_is_output_file);
if (this_is_output_file)
outfiles[input_file_number] = string;
......@@ -4794,6 +4814,7 @@ do_spec_2 (const char *spec)
delete_this_arg = 0;
this_is_output_file = 0;
this_is_library_file = 0;
this_is_linker_script = 0;
input_from_pipe = 0;
suffix_subst = NULL;
......@@ -5081,6 +5102,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
delete_this_arg = 0;
this_is_output_file = 0;
this_is_library_file = 0;
this_is_linker_script = 0;
input_from_pipe = 0;
break;
......@@ -5100,6 +5122,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
delete_this_arg = 0;
this_is_output_file = 0;
this_is_library_file = 0;
this_is_linker_script = 0;
break;
case '%':
......@@ -5547,6 +5570,10 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
this_is_library_file = 1;
break;
case 'T':
this_is_linker_script = 1;
break;
case 'V':
outfiles[input_file_number] = NULL;
break;
......@@ -5921,6 +5948,7 @@ eval_spec_function (const char *func, const char *args)
int save_this_is_output_file;
int save_this_is_library_file;
int save_input_from_pipe;
int save_this_is_linker_script;
const char *save_suffix_subst;
......@@ -5937,6 +5965,7 @@ eval_spec_function (const char *func, const char *args)
save_delete_this_arg = delete_this_arg;
save_this_is_output_file = this_is_output_file;
save_this_is_library_file = this_is_library_file;
save_this_is_linker_script = this_is_linker_script;
save_input_from_pipe = input_from_pipe;
save_suffix_subst = suffix_subst;
......@@ -5962,6 +5991,7 @@ eval_spec_function (const char *func, const char *args)
delete_this_arg = save_delete_this_arg;
this_is_output_file = save_this_is_output_file;
this_is_library_file = save_this_is_library_file;
this_is_linker_script = save_this_is_linker_script;
input_from_pipe = save_input_from_pipe;
suffix_subst = save_suffix_subst;
......
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