From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7NzdH/XFVmHydAAAWB0awg (envelope-from ) for ; Fri, 01 Oct 2021 04:25:25 -0400 Received: by simark.ca (Postfix, from userid 112) id 6FFE51EDF0; Fri, 1 Oct 2021 04:25:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_DYNAMIC, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D06681EDDB for ; Fri, 1 Oct 2021 04:25:23 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1076E3857C51 for ; Fri, 1 Oct 2021 08:25:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1076E3857C51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1633076723; bh=1PePm7syp5cQR3RabuFELtWpkmDgQaoO6++Pc03USIM=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=RCZ3f2FZ595hPBTy6ULRFpmoSzwf6d7SBgpGXgx+HGll5qb0DdvZ/Vu/7fWcPgoi1 xzTN8bgRZVVBdr1X29VSTqT5Fa8/JswB2JDzU9PM6zS3sHKNvWkpYPPIywCcFLspHo O08jemxAp+sS7mEgtUe/eof0hGyRZf24mHT5Mttg= 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 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> 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-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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Cc: Tom Tromey Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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