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
This directory contains the GNU Compiler Collection (GCC).
The GNU Compiler Collection is free software. See the files whose
names start with COPYING for copying permission. The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.
The directory INSTALL contains copies of the installation information
as HTML and plain text. The source of this information is
gcc/doc/install.texi. The installation information includes details
of what is included in the GCC sources and what files GCC installs.
See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information. An online readable
version of the manual is in the files gcc/doc/gcc.info*.
See http://gcc.gnu.org/bugs/ for how to report bugs usefully.
Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.