From patchwork Wed Nov 27 12:15:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 36295 Received: (qmail 109943 invoked by alias); 27 Nov 2019 12:15:32 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 109786 invoked by uid 89); 27 Nov 2019 12:15:21 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Nov 2019 12:15:20 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id A9D162018B; Wed, 27 Nov 2019 07:15:17 -0500 (EST) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [8.43.85.239]) by mx1.osci.io (Postfix) with ESMTP id 6AEC2203AC for ; Wed, 27 Nov 2019 07:15:16 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id 4AA6620AF6 for ; Wed, 27 Nov 2019 07:15:16 -0500 (EST) X-Gerrit-PatchSet: 1 Date: Wed, 27 Nov 2019 07:15:16 -0500 From: "Luis Machado (Code Review)" To: gdb-patches@sourceware.org Message-ID: Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange Subject: [review] [ARM, sim] Fix build error and warnings X-Gerrit-Change-Id: I21db699d3b61b2de8c44053e47be4387285af28f X-Gerrit-Change-Number: 726 X-Gerrit-ChangeURL: X-Gerrit-Commit: 2650f4cf5fdcdad48033763425070cfdcec43e7a References: Reply-To: luis.machado@linaro.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3-79-g83ff7f88f1 Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/726 ...................................................................... [ARM, sim] Fix build error and warnings Newer GCC's have switched to -fno-common by default, and this breaks the build for the ARM sim, like this: binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:65: multiple definition of `DSPsc'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:134: first defined here binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:64: multiple definition of `DSPacc'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:133: first defined here binutils-gdb.git~gdb-8.3-release/sim/arm/maverick.c:63: multiple definition of `DSPregs'; libsim.a(wrapper.o):binutils-gdb.git~gdb-8.3-release/sim/arm/wrapper.c:132: first defined here I also noticed a few warnings due to mismatching types, as follows: binutils-gdb/sim/arm/wrapper.c:870:31: warning: passing argument 1 of ‘sim_target_parse_arg_array’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] sim_target_parse_arg_array (argv); binutils-gdb/sim/arm/wrapper.c:775:1: note: expected ‘char **’ but argument is of type ‘char * const*’ sim_target_parse_arg_array (char ** argv) The following patch fixes both of the above. sim/arm/ChangeLog: 2019-11-26 Luis Machado * armemu.c (isize): Move this declaration ... * arminit.c (isize): ... here. * wrapper.c (DSPregs): Make extern. (DSPacc): Likewise. (DSPsc): Likewise. (sim_create_inferior): Cast variables to proper type. Signed-off-by: Luis Machado Change-Id: I21db699d3b61b2de8c44053e47be4387285af28f --- M sim/arm/armemu.c M sim/arm/arminit.c M sim/arm/wrapper.c 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index 76f398b..3a72277 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -1140,10 +1140,6 @@ /* EMULATION of ARM6. */ -/* The PC pipeline value depends on whether ARM - or Thumb instructions are being executed. */ -ARMword isize; - ARMword #ifdef MODE32 ARMul_Emulate32 (ARMul_State * state) diff --git a/sim/arm/arminit.c b/sim/arm/arminit.c index 851d356..3a626c8 100644 --- a/sim/arm/arminit.c +++ b/sim/arm/arminit.c @@ -40,6 +40,10 @@ ARMword ARMul_ImmedTable[4096]; /* immediate DP LHS values */ char ARMul_BitList[256]; /* number of bits in a byte table */ +/* The PC pipeline value depends on whether ARM + or Thumb instructions are being executed. */ +ARMword isize; + /***************************************************************************\ * Call this routine once to set up the emulator's tables. * \***************************************************************************/ diff --git a/sim/arm/wrapper.c b/sim/arm/wrapper.c index fde5d8c..9f86e08 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -129,9 +129,9 @@ long double ld; /* Acc registers are 72-bits. */ }; -struct maverick_regs DSPregs[16]; -union maverick_acc_regs DSPacc[4]; -ARMword DSPsc; +extern struct maverick_regs DSPregs[16]; +extern union maverick_acc_regs DSPacc[4]; +extern ARMword DSPsc; static void init (void) @@ -236,7 +236,7 @@ { int argvlen = 0; int mach; - char **arg; + char * const *arg; init (); @@ -867,7 +867,7 @@ sim_callback = cb; - sim_target_parse_arg_array (argv); + sim_target_parse_arg_array ((char **) argv); if (argv[1] != NULL) {