diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-05-30 16:39:52 +0000 |
---|---|---|
committer | Mike Frysinger <vapier@gcc.gnu.org> | 2015-05-30 16:39:52 +0000 |
commit | 98ca38bf64ad2123f0de39d6a61cd87d2c77f49d (patch) | |
tree | e042c38f95d8c0110b333ff2cc62178e656e3a9e | |
parent | 4af8bb97627ff9ac46116bf5121187fada59ec60 (diff) | |
download | gcc-98ca38bf64ad2123f0de39d6a61cd87d2c77f49d.zip gcc-98ca38bf64ad2123f0de39d6a61cd87d2c77f49d.tar.gz gcc-98ca38bf64ad2123f0de39d6a61cd87d2c77f49d.tar.bz2 |
alpha: turn -mcpu=<cpu> into -m<cpu> for the assembler all the time
If you create a toolchain with the target alphaev68-unknown-linux-gnu, gcc
will use the -mcpu=ev67 by default when compiling. Some software packages
(like gmp) will use this target info to decide that it may freely use
assembly code that targets ev67+. The trouble comes in when trying to
compile that pure assembly code.
While gcc will use -mcpu=ev67 just fine, it will invoke gas without an
-mev67 option, so the assembler will default to the lowest common
denominator -- ev4 in this case. Inline assembly in C code is normally
just peachy because gcc's assembler output will start with ".arch <cpu>"
and the assembler will accept that. But if the hand coded assembly code
lacks that .arch, you easily end up with errors like so:
opcode `cttz' not supported for target <all>
While the assembly code could/should be fixed to explicitly output the
.arch directive, I think it's reasonable to expect this to work:
echo 'cttz $20,$21' | gcc -x assembler -c - -o /dev/null -mcpu=ev67
This simple patch implements that, although I guess it is a bit redundant
in the default case where gcc outputs .arch. Perhaps that should all be
punted in favor of a specs-only approach. Considering gas respects .arch
in the code over the command line, it should also make things more natural.
The command line is processed in the standard/expected way -- gcc defaults
the -m option while user's custom -mcpu/-Wa,-m options come after, and the
guy writing the assembly code is free to use .arch to override everything
else.
From-SVN: r223888
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/config/alpha/elf.h | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2f3fcae..7b3c784 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2015-05-30 Mike Frysinger <vapier@gentoo.org> + + * gcc/config/alpha/elf.h (ASM_SPEC): Add %{mcpu=*:-m%*}. + 2015-05-28 DJ Delorie <dj@redhat.com> * expmed.c (extract_bit_field_1): Avoid clobbering a diff --git a/gcc/config/alpha/elf.h b/gcc/config/alpha/elf.h index 50de72e..92bdfa3 100644 --- a/gcc/config/alpha/elf.h +++ b/gcc/config/alpha/elf.h @@ -22,7 +22,7 @@ along with GCC; see the file COPYING3. If not see #define CC1_SPEC "%{G*}" #undef ASM_SPEC -#define ASM_SPEC "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug}" +#define ASM_SPEC "%{G*} %{relax:-relax} %{!gstabs*:-no-mdebug}%{gstabs*:-mdebug} %{mcpu=*:-m%*}" /* Do not output a .file directive at the beginning of the input file. */ |