This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: TARGET_CPU_DEFAULT broken in ppc
- From: Dale Johannesen <dalej at apple dot com>
- To: Aldy Hernandez <aldyh at redhat dot com>
- Cc: Dale Johannesen <dalej at apple dot com>, David Edelsohn <dje at watson dot ibm dot com>, gcc external <gcc at gcc dot gnu dot org>
- Date: Tue, 11 Dec 2001 17:09:47 -0800
- Subject: Re: TARGET_CPU_DEFAULT broken in ppc
On Tuesday, December 11, 2001, at 04:36 PM, Aldy Hernandez wrote:
> [including list]
>
> [background: what i want to do is add configury magic so when i
> configure for, say powerpc-elfaltivec, i get a gcc that automatically
> has "-maltivec".]
>
>> Can you use -mabi=altivec as the string? It seems that what the
>> processing at the bottom of config.gcc might allow.
>>
>> David
>
> hi david.
>
> i can't see how TARGET_CPU_DEFAULT can work at all on the ppc.
>
> the rest of the ports have stuff like:
>
> target_cpu_default="TARGET_BLAH | TARGET_FOO"
>
> the ppc backend uses TARGET_CPU_DEFAULT as a string, not as a set of
> flags. it uses it as a string to pass override_options:
>
> #define OVERRIDE_OPTIONS rs6000_override_options (TARGET_CPU_DEFAULT)
>
> but if you set it to any string, ala:
>
> target_cpu_default="-mfoobar"
Looks like shell ate the quotes.
> the config .h files have this definition:
>
> #define TARGET_CPU_DEFAULT (-mfoobar)
>
> which obviously won't work when passed to override_options.
>
> otoh, if i enclose -mfoobar in quotes like this:
>
> target_cpu_default="'-mfoobar'"
>
> then compiling sysv4.h gets all confused:
>
> rs6000_file_start (FILE, TARGET_CPU_DEFAULT);
>
> /source/uber/devo/gcc/toplev.c:4488: character constant too long
> /source/uber/devo/gcc/toplev.c:4488: warning: passing arg 2 of
> `rs6000_file_start' makes pointer from integer without a cast
> /source/uber/devo/gcc/toplev.c: In function `process_options':
> /source/uber/devo/gcc/toplev.c:4775: character constant too long
> /source/uber/devo/gcc/toplev.c:4775: warning: passing arg 1 of
> `rs6000_override_options' makes pointer from integer without a cast
> make: *** [toplev.o] Error 1\
So presumably it was passed '-mfoobar' which isn't a string. Try
'"-mfoobar"' or \"-mfoobar\"
> and i see no reference at all in config.gcc to set TARGET_CPU_DEFAULT to
> *any* value. so all the ppc backend is doing is taking the default
> action in rs6000.h:
>
> /* Default string to use for cpu if not specified. */
> #ifndef TARGET_CPU_DEFAULT
> #define TARGET_CPU_DEFAULT ((char *)0)
> #endif
>
> afaict, rs6000_override_options never gets passed any value in
> default_cpu, so most of it's fancy code is useless.
That doesn't follow; most of the processing doesn't involve default_cpu.
This is where -mcpu gets parsed and it works.