llvm-project/clang/lib/Driver/ToolChains
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
..
Arch [clang][Arm] Fix handling of -Wa,-march= 2021-02-04 16:36:15 +00:00
AIX.cpp [clang][driver] Fix definition/declaration argument name mismatches. NFCI. 2020-11-17 12:39:45 +00:00
AIX.h [clang][driver][AIX] Set compiler-rt as default rtlib 2020-09-28 19:45:43 -04:00
AMDGPU.cpp [hip] Fix HIP version parsing. 2021-01-06 17:00:14 -05:00
AMDGPU.h [OpenMP] Add OpenMP offloading toolchain for AMDGPU 2021-02-03 00:42:52 -05:00
AMDGPUOpenMP.cpp [OpenMP] Add OpenMP offloading toolchain for AMDGPU 2021-02-03 00:42:52 -05:00
AMDGPUOpenMP.h [OpenMP] Add OpenMP offloading toolchain for AMDGPU 2021-02-03 00:42:52 -05:00
AVR.cpp [clang][AVR][NFC] Fix a typo 2021-02-03 20:00:06 +08:00
AVR.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
Ananas.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Ananas.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
BareMetal.cpp Add initial support for multilibs in Baremetal toolchain. 2020-12-14 20:49:45 +00:00
BareMetal.h Add initial support for multilibs in Baremetal toolchain. 2020-12-14 20:49:45 +00:00
Clang.cpp [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
Clang.h [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
CloudABI.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
CloudABI.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
CommonArgs.cpp [CSSPGO] Passing the clang driver switch -fpseudo-probe-for-profiling to the linker. 2021-02-02 09:43:57 -08:00
CommonArgs.h [Driver][MachineOutliner] Support outlining option with LTO 2021-01-06 16:01:38 +01:00
Contiki.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Contiki.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
CrossWindows.cpp [clang][driver] Fix definition/declaration argument name mismatches. NFCI. 2020-11-17 12:39:45 +00:00
CrossWindows.h [clang][ToolChains] explicitly return LangOptions::StackProtectorMode 2020-10-28 11:20:30 -07:00
Cuda.cpp [OpenMP][deviceRTLs] Build the deviceRTLs with OpenMP instead of target dependent language 2021-01-26 12:28:47 -05:00
Cuda.h [DWARF] Allow toolchain to adjust specified DWARF version. 2020-12-09 16:34:34 -08:00
Darwin.cpp [Triple][MachO] Define "arm64e", an AArch64 subarch for Pointer Auth. 2020-12-03 07:53:59 -08:00
Darwin.h clang: Pass -platform-version to new MachO LLD 2020-11-24 11:16:03 -05:00
DragonFly.cpp [clang] update of the DragonFlyBSD's driver for the 5.8.x releases 2020-10-19 14:04:49 +01:00
DragonFly.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
Flang.cpp [flang][driver] Add support for `-J/-module-dir` 2021-02-04 16:31:40 +00:00
Flang.h [flang][driver] Add support for `-J/-module-dir` 2021-02-04 16:31:40 +00:00
FreeBSD.cpp [PowerPC] Support powerpcle target in Clang [3/5] 2021-01-02 12:17:58 -06:00
FreeBSD.h Fix regression due to test hip-version.hip 2020-07-11 12:45:29 -04:00
Fuchsia.cpp [clang][Fuchsia] Add relative-vtables + asan multilibs 2021-01-25 15:24:16 -08:00
Fuchsia.h [clang][ToolChains] explicitly return LangOptions::StackProtectorMode 2020-10-28 11:20:30 -07:00
Gnu.cpp clang: Always pass PowerPC endian information to GNU as 2021-01-11 14:50:28 -08:00
Gnu.h [Driver] Filter out <libdir>/gcc and <libdir>/gcc-cross if they do not exists 2020-09-29 09:18:50 +03:00
HIP.cpp [AMDGPU] add -mcode-object-version=n 2020-12-07 18:08:37 -05:00
HIP.h [OpenMP] Add OpenMP offloading toolchain for AMDGPU 2021-02-03 00:42:52 -05:00
Haiku.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Haiku.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Hexagon.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Hexagon.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
Hurd.cpp [Driver] Search computed sysroot for libc++ header paths 2020-06-17 16:17:37 -07:00
Hurd.h [Driver] Search computed sysroot for libc++ header paths 2020-06-17 16:17:37 -07:00
InterfaceStubs.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
InterfaceStubs.h [clang][ifs] Clang Interface Stubs ToolChain plumbing. 2019-10-08 15:23:14 +00:00
Lanai.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
Linux.cpp [LSan][RISCV] Enable LSan for RISCV64 2021-01-31 21:53:25 +00:00
Linux.h [AArch64][Clang][Linux] Enable out-of-line atomics by default. 2021-01-29 17:44:45 +00:00
MSP430.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
MSP430.h [MSP430] Actualize the toolchain description 2020-07-17 15:42:12 +03:00
MSVC.cpp [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
MSVC.h [clang-cl] Remove the /fallback option 2021-02-04 10:33:16 +01:00
MSVCSetupApi.h
MinGW.cpp [clang] [MinGW] Allow using the vptr sanitizer 2020-11-03 09:59:09 +02:00
MinGW.h Fix regression due to test hip-version.hip 2020-07-11 12:45:29 -04:00
Minix.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Minix.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
MipsLinux.cpp Make llvm::StringRef to std::string conversions explicit. 2020-01-28 23:25:25 +01:00
MipsLinux.h [Driver] Support object files in addition to static and shared libraries in compiler-rt 2019-03-12 02:12:48 +00:00
Myriad.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Myriad.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
NaCl.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
NaCl.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
NetBSD.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
NetBSD.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
OpenBSD.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
OpenBSD.h [clang][ToolChains] explicitly return LangOptions::StackProtectorMode 2020-10-28 11:20:30 -07:00
PPCLinux.cpp [PowerPC] [Clang] Add platform guards to PPC vector intrinsics headers 2019-07-30 02:18:11 +00:00
PPCLinux.h [PowerPC] [Clang] Port MMX intrinsics and basic test cases to Power 2019-04-23 05:50:24 +00:00
PS4CPU.cpp Reland - [Clang] Add the ability to map DLL storage class to visibility 2020-11-02 23:24:49 +00:00
PS4CPU.h [clang][ToolChains] explicitly return LangOptions::StackProtectorMode 2020-10-28 11:20:30 -07:00
RISCVToolchain.cpp [clang][Driver] Handle risvc in Baremetal.cpp. 2020-11-26 11:43:17 +00:00
RISCVToolchain.h [clang][Driver] Handle risvc in Baremetal.cpp. 2020-11-26 11:43:17 +00:00
ROCm.h [hip] Fix HIP version parsing. 2021-01-06 17:00:14 -05:00
Solaris.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
Solaris.h [clang][Driver] Default to /usr/bin/ld on Solaris 2020-08-13 22:42:58 +02:00
TCE.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
TCE.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
VEToolchain.cpp [VE] Add standard include path and library path for C++ 2020-12-03 22:22:56 +09:00
VEToolchain.h [VE] Change to use integrated assembly by defualt 2020-10-30 00:16:04 +09:00
WebAssembly.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
WebAssembly.h Clang Driver: refactor support for writing response files to be 2020-06-29 18:27:02 -04:00
XCore.cpp [Driver] Add output file to properties of Command 2020-10-08 18:23:39 +07:00
XCore.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
ZOS.cpp [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS 2020-09-16 14:49:03 -04:00
ZOS.h [SystemZ][z/OS] Set aligned allocation unavailable by default for z/OS 2020-09-16 14:49:03 -04:00