From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 0FA893858D35 for ; Wed, 18 Jan 2023 21:43:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0FA893858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 9D9621E112; Wed, 18 Jan 2023 16:43:24 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1674078204; bh=/5ejhcm3eAF52ee0E/msrHfSI1rl9pyZetJkeaFbuXU=; h=Date:Subject:To:References:From:In-Reply-To:From; b=UgY37uiOiOL2GW5q9arH4ncQFzUbqeybPnoKW9FWCasO5jLCTreOAFWEZiV7OsrLr dSMIsrW6oX7yjOlWUsYcSu0H9xgscrkFNgKCXCKq/0w9mrEPmIaJY+mO6RsjkBo57X oSEoq+bJOvl5xvcqGKUi0kceCbvcdouDDxSLTmkk= Message-ID: <66028b75-1c70-9845-0923-9892b982211c@simark.ca> Date: Wed, 18 Jan 2023 16:43:24 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH 2/6] Set section indices when symbols are made Content-Language: en-US To: Tom Tromey , gdb-patches@sourceware.org References: <20230118153025.342512-1-tromey@adacore.com> <20230118153025.342512-3-tromey@adacore.com> From: Simon Marchi In-Reply-To: <20230118153025.342512-3-tromey@adacore.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 1/18/23 10:30, Tom Tromey via Gdb-patches wrote: > Most places in gdb that create a new symbol will apply a section > offset to the address. It seems to me that the choice of offset here > is also an implicit choice of the section. This is particularly true > if you examine fixup_section, which notes that it must be called > before such offsets are applied -- meaning that if any such call has > an effect, it's purely by accident. > > This patch cleans up this area by tracking the section index and > applying it to a symbol when the address is set. This is done for > nearly every case -- the remaining cases will be handled in later > patches. So, if I rephrase it to make sure I understand: it's not logical to apply the relocation to the symbol's address, without also setting the symbol's section index, because the symbol's relocation value comes from the section. Does that sound right? Simon