From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.devel Subject: Re: MPS: Forwording symbols Date: Mon, 17 Jun 2024 13:57:24 +0300 Message-ID: <86bk3zsup7.fsf@gnu.org> References: <87jziod6yc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14713"; mail-complaints-to="usenet@ciao.gmane.io" Cc: eller.helmut@gmail.com, emacs-devel@gnu.org To: Gerd =?utf-8?Q?M=C3=B6llmann?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jun 17 12:58:04 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sJA3o-0003XB-BQ for ged-emacs-devel@m.gmane-mx.org; Mon, 17 Jun 2024 12:58:04 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sJA3G-0005xY-K3; Mon, 17 Jun 2024 06:57:30 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJA3E-0005x4-HG for emacs-devel@gnu.org; Mon, 17 Jun 2024 06:57:28 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sJA3E-0005oB-7S; Mon, 17 Jun 2024 06:57:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=1tGFYi+AMAsncTyt237Xo+ij4wg/9yKN0BhmlAa+p98=; b=g934yFWrW5WfWq3oDuEy D8d/I3EJkYnFrKXOERGMObWTqJ+zCvBEwM6XQK2o8eMpfUzF/O3cWazDLVIUWZTMvtNDVg8sNLIMp aCD1YD6XfYu6yyv0BqlpxdyOXa78rqKX4Z3RqpBL8uc/i2ahz5PdUZRW83gbYJtexo5r1SknrPC9u KifvI9G2CnlJWo+enluIWOGljucZgd4uABUA+KX8+RlsglExi3M9XuP8J1n7UijvhvlguhdUilC83 rX7LejANVOJcpYFf4GkzHSrmnLENSjjl9+kZAmP3rTz8lQXALqsGKfuVAqfJxTBQ2dY5kYtNWCRJY 1TLTF1fRJgJsxw==; In-Reply-To: (message from Gerd =?utf-8?Q?M=C3=B6llmann?= on Sun, 16 Jun 2024 21:39:41 +0200) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320203 Archived-At: > From: Gerd Möllmann > Cc: Emacs Devel , Eli Zaretskii > Date: Sun, 16 Jun 2024 21:39:41 +0200 > > Helmut Eller writes: > > > On Sun, Jun 16 2024, Gerd Möllmann wrote: > > > >> If we don't dump_fwd, we would have to make sure though not to overwrite > >> the existing values for symbols in lispsym, which happens in > >> dump_do_dump_relocation > >> > >> case RELOC_DUMP_TO_EMACS_PTR_RAW: > >> { > >> uintptr_t value = dump_read_word_from_dump (dump_base, reloc_offset); > >> eassert (dump_reloc_size (reloc) == sizeof (value)); > >> value += emacs_basis (); > >> dump_write_word_to_dump (dump_base, reloc_offset, value); > >> break; > >> } > >> > >> The name dump_write_word_to_dump is misleading. It does a memcpy to > >> Emacs' data segment. > > > > Hm, why do you think it writes to the data segment? Confusing names > > aside, it seems to read a value, which presumably is a pointer, adjusts > > it to the new basis and then writes it back. > > Becasue of this > > value += emacs_basis (); > > It has dumnped pointer - basis, and now uses that value to get the > pointer in the current process. Isn't this because the dumped data is loaded with a different base address than the one with which is was dumped?