diff mbox

[GCC/ARM] Define arm_arch_core_flags in a single file

Message ID f249acf6-b2dd-52ab-f736-9679e2e19258@foss.arm.com
State Superseded
Headers show

Commit Message

Thomas Preudhomme Dec. 9, 2016, 4:56 p.m. UTC
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

Comments

Richard Earnshaw (lists) Dec. 10, 2016, 11:15 a.m. UTC | #1
On 09/12/16 16:56, Thomas Preudhomme wrote:
> 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


OK.

R.
Christophe Lyon Dec. 14, 2016, 10 a.m. UTC | #2
Hi Thomas,

On 9 December 2016 at 17:56, Thomas Preudhomme
<thomas.preudhomme@foss.arm.com> wrote:
> 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


I've noticed that this patch (r243541) causes regressions on
armeb-none-linux-gnueabihf
in arm mode:
FAIL:gcc.dg/vect/pr64252.c execution test

This is bit surprising given the nature of change...

Christophe
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