2017-11-20 21:43:55 +08:00
|
|
|
// Make sure -mthumb does not affect assembler triple, but -Wa,-mthumb or
|
|
|
|
// -Xassembler -mthumb does. Also check that -Wa,-mthumb or -Xassembler -mthumb
|
|
|
|
// does not affect non assembler files.
|
|
|
|
|
|
|
|
// RUN: %clang -target armv7a-linux-gnueabi -### -c -mthumb %s 2>&1 | \
|
|
|
|
// RUN: FileCheck -check-prefix=TRIPLE-ARM %s
|
|
|
|
// RUN: %clang -target armv7a-linux-gnueabi -### -c -Wa,-mthumb \
|
[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-01 19:29:14 +08:00
|
|
|
// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck -check-prefix=TRIPLE-ARM %s
|
|
|
|
// RUN: %clang -target armv7a-linux-gnueabi -### -c -Wa,-mcpu=cortex-a8,-mthumb \
|
|
|
|
// RUN: %S/Inputs/wildcard1.c 2>&1 | FileCheck -check-prefix=TRIPLE-ARM %s
|
2017-11-20 21:43:55 +08:00
|
|
|
|
2018-08-09 06:23:57 +08:00
|
|
|
// TRIPLE-ARM: "-triple" "armv7-unknown-linux-gnueabi"
|
2017-11-20 21:43:55 +08:00
|
|
|
|
|
|
|
// RUN: %clang -target armv7a-linux-gnueabi -### -c -Wa,-mthumb %s 2>&1 | \
|
|
|
|
// RUN: FileCheck -check-prefix=TRIPLE-THUMB %s
|
[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-01 19:29:14 +08:00
|
|
|
// RUN: %clang -target armv7a-linux-gnueabi -### -c -Wa,-mcpu=cortex-a8,-mthumb %s 2>&1 | \
|
|
|
|
// RUN: FileCheck -check-prefix=TRIPLE-THUMB %s
|
|
|
|
// RUN: %clang -target armv7a-linux-gnueabi -### -c -Wa,-mcpu=cortex-a8 -Wa,-mthumb %s 2>&1 | \
|
|
|
|
// RUN: FileCheck -check-prefix=TRIPLE-THUMB %s
|
2017-11-20 21:43:55 +08:00
|
|
|
// RUN: %clang -target armv7a-linux-gnueabi -### -c -Xassembler -mthumb %s \
|
|
|
|
// RUN: 2>&1 | FileCheck -check-prefix=TRIPLE-THUMB %s
|
|
|
|
|
2018-08-09 06:23:57 +08:00
|
|
|
// TRIPLE-THUMB: "-triple" "thumbv7-unknown-linux-gnueabi"
|