Gerd Möllmann <gerd.moellmann@HIDDEN>
to control <at> debbugs.gnu.org.
Full text available.
Received: (at 79684) by debbugs.gnu.org; 11 Nov 2025 06:10:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Nov 11 01:10:03 2025
Received: from localhost ([127.0.0.1]:42760 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vIhZq-0006CK-DG
for submit <at> debbugs.gnu.org; Tue, 11 Nov 2025 01:10:03 -0500
Received: from mail-ed1-x533.google.com ([2a00:1450:4864:20::533]:48573)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
id 1vIhZn-0006Bm-W4
for 79684 <at> debbugs.gnu.org; Tue, 11 Nov 2025 01:10:00 -0500
Received: by mail-ed1-x533.google.com with SMTP id
4fb4d7f45d1cf-640c6577120so6994225a12.1
for <79684 <at> debbugs.gnu.org>; Mon, 10 Nov 2025 22:09:59 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1762841393; x=1763446193; darn=debbugs.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=uQ6U+PoFtWBheUopLpVy0xgA5U2yNbLATv9Q8Y2mqDE=;
b=CeodYagyzluvXSiWN4AblHpNq7AxKdaBUii2pVfYV0mK5+xMCg9d32fQfkdi9oiR/D
nh3wdw2vMeN+JFrcuG1ByW+Prk78SexdYShi/NukLx5H0U/b1Y1n/OwUH1OiFE+IVLcH
DU2pOpzEWcW7iAamPZoaQyeRgWkLTAdWvCm+d6Xm/Sc2kJALHzwu6AHMA0WjBU5qnLEv
W7TB6SWbgNGZsjwvlvUioFDDoPMAn9v2GN6XQobVsTg9zanGhAbp9xYGbrVCWfLbFzyY
/PP78I5EVdgDQ5KD+BQwpwKRaHn6t6jzuN8PY42Cvz1AfvG9gxffQQ/NCXZ0nPWfIBSc
svHA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1762841393; x=1763446193;
h=content-transfer-encoding:mime-version:user-agent:message-id:date
:references:in-reply-to:subject:cc:to:from:x-gm-gg
:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to;
bh=uQ6U+PoFtWBheUopLpVy0xgA5U2yNbLATv9Q8Y2mqDE=;
b=XvC/PyKD59gjvjZO5P7ISLPuqvCnp4PVnPRZODEzcCE9Mx9QGyifrpkpqS9kLvaQjU
l4CRXWFc5NhJTXa2ctnNs71w3sph2UE7iuBUCJyMlT3XJD2GAa95MBgrxqw1Hb4QYs+e
sdJkaOxEnlpVP8dFi7Zf70wXCakOlT0g2NDHMOzJU6ACw/CDaskShTLKMCL/7W4U8E/B
t/rHfH+z3EjTK4LyEV+FbwKzte8KArnV4v+fxq34pL8AW6qQ8OUE7tzSdWV4r8efZyKE
1f254bo+E5jcC8a1sdBrimIp6+/TPPuz8GP5FZzN3zvIYPv3TaeBxWZ/6LmmoagZQgCa
VHtw==
X-Gm-Message-State: AOJu0Yz4if1ruj8wKf5WS8Ta2n2ao9ArIqOqdYuQli2HOsFRNUVDPLB2
Co5k6YJ/xhesREc72Dtyp4Ejotq8VoHyY5iCQsGvGsB0a1NgaxoDQ/ntAE8ODqwD
X-Gm-Gg: ASbGncuNwKYt1Np5AspZNy//PAmN15gap6kkVfC6h8UHEKza6cs2uvgl5ZUUMfZAsLX
16dK6ZWgvk5zOyWmdnAEm++7WFUpZUVgu/75moRSH0f94ZzrvT7aeKm56rC3WTpAi9KmBe3G2TW
B59UbTMc+sE7zrlXe/GGT+OLXLFlHJYMp9SCVGezrt8t4TvUuDMcEOQdzEDl9NjJvRzhE0xVYGB
/Hy0BrPIvjC6GLUMn0iQ3uAtQDj6tViVdRiI3fy/yZF/Oh84iAuL3V32kMmChGD9Wf9PsPTzQdW
nK9c0OPXKpeVm81woPz5+q17dqiy1yUcRSMcItYx9jxHkJRWfiVh/w5Fz5Vuxev3tR3IyfaU5Db
TR6kq6nIPSFRhhGPEN/aVZCQSRFwnwdEgMefTugNVFg3u/GXpFDguVGDZmTJSfqKUFTBUG67LtK
BurMpyLUoW1vVB8ZUh/23LnSoTj+hKWrYWop0X+zu9vBd49yo2+HEh942q+v9lrwlNeUJbs0OzM
FWHy0+53T2Q+i80swBi/GY=
X-Google-Smtp-Source: AGHT+IFsvlDkAQ+a0WYTtN4cukDcJ+r7Peedw5GwzIHYrnj85n+ZSGI0bph6zzEqNv0AL9CNy9i6sQ==
X-Received: by 2002:a05:6402:3585:b0:640:eb29:fc93 with SMTP id
4fb4d7f45d1cf-6415db5ca12mr8445021a12.0.1762841393203;
Mon, 10 Nov 2025 22:09:53 -0800 (PST)
Received: from pro4 (p200300e0b72b5600f983bb9036eda1ce.dip0.t-ipconnect.de.
[2003:e0:b72b:5600:f983:bb90:36ed:a1ce])
by smtp.gmail.com with ESMTPSA id
4fb4d7f45d1cf-64166d06531sm7283416a12.27.2025.11.10.22.09.51
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 10 Nov 2025 22:09:51 -0800 (PST)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Andrea Corallo <acorallo@HIDDEN>
Subject: Re: bug#79684: [PATCH] Check native comp ABI version
In-Reply-To: <m2h5vp4ryu.fsf@HIDDEN>
References: <m2o6px4wdo.fsf@HIDDEN> <yp18qh1zpv7.fsf@HIDDEN>
<m2h5vp4ryu.fsf@HIDDEN>
Date: Tue, 11 Nov 2025 07:09:47 +0100
Message-ID: <m2o6p9f6c4.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 79684
Cc: 79684 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
> Andrea Corallo <acorallo@HIDDEN> writes:
>
>> Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
>>
>>> Tags: patch
>>>
>>> Native-comp currenty does not explicitly check that the ABI version when
>>> an .eln was produced is the same as the ABI version when an .eln is
>>> loaded. It relies on putting a substring of an MD5 sum in the file name
>>> instead (see hash_native_abi).
>>>
>>> This proved insufficient in a case I had here, which is why I added an
>>> explicit check to my Emacs.
>>>
>>> Andrea is in CC.
>>
>> Hi Gerd,
>>
>> could you describe exactly which scenario proved the current setup to be
>> insufficient? AFAIR we use the the ABI version to form the filename to
>> look for no?
>
> Not 100% exactly I'm afraid, but let me try. It went something like
> this:
>
> I have a "very" old todo item that I'm working on and off when I feel
> like it. This is about the roots igc is using to scan the Lisp_Objects
> in, mainly, the d_relocs vectors in the data segments of .eln files.
> They have to be scanned because MPS is a copying collector and objects
> can move in memory. These roots are in sum pretty large, in my case,
> with my init file and so on, they amount to ca. 1.5 MB, which increases
> GC latency because all roots must be scanned before anything can be
> copied during GC and so on.
>
> These d_reloc vectors are filled when an .eln is loaded by using the
> Lisp reader to produce a vector from a string the text segment. The
> contents of this vector are then copied to the d_reloca arrays in the
> data segment.
>
> The idea I'm trying out, with very slow progress, is to change this to
> use an additional indirection in the native code. I'm not copying the
> vector's contents to the data segment d_reloc, but store a pointer to
> the "contents" member of the vector. That is, where the code currently
> does something akin to
>
> static Lisp_Object d_reloc[42];
> ...
> Lisp_Object x =3D d_reloc[17];
>
> it then does the moral equivalent of=20
>
> static Lisp_Object **d_reloc;
> ...
> Lisp_Object x =3D (*d_reloc)[17];
>
> IOW, I'm trying to trade less GC latency for an additional indirection,
> and see which one I like better.
>=20=20=20
> For all that I changed ABI_VERSION. Then I built, and it loaded an .eln
> that had the wrong version, which took me a looong time to make sense
> of. That's basically the background of the whole story (plus that there
> seems to also be something weird in the build system that sometimes
> leads to loading stuff from an installation in ~/.local, but that's a
> different story.)
>
> Anyway, when I checked this
>
> comp.c:
> 802 void
> 803 hash_native_abi (void)
> 804 {
> 805 /* Check runs once. */
> 806 eassert (NILP (Vcomp_abi_hash));
> 807=20
> 808 Vcomp_abi_hash =3D
> 809 comp_hash_string (
> 810 concat3 (build_string (STR (ABI_VERSION)),
> 811 concat3 (Vemacs_version, Vsystem_configuration,
> 812 Vsystem_configuration_options),
> 813 Fmapconcat (intern_c_string ("comp--subr-signature"),
> 814 Vcomp_subr_list, build_string (""))));
> 815=20
>
> I had my doubts that each change in only the ABI_VERSION for example
> lands in the result of that function. MD5 and substring, and so on. The
> patch caught that case, FWIW.
I'm closing this because it's part of another patch to igc that I posted
on emacs-devel.
bug-gnu-emacs@HIDDEN:bug#79684; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 23 Oct 2025 14:23:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 23 10:23:53 2025
Received: from localhost ([127.0.0.1]:33144 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vBwEK-0005rd-LI
for submit <at> debbugs.gnu.org; Thu, 23 Oct 2025 10:23:53 -0400
Received: from lists.gnu.org ([2001:470:142::17]:56506)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
id 1vBwEI-0005rM-DK
for submit <at> debbugs.gnu.org; Thu, 23 Oct 2025 10:23:51 -0400
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 <gerd.moellmann@HIDDEN>)
id 1vBwEA-0007WL-Tw
for bug-gnu-emacs@HIDDEN; Thu, 23 Oct 2025 10:23:42 -0400
Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <gerd.moellmann@HIDDEN>)
id 1vBwE9-0000OK-1A
for bug-gnu-emacs@HIDDEN; Thu, 23 Oct 2025 10:23:42 -0400
Received: by mail-wr1-x436.google.com with SMTP id
ffacd0b85a97d-3ee130237a8so560107f8f.0
for <bug-gnu-emacs@HIDDEN>; Thu, 23 Oct 2025 07:23:40 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1761229419; x=1761834219; 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=P2JNZ39W7ux9L8eihRYHHd8iEpq8BZpInFlbEizwwWY=;
b=AppR6Qr0aPs3Txaqa9P43TjSak2VLjBOVhxIX4HSd/IyD6owUu9KAHCyVRhmK2cfqY
aoD7KgKQC/yo3wZGXTTAwNB6nZnhfXQoEKPYzwI0rjPz5+j4FUyCJvqKd85fnMih9/b5
8+ZxKsW3sTJmm+eCC4XRTkahEsEurE6vP4iUPVAlFMqCGXtoV/Dbx2ijgKQMX02/ZAtN
byTTjxNtJJC1z3+lQ+Mo2ruWmjnTZZ8nASMz9nrZZFjhw/jMuI4zS25PtXRJ3f5BMUEP
kEXivokmKDVcDivfxQVqHXTslkjMNEEo9l+GHSdrJkhcJZpmeHOv6Zud8zNt6QT8DmPd
r0yQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1761229419; x=1761834219;
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=P2JNZ39W7ux9L8eihRYHHd8iEpq8BZpInFlbEizwwWY=;
b=RoTBWP/IxNNjT7BnekMh7PaeWaq2/sLM49T79/6skd0S2WtlBzgtaIB0YSMcU1Qxpe
OtfqjEdtBBrwzWHeig3EZqRpiSR+ITuQC3cU3OUCvL7LKIAU+3IBm3P4ibulJGvdth6W
LFci1QJtmcTM7bFXbLSFuBKpzxWT3T32/OuUIhy1R9GHH2GQ+LhTswJ4/FJ0qyB1Wd/C
wi2KzS+J6LLzGefD0cBR9oOW4dh28Q0jUHip8bu09lqxOGfnHrL5kwo5pwu0SBQmSNDK
twuzqJD4YXE3E9TbxtgQfiRosSLaRNC4i90vmasiunz5LQyW9T5TBNaCICuVrg7/JRjt
WO9A==
X-Gm-Message-State: AOJu0Yw0s6Gwoclxo74jHFo/IOKjuv0Etj8ndl2RU9Wlzj4JpcztfvsT
wA41tvwe7+pOZSseRSa+Areut5b5mXLQ+J1FJmFSLOj9cjIflgZKSc/LS7nAcLAF
X-Gm-Gg: ASbGncu1QZ+fZUJY/ss7gYSo54/thWTJSME29N0tM9KTLmOUI1fGIPpilUYZZXdEcTD
E6SxqHmOoqW0Z880kEefSDrNQT2UpV7iFWuf+IM1BMXhX3UtES2Fy8T4FXvMzZEZ8Yuq6dzNEyJ
oqD7Z2vJFOD41DL9mCnOoQUII3YyftiIjQTetHlZc7ANiqC/m6xwErqFcv0sMgNAeoUPoMvjU7I
caXztRFbstPXPp4WIMUrB2wBxA6tAicJ29aTeRzP/leM3WxZC35NkO6W4TbYAgdpUr4udNHC6K/
BZ2x/rFqyd5EX+5H5YUjM+zP8/vKU0DjLQHanMScaox+XCZ/8WD6cKhIAbYKqO0IBYZpfIP0ZbU
jxRfPdcGrI7/LwAq1lj4/143oRjEBkxiKLH7spxTbjSfbRPLniTfi9BDQ2pbNNzHR0Phz0RBIJG
i6JubRep5IbxN8WbtybkyaIh3zvE+kh8qgrKhjhdr6iQREH6rfCpXKqi5cnHM+sVLgX4tIlkrgk
ICyU5O7MieCsltVLlZk5g==
X-Google-Smtp-Source: AGHT+IGrrsQxl3QPJdXdNLwf6rPRyQRCkLIdVljhl3kWbyFk3RwEYCUTEUBBpeks+8zn4LerAI5d+g==
X-Received: by 2002:a05:6000:288c:b0:426:d5a0:bac8 with SMTP id
ffacd0b85a97d-42704e0eec2mr17125960f8f.56.1761229418491;
Thu, 23 Oct 2025 07:23:38 -0700 (PDT)
Received: from pro4 (p200300e0b709780004f5c5933f6f585a.dip0.t-ipconnect.de.
[2003:e0:b709:7800:4f5:c593:3f6f:585a])
by smtp.gmail.com with ESMTPSA id
ffacd0b85a97d-429898adc81sm4267354f8f.26.2025.10.23.07.23.37
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 23 Oct 2025 07:23:38 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: Andrea Corallo <acorallo@HIDDEN>
Subject: Re: [PATCH] Check native comp ABI version
In-Reply-To: <yp18qh1zpv7.fsf@HIDDEN>
References: <m2o6px4wdo.fsf@HIDDEN> <yp18qh1zpv7.fsf@HIDDEN>
Date: Thu, 23 Oct 2025 16:23:37 +0200
Message-ID: <m2h5vp4ryu.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
Received-SPF: pass client-ip=2a00:1450:4864:20::436;
envelope-from=gerd.moellmann@HIDDEN; helo=mail-wr1-x436.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 autolearn=unavailable autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
Andrea Corallo <acorallo@HIDDEN> writes:
> Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
>
>> Tags: patch
>>
>> Native-comp currenty does not explicitly check that the ABI version when
>> an .eln was produced is the same as the ABI version when an .eln is
>> loaded. It relies on putting a substring of an MD5 sum in the file name
>> instead (see hash_native_abi).
>>
>> This proved insufficient in a case I had here, which is why I added an
>> explicit check to my Emacs.
>>
>> Andrea is in CC.
>
> Hi Gerd,
>
> could you describe exactly which scenario proved the current setup to be
> insufficient? AFAIR we use the the ABI version to form the filename to
> look for no?
Not 100% exactly I'm afraid, but let me try. It went something like
this:
I have a "very" old todo item that I'm working on and off when I feel
like it. This is about the roots igc is using to scan the Lisp_Objects
in, mainly, the d_relocs vectors in the data segments of .eln files.
They have to be scanned because MPS is a copying collector and objects
can move in memory. These roots are in sum pretty large, in my case,
with my init file and so on, they amount to ca. 1.5 MB, which increases
GC latency because all roots must be scanned before anything can be
copied during GC and so on.
These d_reloc vectors are filled when an .eln is loaded by using the
Lisp reader to produce a vector from a string the text segment. The
contents of this vector are then copied to the d_reloca arrays in the
data segment.
The idea I'm trying out, with very slow progress, is to change this to
use an additional indirection in the native code. I'm not copying the
vector's contents to the data segment d_reloc, but store a pointer to
the "contents" member of the vector. That is, where the code currently
does something akin to
static Lisp_Object d_reloc[42];
...
Lisp_Object x =3D d_reloc[17];
it then does the moral equivalent of=20
static Lisp_Object **d_reloc;
...
Lisp_Object x =3D (*d_reloc)[17];
IOW, I'm trying to trade less GC latency for an additional indirection,
and see which one I like better.
=20=20
For all that I changed ABI_VERSION. Then I built, and it loaded an .eln
that had the wrong version, which took me a looong time to make sense
of. That's basically the background of the whole story (plus that there
seems to also be something weird in the build system that sometimes
leads to loading stuff from an installation in ~/.local, but that's a
different story.)
Anyway, when I checked this
comp.c:
802 void
803 hash_native_abi (void)
804 {
805 /* Check runs once. */
806 eassert (NILP (Vcomp_abi_hash));
807=20
808 Vcomp_abi_hash =3D
809 comp_hash_string (
810 concat3 (build_string (STR (ABI_VERSION)),
811 concat3 (Vemacs_version, Vsystem_configuration,
812 Vsystem_configuration_options),
813 Fmapconcat (intern_c_string ("comp--subr-signature"),
814 Vcomp_subr_list, build_string (""))));
815=20
I had my doubts that each change in only the ABI_VERSION for example
lands in the result of that function. MD5 and substring, and so on. The
patch caught that case, FWIW.
bug-gnu-emacs@HIDDEN:bug#79684; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 23 Oct 2025 13:53:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 23 09:53:33 2025
Received: from localhost ([127.0.0.1]:60598 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vBvkz-000489-HW
for submit <at> debbugs.gnu.org; Thu, 23 Oct 2025 09:53:33 -0400
Received: from lists.gnu.org ([2001:470:142::17]:58598)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <acorallo@HIDDEN>) id 1vBvkw-00047i-Fw
for submit <at> debbugs.gnu.org; Thu, 23 Oct 2025 09:53:31 -0400
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 <acorallo@HIDDEN>) id 1vBvki-0000sU-Qz
for bug-gnu-emacs@HIDDEN; Thu, 23 Oct 2025 09:53:17 -0400
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 <acorallo@HIDDEN>)
id 1vBvki-0004q7-Ey; Thu, 23 Oct 2025 09:53:16 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
From; bh=880l1TtsLa9vZljxcx5ntX/txPPPA2vLFGoDRPyctnk=; b=oK7I7E0UIkXftKgYI3SJ
sAOUMsG4inmWfecb89ySCh4EBop+glez2XkFcQWPaBatSW+KJjNWOydaZckEhUiH6prIF0cfa++t5
mnWWzYm+zvhfFai+lzB9QrrOSffW4RJ5MhHzR6Am+4mlDXU+CtCAPAwHv9wLPJlB1prNmSSct/hr1
ik8Kp1iv43RGV+F0XxousMVtOlAgjGpJuJJVZeI55GzpPTtTuSSltA9n0RtkwGd0gRn1o+c6J5LsN
qVkGN7/QTmBtA4Z6eAiXo1oy+PPbEhQpE90ggOZuzZjrkLSgcB0Z3bVK2n6ybVomSAxfQ/EFW73EC
2aIH1EA0yvYjDA==;
Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1)
(envelope-from <acorallo@HIDDEN>)
id 1vBvki-0008JA-5K; Thu, 23 Oct 2025 09:53:16 -0400
From: Andrea Corallo <acorallo@HIDDEN>
To: Gerd =?utf-8?Q?M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
Subject: Re: [PATCH] Check native comp ABI version
In-Reply-To: <m2o6px4wdo.fsf@HIDDEN> ("Gerd =?utf-8?Q?M=C3=B6llmann=22'?=
=?utf-8?Q?s?= message of "Thu, 23 Oct 2025 14:48:19 +0200")
References: <m2o6px4wdo.fsf@HIDDEN>
Date: Thu, 23 Oct 2025 09:53:16 -0400
Message-ID: <yp18qh1zpv7.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: submit
Cc: bug-gnu-emacs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)
Gerd M=C3=B6llmann <gerd.moellmann@HIDDEN> writes:
> Tags: patch
>
> Native-comp currenty does not explicitly check that the ABI version when
> an .eln was produced is the same as the ABI version when an .eln is
> loaded. It relies on putting a substring of an MD5 sum in the file name
> instead (see hash_native_abi).
>
> This proved insufficient in a case I had here, which is why I added an
> explicit check to my Emacs.
>
> Andrea is in CC.
Hi Gerd,
could you describe exactly which scenario proved the current setup to be
insufficient? AFAIR we use the the ABI version to form the filename to
look for no?
Thanks!
Andrea
bug-gnu-emacs@HIDDEN:bug#79684; Package emacs.
Full text available.
Received: (at submit) by debbugs.gnu.org; 23 Oct 2025 12:48:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Oct 23 08:48:45 2025
Received: from localhost ([127.0.0.1]:60371 helo=debbugs.gnu.org)
by debbugs.gnu.org with esmtp (Exim 4.84_2)
(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
id 1vBukH-00005y-B8
for submit <at> debbugs.gnu.org; Thu, 23 Oct 2025 08:48:45 -0400
Received: from lists.gnu.org ([2001:470:142::17]:48792)
by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
(Exim 4.84_2) (envelope-from <gerd.moellmann@HIDDEN>)
id 1vBukD-00005R-S7
for submit <at> debbugs.gnu.org; Thu, 23 Oct 2025 08:48:42 -0400
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 <gerd.moellmann@HIDDEN>)
id 1vBuk5-00028h-Tq
for bug-gnu-emacs@HIDDEN; Thu, 23 Oct 2025 08:48:33 -0400
Received: from mail-wm1-x32e.google.com ([2a00:1450:4864:20::32e])
by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
(Exim 4.90_1) (envelope-from <gerd.moellmann@HIDDEN>)
id 1vBuk2-0002nw-Qo
for bug-gnu-emacs@HIDDEN; Thu, 23 Oct 2025 08:48:33 -0400
Received: by mail-wm1-x32e.google.com with SMTP id
5b1f17b1804b1-471075c0a18so8818285e9.1
for <bug-gnu-emacs@HIDDEN>; Thu, 23 Oct 2025 05:48:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20230601; t=1761223701; x=1761828501; darn=gnu.org;
h=mime-version:message-id:date:subject:cc:to:from:from:to:cc:subject
:date:message-id:reply-to;
bh=4OuXXfriazTt7JaE5Sgp+O86WqlsMf81dodH1ES8qKw=;
b=STu4fmXSu2AkR3aATXrF/kC9ZH96zBGa/SDMhzw/UaEhUDZu7UdF+JeU71JhXrKJ7T
TyOqxGMyAOfrs7Qf8oPDaEYf+v6w1M5kNO/It50NHCq+7sawAYR0C2VZPAQjc1GM/y6K
DKb/cMX7ZzFabbGVz4yRn9bRCzhM/H+9PyqY7WQq0CmbNSRJG4ZQ5Ge/RwYYhQslXrO5
Eat3fnLLaeT1UYOO3C13yp3SUNKa2J7VFz5nz7ewFt0IIgxz9stGbuR2gQWnbEkB3UGS
do2RgSpSNo+6WvDnEEaYED4Zy5H8V7qKb6FC9yp/D7+aaLh/iVLP9lmRMh4M4+4IFk01
UdWA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1761223701; x=1761828501;
h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=4OuXXfriazTt7JaE5Sgp+O86WqlsMf81dodH1ES8qKw=;
b=woLYxf2nUUHy3BeoVt01e1INC8FnUmonJFGeqP8mcqQ3ijAcv49a/6u1re2bZurchm
4vl7x8MpvvweizP/22Am/7SKhO7Q5uCe66akS54xGyHw3nBEUcWH9lVZ+xZ+9vFcqHqG
R5hvHFk7iy9heE1+VqxvK0YVlUN15XCl+o03lfwO04ZqL/iAGQDZxEzQHpnrRhwD5RDN
NJNRXFfyDmH17s2+KOw/WSJnE6uR/2pAwRzY1u04TmIRNW8FVxpuMRoOlOFJ7g6ePxPj
mu0UMRndHjXyiz/Mfn+jKeXuyblpNAc63WR+x2U/YfLPGboYxwdLlSB6lcR4HfJgIkrs
mwGg==
X-Gm-Message-State: AOJu0Yz6yNdCHfFlTP99i8UqDINPNVSL9Kk9AGACh3Bt2yGS6X/sq/hl
rTAVx4le3G5kbED+PEG4L+zAZeAsh3SD42Q8eNIyDnjwZObSXrD8NSP6r2pybvuU
X-Gm-Gg: ASbGncsJMbMFTpDICSP0Qy3Reft8ipjK4nq879Xt0oBddYQh9+I09arsUFmY1pLBVlA
xiwTQ6PSIycsywLT6qr7ui2liyGb3VY0/z8QgCkN4+1jf4SZ4cmWIhadmWur17n9o4SEnWfUD88
0izHJlfH/vu/jBlwroAqB2jn8mdnl8hEXfqr8WyVV705uWsQTMK2/jxhtVlUWGO3UrG2xImqEHX
CFSwIaCD5HU5oGhh/9S/3qNhXrj6kfBqlYut45Hn6tEpwiIMiBUVEQoLodrc8ld8SoCkS0oTc3z
rJxc3XbozZQnMwmU8q/YjoEPzxEU/w8uqL48jEnn4V7wHLUF4cASkedC3HsXFtY1ow90E1Q0nLt
Dg0c5npjGewzBlXVzuZlTkNwrf1wiSpXIyNNlzqF+Xsnu8GxwltJQFjuvVNe0MC2N+s6VRfG6pY
32wfJVJe1WDvPZiJZTs7YnU1lcp1BCUVQAcCTo94xJxtiwvHMlpQfVbAQNQKbo40vkGdCAawKyw
SbBmigDFjejYJheLA3Cbw==
X-Google-Smtp-Source: AGHT+IHjUAs0+qGUrkoBCvVQOjp6zwWo9yMjRjvTlsvioK1MJZbYyvJnEuCuzlSxYdoxUkFSBu1Cug==
X-Received: by 2002:a05:600c:3b03:b0:471:6f4:602a with SMTP id
5b1f17b1804b1-471179068f6mr173085575e9.23.1761223701188;
Thu, 23 Oct 2025 05:48:21 -0700 (PDT)
Received: from pro4 (p200300e0b709780004f5c5933f6f585a.dip0.t-ipconnect.de.
[2003:e0:b709:7800:4f5:c593:3f6f:585a])
by smtp.gmail.com with ESMTPSA id
5b1f17b1804b1-475c4342860sm94879785e9.11.2025.10.23.05.48.20
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Thu, 23 Oct 2025 05:48:20 -0700 (PDT)
From: =?utf-8?Q?Gerd_M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Subject: [PATCH] Check native comp ABI version
X-Debbugs-Cc:
Date: Thu, 23 Oct 2025 14:48:19 +0200
Message-ID: <m2o6px4wdo.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="=-=-="
Received-SPF: pass client-ip=2a00:1450:4864:20::32e;
envelope-from=gerd.moellmann@HIDDEN; helo=mail-wm1-x32e.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 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: submit
Cc: Andrea Corallo <acorallo@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.0 (/)
--=-=-=
Content-Type: text/plain
Tags: patch
Native-comp currenty does not explicitly check that the ABI version when
an .eln was produced is the same as the ABI version when an .eln is
loaded. It relies on putting a substring of an MD5 sum in the file name
instead (see hash_native_abi).
This proved insufficient in a case I had here, which is why I added an
explicit check to my Emacs.
Andrea is in CC.
--=-=-=
Content-Type: text/x-patch
Content-Disposition: attachment;
filename=0001-Check-native-comp-ABI-version.patch
From d1bb66339a63769c9596eb1f902d30105ba8ac0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= <gerd.moellmann@HIDDEN>
Date: Thu, 23 Oct 2025 14:21:32 +0200
Subject: [PATCH] Check native comp ABI version
* src/comp.c (ABI_VERSION): Make an integer.
(ABI_VERSION_SYMBOL): New.
(hash_native_abi): Convert ABI_VERSION to string.
(emit_abi_version, check_abi_version): New functions.
(Fcomp__compile_ctxt_to_file0): Emit ABI_VERSION_SYMBOL.
(load_comp_unit): Check ABI version.
---
src/comp.c | 34 ++++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/src/comp.c b/src/comp.c
index 8ab167ab592..a487fa7dbe5 100644
--- a/src/comp.c
+++ b/src/comp.c
@@ -468,11 +468,16 @@ load_gccjit_if_necessary (bool mandatory)
/* Increase this number to force a new Vcomp_abi_hash to be generated. */
-#define ABI_VERSION "12"
+#define ABI_VERSION 13
/* Length of the hashes used for eln file naming. */
#define HASH_LENGTH 8
+/* The name of a global emitted to the text segment that contains the
+ ABI version that was used to generate the file. This is checked
+ against the current ABI version when a file is loaded. */
+#define ABI_VERSION_SYM STR (ABI_ ## ABI_VERSION)
+
/* C symbols emitted for the load relocation mechanism. */
#define CURRENT_THREAD_RELOC_SYM "current_thread_reloc"
#define F_SYMBOLS_WITH_POS_ENABLED_RELOC_SYM "f_symbols_with_pos_enabled_reloc"
@@ -784,7 +789,7 @@ hash_native_abi (void)
Vcomp_abi_hash =
comp_hash_string (
- concat3 (build_string (ABI_VERSION),
+ concat3 (build_string (STR (ABI_VERSION)),
concat3 (Vemacs_version, Vsystem_configuration,
Vsystem_configuration_options),
Fmapconcat (intern_c_string ("comp--subr-signature"),
@@ -2959,6 +2964,28 @@ #define ADD_IMPORTED(f_name, ret_type, nargs, args) \
return Freverse (field_list);
}
+/* Emit an exported global whose symbol name contains the ABI
+ version used when generating it. */
+
+static void
+emit_abi_version (void)
+{
+ gcc_jit_context_new_global (comp.ctxt, NULL, GCC_JIT_GLOBAL_EXPORTED,
+ comp.void_ptr_type, ABI_VERSION_SYM);
+}
+
+/* Check ABI version of CU against the current version. Do this because
+ relying on a substring of an MD5 checksum as part of an eln's file
+ name is prone to fail. */
+
+static void
+check_abi_version (struct Lisp_Native_Comp_Unit *cu)
+{
+ if (dynlib_sym (cu->handle, ABI_VERSION_SYM) == NULL)
+ error ("File '%s' has incompatible ABI version",
+ SDATA (cu->file));
+}
+
/*
This emit the code needed by every compilation unit to be loaded.
*/
@@ -4840,6 +4867,7 @@ DEFUN ("comp--compile-ctxt-to-file0", Fcomp__compile_ctxt_to_file0,
CALLNI (comp-data-container-idx, CALLNI (comp-ctxt-d-ephemeral, Vcomp_ctxt));
emit_ctxt_code ();
+ emit_abi_version ();
/* Define inline functions. */
define_CAR_CDR ();
@@ -5255,6 +5283,8 @@ load_comp_unit (struct Lisp_Native_Comp_Unit *comp_u, bool loading_dump,
if (!comp_u->loaded_once)
{
+ check_abi_version (comp_u);
+
struct thread_state ***current_thread_reloc =
dynlib_sym (handle, CURRENT_THREAD_RELOC_SYM);
bool **f_symbols_with_pos_enabled_reloc =
--
2.51.1
--=-=-=--
Gerd Möllmann <gerd.moellmann@HIDDEN>:bug-gnu-emacs@HIDDEN.
Full text available.bug-gnu-emacs@HIDDEN:bug#79684; Package emacs.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.