With lld 14 and no additional LDFLAGS the referenced foo()-function was optimized out, as an executable was compiled with no reference to the function, also removing the undefined references to the tested libc functions.
This caused the sysdep mechanism to misdetect hasutmploginlogout.h-yes.c and sysdep/hasutmplogwtmp.h-yes.c on musl libc as true, while it should be false, which broke the build later on on the real references in tinyssh code.
This can also be reproduced with gcc with CFLAGS=-ffunction-sections and LDFLAGS=-Wl,--gc-sections.
Instead reference them, but do not evaluate them at runtime by making the prequisite argc == 0. This should be safe from being optimized out even with LTO.
With lld 14 and no additional LDFLAGS the referenced foo()-function was optimized out, as an executable was compiled with no reference to the function, also removing the undefined references to the tested libc functions.
This caused the sysdep mechanism to misdetect hasutmploginlogout.h-yes.c and sysdep/hasutmplogwtmp.h-yes.c on musl libc as true, while it should be false, which broke the build later on on the real references in tinyssh code.
This can also be reproduced with gcc with CFLAGS=-ffunction-sections and LDFLAGS=-Wl,--gc-sections.
Instead reference them, but do not evaluate them at runtime by making the prequisite argc == 0. This should be safe from being optimized out even with LTO.