https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96973
--- Comment #10 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> --- Hi Ian, There is still the issue in comment #1: none of the mechanisms for finding the executable path are currently working on darwin (at least in the circumstances I am testing in). - state->filename is NULL - getexecname() is not available on darwin - the /proc filesystem is not either - the BSD-specific function sysctl_exec_name() is not present either I would like to propose adding a mechanism using darwin's native function, which is _NSGetExecutablePath (defined in the <mach-o/dyld.h> header). Two questions, which are for you to decide, are: 1. should it be implemented as an addition case in the switch statement? or as a fallback for getexecname(), as I have done? 2. should it be guarded by an __APPLE__ preprocessor check, or detected in configure? My personal preference would be: 1. I don't really care 2. I don't see the value of a configure check, given it is directly and unambiguously linked to the target (and therefore to the __APPLE__ preprocessor macro being present) Please let me know what you prefer, and I will prepare and test a proper patch.