diff mbox

[arm-embedded,GCC/ARM] Define arm_arch_core_flags in a single file

Message ID ab647c35-bad8-ad4c-368d-94859d7d27c0@foss.arm.com
State New
Headers show

Commit Message

Thomas Preudhomme Dec. 9, 2016, 5:46 p.m. UTC
We have decided to apply the patch proposed for trunk to solve the bloating of 
arm_arch_core_flags structure in GCC and files compiled by it to ARM 
embedded-6-branch.

ChangeLog.arm entry is as follows:


*** gcc/ChangeLog.arm ***

2016-12-09  Thomas Preud'homme  <thomas.preudhomme@arm.com>

	gcc/
	* config/arm/arm-opts.h: Move struct arm_arch_core_flag and
	arm_arch_core_flags to ...
	* common/config/arm/arm-common.c: There.


Best regards,

Thomas
Hi,

This patch moves the definition of arm_arch_core_flags along with the 
declaration of its structure element type to common/config/arm/arm-common.c so 
that it is not *defined* in all object files including tm.h. Otherwise, GCC gets 
bloated with as many copy of that array as there is file including tm.h and 
executable as well given that crtbegin gets a copy too.

ChangeLog entry is as follows:


*** gcc/ChangeLog ***

2016-12-09  Thomas Preud'homme  <thomas.preudhomme@arm.com>

         * config/arm/arm-opts.h: Move struct arm_arch_core_flag and
         arm_arch_core_flags to ...
         * common/config/arm/arm-common.c: There.


Testing: successfully built GCC configured with --with-cpu=cortex-a15 and 
optional_thumb testcases pass (without any option for -1 and -2, with 
-mcpu=cortex-m3 for -3 to satisfy requirements): build is working and feature as 
well.

Is this ok for stage3?

Best regards,

Thomas
diff mbox

Patch

diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c
index 473417a2e5f04488197c27ead2b65680bddec274..c0de5d2563ffbe0149bc5b089c4b74f177e4f740 100644
--- a/gcc/common/config/arm/arm-common.c
+++ b/gcc/common/config/arm/arm-common.c
@@ -98,6 +98,26 @@  arm_rewrite_mcpu (int argc, const char **argv)
   return arm_rewrite_selected_cpu (argv[argc - 1]);
 }
 
+struct arm_arch_core_flag
+{
+  const char *const name;
+  const arm_feature_set flags;
+};
+
+static const struct arm_arch_core_flag arm_arch_core_flags[] =
+{
+#undef ARM_CORE
+#define ARM_CORE(NAME, X, IDENT, ARCH, FLAGS, COSTS) \
+  {NAME, FLAGS},
+#include "config/arm/arm-cores.def"
+#undef ARM_CORE
+#undef ARM_ARCH
+#define ARM_ARCH(NAME, CORE, ARCH, FLAGS) \
+  {NAME, FLAGS},
+#include "config/arm/arm-arches.def"
+#undef ARM_ARCH
+};
+
 /* Called by the driver to check whether the target denoted by current
    command line options is a Thumb-only target.  ARGV is an array of
    -march and -mcpu values (ie. it contains the rhs after the equal
diff --git a/gcc/config/arm/arm-opts.h b/gcc/config/arm/arm-opts.h
index 6971534a562e7b37a67d9a20f40f29b5f00dd9bc..e06fedbcf5c075a07899e641a7ea2273144eb762 100644
--- a/gcc/config/arm/arm-opts.h
+++ b/gcc/config/arm/arm-opts.h
@@ -79,24 +79,4 @@  enum arm_tls_type {
   TLS_GNU,
   TLS_GNU2
 };
-
-struct arm_arch_core_flag
-{
-  const char *const name;
-  const arm_feature_set flags;
-};
-
-static const struct arm_arch_core_flag arm_arch_core_flags[] =
-{
-#undef ARM_CORE
-#define ARM_CORE(NAME, X, IDENT, ARCH, FLAGS, COSTS) \
-  {NAME, FLAGS},
-#include "arm-cores.def"
-#undef ARM_CORE
-#undef ARM_ARCH
-#define ARM_ARCH(NAME, CORE, ARCH, FLAGS) \
-  {NAME, FLAGS},
-#include "arm-arches.def"
-#undef ARM_ARCH
-};
 #endif