]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
arm: ensure the arch_name is always set for the build target
authorRichard Earnshaw <rearnsha@arm.com>
Mon, 26 Jul 2021 16:07:14 +0000 (17:07 +0100)
committerRichard Earnshaw <Richard.Earnshaw@arm.com>
Wed, 18 Aug 2021 15:22:37 +0000 (16:22 +0100)
This should never happen now if GCC is invoked by the driver, but in
the unusual case of calling cc1 (or its ilk) directly from the command
line the build target's arch_name string can remain NULL.  This can
complicate later processing meaning that we need to check for this
case explicitly in some circumstances.  Nothing should rely on this
behaviour, so it's simpler to always set the arch_name when
configuring the build target and be done with it.

gcc:

* config/arm/arm.c (arm_configure_build_target): Ensure the target's
arch_name is always set.

(cherry picked from commit 62e66c6a6cc52dc0e014141d369cff52757cd7ae)

gcc/config/arm/arm.c

index 783c5e51051f231419098c617304a8e7b02cc9f7..daafeb346830798e587fe0c3da00e31df59e70ab 100644 (file)
@@ -3430,6 +3430,8 @@ arm_configure_build_target (struct arm_build_target *target,
   const cpu_tune *tune_data = &all_tunes[arm_selected_tune - all_cores];
 
   /* Finish initializing the target structure.  */
+  if (!target->arch_name)
+    target->arch_name = arm_selected_arch->common.name;
   target->arch_pp_name = arm_selected_arch->arch;
   target->base_arch = arm_selected_arch->base_arch;
   target->profile = arm_selected_arch->profile;