sim/ppc: Fix linker error with -fno-common

Message ID aab686eb-d640-4fed-0a7b-f425f880178b@embedded-brains.de
State Superseded
Headers show
Series
  • sim/ppc: Fix linker error with -fno-common
Related show

Commit Message

Sebastian Huber July 2, 2020, 3:26 p.m.
sim/ppc

* ld-insn.h (last_model, last_model_data, last_model_function,
last_model_internal, last_model_macro, last_model_static):
Delete.
(max_model_fields_len, model_data, model_functions,
model_internal, model_macros, model_static, models): Declare, but do not
define.
* ld-insn.c (last_model, last_model_data, last_model_function,
last_model_internal, last_model_macro, last_model_static,
max_model_fields_len, model_data, model_functions,
model_internal, model_macros, model_static, models): Define.
---
sim/ppc/ld-insn.c | 18 ++++++++++++++++++
sim/ppc/ld-insn.h | 24 +++++++-----------------
2 files changed, 25 insertions(+), 17 deletions(-)

Comments

Simon Marchi July 3, 2020, 12:08 a.m. | #1
On 2020-07-02 11:26 a.m., Sebastian Huber wrote:
> sim/ppc

> 

> * ld-insn.h (last_model, last_model_data, last_model_function,

> last_model_internal, last_model_macro, last_model_static):

> Delete.

> (max_model_fields_len, model_data, model_functions,

> model_internal, model_macros, model_static, models): Declare, but do not

> define.

> * ld-insn.c (last_model, last_model_data, last_model_function,

> last_model_internal, last_model_macro, last_model_static,

> max_model_fields_len, model_data, model_functions,

> model_internal, model_macros, model_static, models): Define.


Hi Sebastian,

When fixing a build error, please put a copy of the error in the commit message.
Also, please describe the problem and the fix, if not obvious.

Here, it would also be good to mention that gcc master has this flag enabled by
default, so it's likely that the next release will have it too.

It's not possible to apply your patches, it looks like they get modified by your
email client.  Could you please try to send them using git-send-email?  If that's
really not possible, an acceptable alternative is to use git-format-patch and
attach them as attachment, this way you know they won't get garbled.

The code itself looks ok to me, but I'm not a sim maintainer.

Simon

Patch

diff --git a/sim/ppc/ld-insn.c b/sim/ppc/ld-insn.c
index e39131ca133..585071a861f 100644
--- a/sim/ppc/ld-insn.c
+++ b/sim/ppc/ld-insn.c
@@ -28,6 +28,24 @@ 
#include "igen.h"
+static model *last_model;
+
+static insn *last_model_macro;
+static insn *last_model_function;
+static insn *last_model_internal;
+static insn *last_model_static;
+static insn *last_model_data;
+
+model *models;
+
+insn *model_macros;
+insn *model_functions;
+insn *model_internal;
+insn *model_static;
+insn *model_data;
+
+int max_model_fields_len;
+
static void
update_depth(insn_table *entry,
lf *file,
diff --git a/sim/ppc/ld-insn.h b/sim/ppc/ld-insn.h
index 88318ffa2b3..52baeaa2d84 100644
--- a/sim/ppc/ld-insn.h
+++ b/sim/ppc/ld-insn.h
@@ -200,25 +200,15 @@  extern insn_table *load_insn_table
table_include *includes,
cache_table **cache_rules);
-model *models;
-model *last_model;
+extern model *models;
-insn *model_macros;
-insn *last_model_macro;
+extern insn *model_macros;
+extern insn *model_functions;
+extern insn *model_internal;
+extern insn *model_static;
+extern insn *model_data;
-insn *model_functions;
-insn *last_model_function;
-
-insn *model_internal;
-insn *last_model_internal;
-
-insn *model_static;
-insn *last_model_static;
-
-insn *model_data;
-insn *last_model_data;
-
-int max_model_fields_len;
+extern int max_model_fields_len;
extern void insn_table_insert_insn
(insn_table *table,

-- 
2.16.4