From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 7554F3858C2C for ; Fri, 1 Oct 2021 08:25:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7554F3858C2C Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 8DEBA20429; Fri, 1 Oct 2021 08:25:03 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 601C113BF1; Fri, 1 Oct 2021 08:25:03 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UciRFd/FVmGCSwAAMHmgww (envelope-from ); Fri, 01 Oct 2021 08:25:03 +0000 Subject: Re: [PATCH][gdb/symtab] Relocate call_site_htab To: Simon Marchi , gdb-patches@sourceware.org Cc: Tom Tromey References: <20210930095608.GA11467@delia> <5940137d-6a6f-2309-673f-d9491ed654b5@polymtl.ca> <9a605b9e-267b-e9f5-4122-c407913e92f7@suse.de> <80671fa7-d3cf-d518-a53b-f3ed8e453576@polymtl.ca> From: Tom de Vries Message-ID: <2d6504fb-4a2d-4a01-b637-7c90cea92a6e@suse.de> Date: Fri, 1 Oct 2021 10:25:02 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <80671fa7-d3cf-d518-a53b-f3ed8e453576@polymtl.ca> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: Fri, 01 Oct 2021 08:25:05 -0000 n 10/1/21 3:15 AM, Simon Marchi wrote: >> Ack, thanks. I've put this through testing and ran into only two >> regressions (so, this used to pass for me with unix/-fPIE/-pie): >> ... >> FAIL: gdb.trace/entry-values.exp: bt (1) (pattern 1) >> FAIL: gdb.trace/entry-values.exp: bt (2) (pattern 1) >> ... >> while still fixing all the unix/-fno-PIE/-no-pie vs unix/-fPIE/-pie >> regressions. >> >> Fixed by: >> ... >> diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c >> index bb5767aae67..fa775722afb 100644 >> --- a/gdb/dwarf2/read.c >> +++ b/gdb/dwarf2/read.c >> @@ -13517,7 +13517,8 @@ read_call_site_scope >> sect_offset_str (die->sect_off), objfile_name >> (objfile)); >> else >> { >> - lowpc = gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + >> baseaddr); >> + lowpc = (gdbarch_adjust_dwarf2_addr (gdbarch, lowpc + >> baseaddr) >> + - baseaddr); >> SET_FIELD_PHYSADDR (call_site->target, lowpc); >> } >> } > > That makes sense. This means that with my patch, the value stored in > the target was relocated, by interpreted as unrelocated? Yes. > Does that mean > that with your patch, that value ended up relocated twice? Once here, > and once in objfile_relocate1? No, though it took me some debugging to realize why :) There are two scenarios: - read_call_site_scope is triggered with baseaddr == 0, so the addresses are unrelocated. Then call_site_relocate is triggered with non-zero baseaddr, and the addresses become relocated. - read_call_site_scope is triggered with non-zero baseaddr, so the addresses are relocated. Then call_site_relocate is not triggered, so the addresses remain correct, and are not relocated twice. Thanks, - Tom