llvm-capstone/clang
David Spickett 1d51c699b9 [clang][Arm] Fix handling of -Wa,-march=
This fixes Bugzilla #48894 for Arm, where it
was reported that -Wa,-march was not being handled
by the integrated assembler.

This was previously fixed for -Wa,-mthumb by
parsing the argument in ToolChain::ComputeLLVMTriple
instead of CollectArgsForIntegratedAssembler.
It has to be done in the former because the Triple
is read only by the time we get to the latter.

Previously only mcpu would work via -Wa but only because
"-target-cpu" is it's own option to cc1, which we were
able to modify. Target architecture is part of "-target-triple".

This change applies the same workaround to -march and cleans up
handling of -Wa,-mcpu at the same time. There were some
places where we were not using the last instance of an argument.

The existing -Wa,-mthumb code was doing this correctly,
so I've just added tests to confirm that.

Now the same rules will apply to -Wa,-march/-mcpu as would
if you just passed them to the compiler:
* -Wa/-Xassembler options only apply to assembly files.
* Architecture derived from mcpu beats any march options.
* When there are multiple mcpu or multiple march, the last
  one wins.
* If there is a compiler option and an assembler option of
  the same type, we prefer the one that fits the input type.
* If there is an applicable mcpu option but it is overruled
  by an march, the cpu value is still used for the "-target-cpu"
  cc1 option.

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D95872
2021-02-04 16:36:15 +00:00
..
bindings [NFC] Don't run python binding tests with sanitizers 2020-10-29 23:48:08 -07:00
cmake [clang] Add AddClang.cmake to the list of the CMake modules that are installed 2021-02-04 12:38:38 +00:00
docs [OpenCL][Docs] Link page explaining tooling for offline compilation. 2021-02-04 14:01:27 +00:00
examples Refactoring the attribute plugin example to fit the new API 2020-12-21 08:24:09 -05:00
include [flang][driver] Add support for -J/-module-dir 2021-02-04 16:31:40 +00:00
INPUTS
lib [clang][Arm] Fix handling of -Wa,-march= 2021-02-04 16:36:15 +00:00
runtime
test [clang][Arm] Fix handling of -Wa,-march= 2021-02-04 16:36:15 +00:00
tools [clang][cli] Command line round-trip for HeaderSearch options 2021-02-04 10:18:34 +01:00
unittests [Syntax] Support condition for IfStmt. 2021-02-04 09:15:30 +01:00
utils [clang-tblgen] AnnotateAttr::printPretty has spurious comma when no variadic argument is specified 2021-02-03 11:41:38 -08:00
www [Branch-Rename] Fix some links 2021-02-01 16:43:21 +05:30
.clang-format
.clang-tidy
.gitignore
CMakeLists.txt [clang][cli] Command line round-trip for HeaderSearch options 2021-02-04 10:18:34 +01:00
CODE_OWNERS.TXT
INSTALL.txt
LICENSE.TXT
ModuleInfo.txt
NOTES.txt
README.txt

//===----------------------------------------------------------------------===//
// C Language Family Front-end
//===----------------------------------------------------------------------===//

Welcome to Clang.  This is a compiler front-end for the C family of languages
(C, C++, Objective-C, and Objective-C++) which is built as part of the LLVM
compiler infrastructure project.

Unlike many other compiler frontends, Clang is useful for a number of things
beyond just compiling code: we intend for Clang to be host to a number of
different source-level tools.  One example of this is the Clang Static Analyzer.

If you're interested in more (including how to build Clang) it is best to read
the relevant web sites.  Here are some pointers:

Information on Clang:             http://clang.llvm.org/
Building and using Clang:         http://clang.llvm.org/get_started.html
Clang Static Analyzer:            http://clang-analyzer.llvm.org/
Information on the LLVM project:  http://llvm.org/

If you have questions or comments about Clang, a great place to discuss them is
on the Clang development mailing list:
  http://lists.llvm.org/mailman/listinfo/cfe-dev

If you find a bug in Clang, please file it in the LLVM bug tracker:
  http://llvm.org/bugs/