Commit 96f5b137 by H.J. Lu Committed by H.J. Lu

Keep -m[arch|tune]=native in COLLECT_GCC_OPTIONS.

2011-01-07  H.J. Lu  <hongjiu.lu@intel.com>

	PR driver/42445
	* gcc.c (%>S): New.
	(SWITCH_KEEP_FOR_GCC): Likewise.
	(set_collect_gcc_options): Check SWITCH_KEEP_FOR_GCC.
	(do_spec_1): Handle "%>".

	* config/i386/i386.h (CC1_CPU_SPEC): Replace "%<" with "%>".

From-SVN: r168583
parent c21bbd7a
2011-01-07 H.J. Lu <hongjiu.lu@intel.com>
PR driver/42445
* gcc.c (%>S): New.
(SWITCH_KEEP_FOR_GCC): Likewise.
(set_collect_gcc_options): Check SWITCH_KEEP_FOR_GCC.
(do_spec_1): Handle "%>".
* config/i386/i386.h (CC1_CPU_SPEC): Replace "%<" with "%>".
2011-01-07 Jakub Jelinek <jakub@redhat.com> 2011-01-07 Jakub Jelinek <jakub@redhat.com>
PR target/47201 PR target/47201
......
...@@ -561,9 +561,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); ...@@ -561,9 +561,9 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
#define CC1_CPU_SPEC CC1_CPU_SPEC_1 #define CC1_CPU_SPEC CC1_CPU_SPEC_1
#else #else
#define CC1_CPU_SPEC CC1_CPU_SPEC_1 \ #define CC1_CPU_SPEC CC1_CPU_SPEC_1 \
"%{march=native:%<march=native %:local_cpu_detect(arch) \ "%{march=native:%>march=native %:local_cpu_detect(arch) \
%{!mtune=*:%<mtune=native %:local_cpu_detect(tune)}} \ %{!mtune=*:%>mtune=native %:local_cpu_detect(tune)}} \
%{mtune=native:%<mtune=native %:local_cpu_detect(tune)}" %{mtune=native:%>mtune=native %:local_cpu_detect(tune)}"
#endif #endif
#endif #endif
......
...@@ -390,6 +390,7 @@ or with constant text in a single argument. ...@@ -390,6 +390,7 @@ or with constant text in a single argument.
Note - this command is position dependent. % commands in the Note - this command is position dependent. % commands in the
spec string before this one will see -S, % commands in the spec string before this one will see -S, % commands in the
spec string after this one will not. spec string after this one will not.
%>S Similar to "%<S", but keep it in the GCC command line.
%<S* remove all occurrences of all switches beginning with -S from the %<S* remove all occurrences of all switches beginning with -S from the
command line. command line.
%:function(args) %:function(args)
...@@ -2743,10 +2744,11 @@ execute (void) ...@@ -2743,10 +2744,11 @@ execute (void)
The `validated' field is nonzero if any spec has looked at this switch; The `validated' field is nonzero if any spec has looked at this switch;
if it remains zero at the end of the run, it must be meaningless. */ if it remains zero at the end of the run, it must be meaningless. */
#define SWITCH_LIVE 0x1 #define SWITCH_LIVE (1 << 0)
#define SWITCH_FALSE 0x2 #define SWITCH_FALSE (1 << 1)
#define SWITCH_IGNORE 0x4 #define SWITCH_IGNORE (1 << 2)
#define SWITCH_IGNORE_PERMANENTLY 0x8 #define SWITCH_IGNORE_PERMANENTLY (1 << 3)
#define SWITCH_KEEP_FOR_GCC (1 << 4)
struct switchstr struct switchstr
{ {
...@@ -3926,7 +3928,9 @@ set_collect_gcc_options (void) ...@@ -3926,7 +3928,9 @@ set_collect_gcc_options (void)
first_time = FALSE; first_time = FALSE;
/* Ignore elided switches. */ /* Ignore elided switches. */
if ((switches[i].live_cond & SWITCH_IGNORE) != 0) if ((switches[i].live_cond
& (SWITCH_IGNORE | SWITCH_KEEP_FOR_GCC))
== SWITCH_IGNORE)
continue; continue;
obstack_grow (&collect_obstack, "'-", 2); obstack_grow (&collect_obstack, "'-", 2);
...@@ -5091,10 +5095,17 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5091,10 +5095,17 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
/* Henceforth ignore the option(s) matching the pattern /* Henceforth ignore the option(s) matching the pattern
after the %<. */ after the %<. */
case '<': case '<':
case '>':
{ {
unsigned len = 0; unsigned len = 0;
int have_wildcard = 0; int have_wildcard = 0;
int i; int i;
int switch_option;
if (c == '>')
switch_option = SWITCH_IGNORE | SWITCH_KEEP_FOR_GCC;
else
switch_option = SWITCH_IGNORE;
while (p[len] && p[len] != ' ' && p[len] != '\t') while (p[len] && p[len] != ' ' && p[len] != '\t')
len++; len++;
...@@ -5106,7 +5117,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part) ...@@ -5106,7 +5117,7 @@ do_spec_1 (const char *spec, int inswitch, const char *soft_matched_part)
if (!strncmp (switches[i].part1, p, len - have_wildcard) if (!strncmp (switches[i].part1, p, len - have_wildcard)
&& (have_wildcard || switches[i].part1[len] == '\0')) && (have_wildcard || switches[i].part1[len] == '\0'))
{ {
switches[i].live_cond |= SWITCH_IGNORE; switches[i].live_cond |= switch_option;
switches[i].validated = 1; switches[i].validated = 1;
} }
......
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