From patchwork Tue Nov 26 19:10:14 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Luis Machado X-Patchwork-Id: 180228 Delivered-To: patch@linaro.org Received: by 2002:a92:38d5:0:0:0:0:0 with SMTP id g82csp5058039ilf; Tue, 26 Nov 2019 11:10:42 -0800 (PST) X-Google-Smtp-Source: APXvYqxemrAnCjgGXNb2rvduGqwjh2gUtTgl1iHktJtUgTcjpq1iktyMPvFN0/yF/OQTN6fDC7U/ X-Received: by 2002:a50:970e:: with SMTP id c14mr27420786edb.20.1574795442066; Tue, 26 Nov 2019 11:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574795442; cv=none; d=google.com; s=arc-20160816; b=i51m/ZUIV8UXzqeKmmHxutrhfDE+4FjjMT98WMhL+tAAWxlUfPGrGlFYFUPjxnHvuz Ny5WRjXUybajMt5/NNhpyqAS6ooBecN9QKkPhkyNpM+9MeBkxoq4dvblCOEpPnrVc8bN MTnz7UMxg0we+jp7DlCb4zjpUyq6J8NS9ab1VW8TUL9wjGfAmu1KJSlzbjcSpAXK2g8x D6JiOS9OEIQQGIbWKodDog6N2KCKEFjFaOp0YkTgfJUFh5XYZMC1yCEhTO3EkLHP6ghq Vy9qsXTRD937ruZvpG/ZLoQ3qVlOOg1P04eR+nup63243kyauKJkkxYu93hyT758fW6D B16g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature:delivered-to:sender:list-help:list-post :list-archive:list-subscribe:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature; bh=FQ0iYGU9qH9T9jvib7rGOMbyCzfT6ITR1feydt+qpp8=; b=HW2nQUtUX/v/4MqAoMKQNsue78+p0HG/naCtg1IUfj4TM3PQvRRP4hi14JhaM0hF1t jh/YKn6RaIh9kukWkTT0LBAY5DMlLt9Sdv9iKmaYBYlFET9KkpI7SStAOTKCawokvawi DwW70nwC3TTc/JBxni+kk2kKq+1SRqgJiGq3NKiXAGFox5S8AHDCwc3FhcrMn143QEwW g6tPfS2YLROyANDylZl27yOfoCES39vdOo+TDGOiwLNVf6qqUzI7YGPj6M3AYaUBUri6 FPUIG1geY0q6suz8Pk7s6knmEIZMUaRdjdmOVRgKHqGSshDA6ajqnxF6AYBvYPtoU8fV 3hzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=sN4Q9Zwl; dkim=pass header.i=@linaro.org header.s=google header.b=Tbim0flC; spf=pass (google.com: domain of binutils-return-107746-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="binutils-return-107746-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id f7si8990776edy.92.2019.11.26.11.10.41 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Nov 2019 11:10:42 -0800 (PST) Received-SPF: pass (google.com: domain of binutils-return-107746-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@sourceware.org header.s=default header.b=sN4Q9Zwl; dkim=pass header.i=@linaro.org header.s=google header.b=Tbim0flC; spf=pass (google.com: domain of binutils-return-107746-patch=linaro.org@sourceware.org designates 209.132.180.131 as permitted sender) smtp.mailfrom="binutils-return-107746-patch=linaro.org@sourceware.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type:content-transfer-encoding; q=dns; s= default; b=fXMS6TYJvndlCroAgqPD1qjciEvRQfP4Gr9FD08PXhF9d1c+n75+i tP3hWWFUIdXbaR3Ywk6UpFVJXGt5WND2WKocIFvkytqI/8j3mTgaswJZk4VHsinm IT/fTzzd7BblUe8SLRmriC8l54gdqmY86bkiL3AmTF168JHLq38ZUo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:cc:subject:date:message-id :mime-version:content-type:content-transfer-encoding; s=default; bh=8Z4TckypGxFdrKdjq34/szaRY3k=; b=sN4Q9ZwloSjOwJUOzxpeHJTSNHjO VedC1RUwrPky7jfdZPxZX0BYEWcZZv3N9zr4Gwv5wQ3GRGx6NeVIynq6Khb24kX4 P7dKQ0NWpggBjF2u+XZo1dcGOpRlDPEaK3z462usNkEPCcSGq86oFi2f+RsLgoby toAaGZNwSEhrPvA= Received: (qmail 104599 invoked by alias); 26 Nov 2019 19:10:28 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Delivered-To: mailing list binutils@sourceware.org Received: (qmail 104586 invoked by uid 89); 26 Nov 2019 19:10:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=sim, UD:binutils-gdb.git, *************************************************************************** X-HELO: mail-qt1-f182.google.com Received: from mail-qt1-f182.google.com (HELO mail-qt1-f182.google.com) (209.85.160.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 26 Nov 2019 19:10:26 +0000 Received: by mail-qt1-f182.google.com with SMTP id 59so17098026qtg.8 for ; Tue, 26 Nov 2019 11:10:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=FQ0iYGU9qH9T9jvib7rGOMbyCzfT6ITR1feydt+qpp8=; b=Tbim0flC4aamYkk8n8a/t5QPP07yV1gafS1WvdBV60vQOBZGkTMVG81CKjpdbg6hMR NWqyxZTG9OTiH9FQC+GIHln3v+b2lilDvUSZHUU3Czt1W9Q+8wA5QmxdZsSKkepxIdS8 VZugH8iAV9KmvzW/mXl3N45qwe9Nyuwb8dTM7JRSF4wIr5+2HS9/AK54at0r1pqjB4pR 8OnEAeq+KEv+NP5xJ4xnsmmY1IQ5aq6oKdFBREiiC04aIFp5g81O/Zbz8rFxX/Qn5/hh pnD1rJ3jZHQlvLwMeLmnM8/7S/FsjfqRtgN/reV+jyW2PYiStcwtr+tX+0FAN5Mt04nZ ZULA== Return-Path: Received: from localhost.localdomain ([177.27.193.125]) by smtp.gmail.com with ESMTPSA id i189sm5566147qkc.65.2019.11.26.11.10.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2019 11:10:23 -0800 (PST) From: Luis Machado To: binutils@sourceware.org Cc: christophe.lyon@linaro.org Subject: [PATCH] [ARM, sim] Fix build error and warnings Date: Tue, 26 Nov 2019 16:10:14 -0300 Message-Id: <20191126191014.13576-1-luis.machado@linaro.org> MIME-Version: 1.0 X-IsSubscribed: yes 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. OK for trunk? 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 --- sim/arm/armemu.c | 4 ---- sim/arm/arminit.c | 4 ++++ sim/arm/wrapper.c | 10 +++++----- 3 files changed, 9 insertions(+), 9 deletions(-) -- 2.17.1 diff --git a/sim/arm/armemu.c b/sim/arm/armemu.c index 76f398b3d7..3a72277683 100644 --- a/sim/arm/armemu.c +++ b/sim/arm/armemu.c @@ -1140,10 +1140,6 @@ handle_VFP_move (ARMul_State * state, ARMword instr) /* 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 851d3567e1..3a626c8467 100644 --- a/sim/arm/arminit.c +++ b/sim/arm/arminit.c @@ -40,6 +40,10 @@ unsigned ARMul_MultTable[32] = 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 fde5d8c326..9f86e089a1 100644 --- a/sim/arm/wrapper.c +++ b/sim/arm/wrapper.c @@ -129,9 +129,9 @@ union maverick_acc_regs 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 @@ sim_create_inferior (SIM_DESC sd ATTRIBUTE_UNUSED, { int argvlen = 0; int mach; - char **arg; + char * const *arg; init (); @@ -867,7 +867,7 @@ sim_open (SIM_OPEN_KIND kind, sim_callback = cb; - sim_target_parse_arg_array (argv); + sim_target_parse_arg_array ((char **) argv); if (argv[1] != NULL) {