www.delorie.com/archives/browse.cgi | search |
DMARC-Filter: | OpenDMARC Filter v1.4.2 delorie.com 56S9PUQW4187055 |
Authentication-Results: | delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com |
Authentication-Results: | delorie.com; spf=pass smtp.mailfrom=cygwin.com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 delorie.com 56S9PUQW4187055 |
Authentication-Results: | delorie.com; |
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=iXQDJH7t | |
X-Recipient: | archive-cygwin AT delorie DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 4E0753857439 |
DKIM-Signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; |
s=default; t=1753694729; | |
bh=2E/6Xg3/Vw4gL2OaRApqH67N+9SUsJ283/8AjJrNUP0=; | |
h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: | |
List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: | |
From; | |
b=iXQDJH7tLBniXJU92DPZ0ICYV2Py/xqDhnWsxpmUHK1vl5vQXt/qJ3cMM14R3/wzW | |
mst7H0eYyVIjmVr42emkj0RvCZOkG8H2kw2a/WlSRREwFZGhcmnf3+g3667kNLq1eQ | |
JUZvzSfeRId0gSKE5A5QoGN4duc8gbotT8kYC7L0= | |
X-Original-To: | cygwin AT cygwin DOT com |
Delivered-To: | cygwin AT cygwin DOT com |
DKIM-Filter: | OpenDKIM Filter v2.11.0 sourceware.org 77E623857712 |
Date: | Mon, 28 Jul 2025 11:24:19 +0200 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: new c++ new/delete overloads need wrapping? |
Message-ID: | <aIdBw5iSaIonAPbI@calimero.vinschen.de> |
Mail-Followup-To: | cygwin AT cygwin DOT com |
References: | <81535510-8360-1c72-442a-0b630a6d937f AT jdrake DOT com> |
<aINAAW2oh-EfgP0V AT calimero DOT vinschen DOT de> | |
<d2b0c82b-7390-7efe-789f-8d11120ec12a AT jdrake DOT com> | |
MIME-Version: | 1.0 |
In-Reply-To: | <d2b0c82b-7390-7efe-789f-8d11120ec12a@jdrake.com> |
X-BeenThere: | cygwin AT cygwin DOT com |
X-Mailman-Version: | 2.1.30 |
List-Id: | General Cygwin discussions and problem reports <cygwin.cygwin.com> |
List-Unsubscribe: | <https://cygwin.com/mailman/options/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe> | |
List-Archive: | <https://cygwin.com/pipermail/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-request AT cygwin DOT com?subject=help> |
List-Subscribe: | <https://cygwin.com/mailman/listinfo/cygwin>, |
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe> | |
From: | Corinna Vinschen via Cygwin <cygwin AT cygwin DOT com> |
Reply-To: | cygwin AT cygwin DOT com |
Cc: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
Errors-To: | cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com |
Sender: | "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com> |
On Jul 25 11:05, Jeremy Drake via Cygwin wrote: > On Fri, 25 Jul 2025, Corinna Vinschen via Cygwin wrote: > > > On Jul 24 22:41, Jeremy Drake via Cygwin wrote: > > > I was looking into C++ new/delete --wrap linker options, and noticed that > > > in a quick test the wrapper for delete was not being called. This was > > > because delete is being compiled to _ZdlPvm and that symbol is not present > > > in the --wrap arguments in the GCC spec, and is not part of the > > > per_process_cxx_malloc struct. I'm not seeing anything in that cxx_malloc > > > struct like a size or version number, so I don't know a good way to > > > extend it given that it is part of the startup code linked into every > > > binary. > > > > > But first I have to tell you that I'm fuzzy on how this exactly is > > working together. I can't tell you how this affects GCC or LD. > > Here's my understanding so far: > GCC's spec for linking on Cygwin includes several --wrap X, one for each > of these symbols. What this parameter does in LD is that any references > to symbol X are rewritten to __wrap_X, and a definition of X is rewritten > to __real_X. The Cygwin DLL exports the __wrap_X symbols, so any callers > will end up there. > > In order to detect attempts to override the symbols, the Cygwin startup > code defines weak symbols for them with asm redirecting to the __real_X > names, and initializes a struct with pointers to them. These will be NULL > if the symbols are not defined. Interestingly, this seems to not count > the jump stubs when the symbols are pulled in from a DLL. (Neither of > these things are true right now with LLD... Bugs, I guess). This struct > is then merged and copied to the Cygwin DLL's struct, which is used to > dispatch calls in the __wrap_X functions. > > As such, I believe that Cygwin would need to be updated first to provide > the __wrap_X functions, and then GCC would need to be updated to add the > --wrap X linker parameters because that would then reference those > symbols. I believe GCC after that change would be incompatible with > Cygwin before the new symbols are exported, if those symbols are > referenced (and I was seeing one of the new delete symbols referenced by a > simple delete p; of a scalar, so it may be something a newer now-default > C++ version does). Unless there's some automatism referencing the __wrap_X functions even if the --wrap option isn't present, I don't see this incompatibility as much of a problem. We're trying to maintain backward compat, but that doesn't mean an executable created under and for a newer Cygwin DLL has to run under an older DLL. Corinna -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |