On 21/10/2025 20:16, Thirumalai Nagalingam wrote:
Hi,

Please find below small patch that replaces __progname with getprogname() in 
winsup/cygwin/dcrt0.cc.

Thanks.

   *   On AArch64 local builds of Cygwin, __progname is not defined in the 
startup objects which causes a build failure.

Hmm... I think I probably need to see the rest of the associated changes to properly evaluate this.

Can you share a link?

   *   This symbol is legacy to be replaced with getprogname() API, which is implemented 
in "winsup/cygwin/libc/bsdlib.cc" and exported across all supported targets.

It seems like it's a shortcoming of doc/posix.xml (the source for [1]) that it doesn't list data exports, only API functions.

But I think that probably needs a definitive list of obsolete elements removed on arm64.

[1] https://cygwin.com/cygwin-api/

   *   Using getprogname() aligns Cygwin's startup code with the current libc 
conventions, avoids reliance on globals, and ensures consistent builds on 
aarch64 platforms.


Thanks & regards
Thirumalai N

============
In-lined patch:

diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index 69c233c24..0758ec735 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -964,7 +964,7 @@ dll_crt0_1 (void *)
    /* Disable case-insensitive globbing */
    ignore_case_with_glob = false;

-  cygbench (__progname);
+  cygbench (getprogname());

Is it possible to write program_invocation_short_name here?

(I can't really work out what's going on internally and externally with __progname and program_invocation_short_name. It looks like since bded8091c438d18e1d259864d773891a747c7576 we're meant to be exclusively using the latter internally, so this could just be a mistake)

(I actually wonder if getprogname() actually returns the right value now, and if so, how...)

Reply via email to