aboutsummaryrefslogtreecommitdiff
path: root/gcc/config/aarch64
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2025-01-16 19:23:50 +0000
committerTamar Christina <tamar.christina@arm.com>2025-01-16 19:24:14 +0000
commit773beeaafb0ea31bd4e308b64781731d64b571ce (patch)
treee394ff4bb2d38fe99ac60216689a37028bb8994a /gcc/config/aarch64
parentd9835825b3d71bbbb93b3d6669174f4386be2cb1 (diff)
downloadgcc-773beeaafb0ea31bd4e308b64781731d64b571ce.zip
gcc-773beeaafb0ea31bd4e308b64781731d64b571ce.tar.gz
gcc-773beeaafb0ea31bd4e308b64781731d64b571ce.tar.bz2
AArch64: don't override march to assembler with mcpu if march is specified [PR110901]
When both -mcpu and -march are specified, the value of -march wins out. This is done correctly for the calls to cc1 and for the assembler directives we put out in assembly files. However in the call to as we don't do this and instead use the arch from the cpu. This leads to a situation that GCC cannot reliably be used to compile assembly files which don't have a .arch directive. This is quite common with .S files which use macros to selectively enable codepath based on what the preprocessor sees. The fix is to change MCPU_TO_MARCH_SPEC to not override the march if an march is already specified. gcc/ChangeLog: PR target/110901 * config/aarch64/aarch64.h (MCPU_TO_MARCH_SPEC): Don't override if march is set. gcc/testsuite/ChangeLog: PR target/110901 * gcc.target/aarch64/options_set_29.c: New test.
Diffstat (limited to 'gcc/config/aarch64')
-rw-r--r--gcc/config/aarch64/aarch64.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 1ab49e2..218868a 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -1510,7 +1510,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv);
CONFIG_TUNE_SPEC
#define MCPU_TO_MARCH_SPEC \
- " %{mcpu=*:-march=%:rewrite_mcpu(%{mcpu=*:%*})}"
+ "%{!march=*:%{mcpu=*:-march=%:rewrite_mcpu(%{mcpu=*:%*})}}"
extern const char *aarch64_rewrite_mcpu (int argc, const char **argv);
extern const char *is_host_cpu_not_armv8_base (int argc, const char **argv);