From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 72AFC3939C0C for ; Thu, 18 Jun 2020 08:44:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 72AFC3939C0C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id C1344AAC6; Thu, 18 Jun 2020 08:44:46 +0000 (UTC) Subject: [PATCH][gdbserver] Add missing include of gdbsupport/agent.h From: Tom de Vries To: Christian Biesinger Cc: gdb-patches References: <20200612163715.GA21612@delia> <1bc315c0-55e6-08bf-8aa3-e0e30bba2c81@suse.de> Autocrypt: addr=tdevries@suse.de; keydata= xsBNBF0ltCcBCADDhsUnMMdEXiHFfqJdXeRvgqSEUxLCy/pHek88ALuFnPTICTwkf4g7uSR7 HvOFUoUyu8oP5mNb4VZHy3Xy8KRZGaQuaOHNhZAT1xaVo6kxjswUi3vYgGJhFMiLuIHdApoc u5f7UbV+egYVxmkvVLSqsVD4pUgHeSoAcIlm3blZ1sDKviJCwaHxDQkVmSsGXImaAU+ViJ5l CwkvyiiIifWD2SoOuFexZyZ7RUddLosgsO0npVUYbl6dEMq2a5ijGF6/rBs1m3nAoIgpXk6P TCKlSWVW6OCneTaKM5C387972qREtiArTakRQIpvDJuiR2soGfdeJ6igGA1FZjU+IsM5ABEB AAHNH1RvbSBkZSBWcmllcyA8dGRldnJpZXNAc3VzZS5kZT7CwKsEEwEIAD4WIQSsnSe5hKbL MK1mGmjuhV2rbOJEoAUCXSW0JwIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAh CRDuhV2rbOJEoBYhBKydJ7mEpsswrWYaaO6FXats4kSgc48H/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7jyBsP5QxeTqwxC/1ZtNS DUCSFQjqA6bEGwM22dP8OUY6SC94x1G81A9/xbtm9LQxKm0EiDH8KBMLfQ== Message-ID: <131a6f7c-26f1-1012-32e3-2582e3c6d7f8@suse.de> Date: Thu, 18 Jun 2020 10:44:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <1bc315c0-55e6-08bf-8aa3-e0e30bba2c81@suse.de> Content-Type: multipart/mixed; boundary="------------DC5A7B314DC76FD01C32BCB0" Content-Language: en-US X-Spam-Status: No, score=-15.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Jun 2020 08:44:50 -0000 This is a multi-part message in MIME format. --------------DC5A7B314DC76FD01C32BCB0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit [ was: Re: [committed][gdbserver] Fix Wlto-type-mismatch for debug_agent ] On 6/17/20 6:38 PM, Tom de Vries wrote: > On 6/12/20 8:19 PM, Christian Biesinger wrote: >> On Fri, Jun 12, 2020 at 11:37 AM Tom de Vries wrote: >>> >>> Hi, >>> >>> When building gdb including gdbserver with CFLAGS/CXXFLAGS -O2 -g -flto=auto, >>> I run into: >>> ... >>> src/gdbserver/../gdbsupport/agent.h:47:13: error: type of 'debug_agent' \ >>> does not match original declaration [-Werror=lto-type-mismatch] >>> extern bool debug_agent; >>> ^ >>> src/gdbserver/ax.cc:28:5: note: type 'int' should match type 'bool' >>> int debug_agent = 0; >>> ^ >>> src/gdbserver/ax.cc:28:5: note: 'debug_agent' was previously declared here >>> src/gdbserver/ax.cc:28:5: note: code may be misoptimized unless \ >>> -fno-strict-aliasing is used >> >> So it sounds like this didn't come up before because ax.cc doesn't >> include gdbsupport/agent.h? > > Yes. > >> It probably should? > > Um, good point, thanks. > > Though ax.h does: > ... > #ifdef IN_PROCESS_AGENT > #define debug_threads debug_agent > #endif > ... > so I wonder if we should have the include there instead. I'll try to > test this. Any comments? Thanks, - Tom --------------DC5A7B314DC76FD01C32BCB0 Content-Type: text/x-patch; charset=UTF-8; name="0001-gdbserver-Add-missing-include-of-gdbsupport-agent.h.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-gdbserver-Add-missing-include-of-gdbsupport-agent.h.pat"; filename*1="ch" [gdbserver] Add missing include of gdbsupport/agent.h The file gdbserver/ax.h contains: ... #ifdef IN_PROCESS_AGENT #define debug_threads debug_agent #endif ... but does not declare debug_agent. Fix this by adding an include of gdbsupport/agent.h. [ If this fix would have been in place before commit 8118159c69 "[gdbserver] Fix Wlto-type-mismatch for debug_agent", we would have simply run into this build breaker with a regular, non-lto build: ... src/gdbserver/ax.cc:28:5: error: conflicting declaration 'int debug_agent' int debug_agent = 0; ^~~~~~~~~~~ In file included from src/gdbserver/ax.h:25:0, from src/gdbserver/ax.cc:20: src/gdbsupport/agent.h:47:13: note: previous declaration as 'bool debug_agent' extern bool debug_agent; ^~~~~~~~~~~ ... ] Tested on x86_64-linux. gdbserver/ChangeLog: 2020-06-18 Tom de Vries * ax.h: Include gdbsupport/debug_agent.h. --- gdbserver/ax.h | 1 + 1 file changed, 1 insertion(+) diff --git a/gdbserver/ax.h b/gdbserver/ax.h index 1fba69e7ad..b7ff7d8910 100644 --- a/gdbserver/ax.h +++ b/gdbserver/ax.h @@ -22,6 +22,7 @@ #include "regcache.h" #ifdef IN_PROCESS_AGENT +#include "gdbsupport/agent.h" #define debug_threads debug_agent #endif --------------DC5A7B314DC76FD01C32BCB0--