https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111165
--- Comment #11 from Thorsten Glaser <tg at mirbsd dot org> --- OK, to summarise: When using the original code but providing a wrapper function (in a separate CU) for strchr, it works. When replacing the strchr with strlen (which GCC also does), it fails even without the presence of dietlibc’s strlen. (And yes, disassembly of main.o (where I added it) shows no call to dietlibc from xstrlen.) This doesn’t seem to be coupled to the name of the function (the wrapper functions are called cstrchr and xstrlen, so the compiler cannot make any assumptions about them).