From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: Forwording symbols Date: Sun, 16 Jun 2024 21:39:41 +0200 Message-ID: References: <87jziod6yc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="14030"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Emacs Devel , Eli Zaretskii To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 16 21:40:46 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 1sIvk6-0003Rp-57 for ged-emacs-devel@m.gmane-mx.org; Sun, 16 Jun 2024 21:40:46 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sIvjC-0003yc-2t; Sun, 16 Jun 2024 15:39:50 -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 1sIvjA-0003yL-6v for emacs-devel@gnu.org; Sun, 16 Jun 2024 15:39:48 -0400 Original-Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sIvj8-00065E-Kq; Sun, 16 Jun 2024 15:39:47 -0400 Original-Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2ec1ac1aed2so23513811fa.3; Sun, 16 Jun 2024 12:39:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718566784; x=1719171584; darn=gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Ha+VYwWmQUpYkqA+IzXpXEcGBdnKK38pfT1Z8EobpDw=; b=RwR+oconR3RheG/tLSjyD2TjRTir5sZafxJ8e+laM8g9EUUNk9YUiTlgD9ZQsGFuIg q48ZPg7ICQsOjBrSHZ4+DAI68J7JT8LPGuGTbzC4JgrcSqg6tFMZgFonBKUkNPjUHX96 733qlMuESM9NMQH/dgmzTeDRY7Be0+ZHJalbRL512qXuaTRMo4469IE6cYhPpELtlEjC ozkC2Ytkfa/6D8bdA8zcIMQmNvA5VVwgBxQHIBkw1mUmvtnrxuD02xNkb/7PIpI30/EF 36V5PYvdrkPREA/yDS3vVFB1tvS0aSAQ2jcJkNcDZfmhdVuEOL7octAZCUSEOxvyddF7 Ypog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718566784; x=1719171584; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=Ha+VYwWmQUpYkqA+IzXpXEcGBdnKK38pfT1Z8EobpDw=; b=TTI//T0u8aa+1yR+Bx09lLTuYusbwP5NCYwN/lKtvXLK4fZSUVCOSA6/GZvo4Q91Lv 9hOwitUX1q3wgPo2SbW0WoRvPPmiZ18GlkC8DHHu1K70pPa4Mdt9EUFVHly5EJ/Qnaty zkho9rMDiEYtG9DAiHmXof4W9pdweHMPbR7qWHdYRRTsbT/BxZ0dfmhVgWQUZSGyaH+C YwKj2ZcDutCsmMe/Y8XPCf9WGBhg7vNKq520shOgXBe9CR51s0wwTXckZuniDd5mXJi6 QLnW+QSMQKMIB+/V53tVwkSLGM25K15R3/gmv08K8L/uAbufBgKSOiF/b78OiGHOBk1O weSQ== X-Forwarded-Encrypted: i=1; AJvYcCXeOg1mnfmn8kuoWT7jamVBxHG4QZ55VGwbDatFKZsw+Q47BOhI9pPTLWcpl/YsAv/MJYD4zOSdg4PQY5M= X-Gm-Message-State: AOJu0YzlvzsG43W+j+dXLz1eSFLN7Y5ZGuFAo3ezuuosYZ9EIv/cPqiU 7z+xUOhouxMsrwv9O13D6nOaV4ZAg3AwVOgIM7RDp59YxjUap8Y0h5BN/g== X-Google-Smtp-Source: AGHT+IHpRoccPn7DtvDzg4S48wGU/ZlGJucPfEPfISjgHBAxPZtyju2WwE9K7K5Q/O/vnhLeP5pUKQ== X-Received: by 2002:a2e:a373:0:b0:2ec:12dd:d22f with SMTP id 38308e7fff4ca-2ec12ddd2e2mr41946951fa.34.1718566782352; Sun, 16 Jun 2024 12:39:42 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36751.dip0.t-ipconnect.de. [217.227.103.81]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57cb741e758sm5363269a12.68.2024.06.16.12.39.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 16 Jun 2024 12:39:42 -0700 (PDT) In-Reply-To: <87jziod6yc.fsf@gmail.com> (Helmut Eller's message of "Sun, 16 Jun 2024 21:27:07 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::22b; envelope-from=gerd.moellmann@gmail.com; helo=mail-lj1-x22b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action 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:320196 Archived-At: Helmut Eller writes: > On Sun, Jun 16 2024, Gerd M=C3=B6llmann 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 =3D dump_read_word_from_dump (dump_base, reloc_o= ffset); >> eassert (dump_reloc_size (reloc) =3D=3D sizeof (value)); >> value +=3D 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 +=3D emacs_basis (); It has dumnped pointer - basis, and now uses that value to get the pointer in the current process. >> Maybe one could introduce a new RELOC_xyz type to signify that a >> forwarding symbol is patched and save the fwd value around the memcpy if >> needed. >> >> Or something like that? > > Yes, looks like a better reloc kind is needed. > > Below is what I currently have. Tracing those IGC_OBJ_DUMPED_FWD > objects seems problematic, especially while the binding of the symbol is > temporarily swapped out. Thanks! I'll take a look tomorrow, it's a bit late for me.