This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Pass -mtune and -march options to assembler.
No. This doesn't work for assemblers other than GNU as.
Ok. Let's pass options to the assembler via optional
option :) - temporary enviroment variable. If assembler
can't use it - no problem.
This is a 2 part patch. First one for GCC, second patch
for GNU AS.
This patch fixes PR 40171 by passing optimization options
-mtune and -march to the assembler via temporary
enviroment
variable AS_OPT_OPTION.
Part 1 (GCC)
2009-05-25 Vladimir Volynsky <vvv@ru.ru>
PR target/40171
* gcc.c (process_command): Pass -mtune and -march
options to the assembler via temporary enviroment
variable AS_OPT_OPTION
--- gcc/gcc.c 2009-05-25 22:36:22.000000000 +0400
+++ gcc/gcc.c.vv 2009-05-25 22:41:14.000000000 +0400
@@ -3744,6 +3744,20 @@ process_command (int argc, const
char **
print_multi_os_directory = 1;
else if (! strcmp (argv[i],
"-print-sysroot-headers-suffix"))
print_sysroot_headers_suffix = 1;
+ else if (! strncmp (argv[i], "-mtune", 6))
+ {
+ /* Pass -mtune not obligatory option to the assembler.
+ Used temporary enviroment variable AS_OPT_OPTION.
+ This option can be overridden by assembler option
-Wa, */
+ setenv("AS_OPT_OPTION",argv[i],1);
+ }
+ else if (! strncmp (argv[i], "-march", 6))
+ {
+ /* Pass -march option to the assembler.
+ Used temporary enviroment variable AS_OPT_OPTION.
+ This option can be overridden by assembler option
-Wa, */
+ setenv("AS_OPT_OPTION",argv[i],1);
+ }
else if (! strncmp (argv[i], "-Wa,", 4))
{
int prev, j;
Part 2 (BINUTILS)
2009-05-25 Vladimir Volynsky <vvv@ru.ru>
PR target/40171
* as.c (parse_args): Add option from enviroment
variable AS_OPT_OPTION
--- gas/as.c 2009-05-25 22:45:11.000000000 +0400
+++ gas/as.c.vv 2009-05-25 22:46:10.000000000 +0400
@@ -517,6 +517,12 @@ parse_args (int * pargc, char ***
pargv)
old_argc = *pargc;
old_argv = *pargv;
+ /* Add enviroment variable AS_OPT_OPTION to local copy
of the old argv. */
+ if( getenv("AS_OPT_OPTION")!=NULL )
+ {
+ old_argv[old_argc++]=getenv("AS_OPT_OPTION");
+ }
+
/* Initialize a new argv that contains no options. */
new_argv = xmalloc (sizeof (char *) * (old_argc + 1));
new_argv[0] = old_argv[0];
Vladimir.
---
Professional hosting for everyone - http://www.host.ru