https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119218
--- Comment #15 from Iain Sandoe <iains at gcc dot gnu.org> --- (In reply to Iain Sandoe from comment #14) > Created attachment 60727 [details] > Patch under test > > Please could you let me know if this works for Solaris too. > > (note that this does not fix the cobol problem because of a similar bug in > the GCC configure - see cross-referenced PR) Sorry, this will not work (generally); it will alter the behaviour for Linux: libgen.h: /* Return final component of PATH. This is the weird XPG version of this function. It sometimes will modify its argument. Therefore we normally use the GNU version (in <string.h>) and only if this header is included make the XPG version available under the real name. */ extern char *__xpg_basename (char *__path) __THROW; #define basename __xpg_basename ==== Together with the GCC configuration side (PR119250). It looks like we will need to do something target-specific: 1 maybe for those targets that want POSIX behaviour, they opt in and we arrange this in the configure (but we need to deal with the consumer too). 2 maybe we need to implement `dirname` in libiberty and then poison libgen.h somehow in GCC As a stand-alone library perhaps 1 makes most sense.