Nico Huber has posted comments on this change. ( https://review.coreboot.org/18738 )
Change subject: Fix linking with libpayload ......................................................................
Patch Set 6:
(1 comment)
https://review.coreboot.org/#/c/18738/6/helpers.c File helpers.c:
https://review.coreboot.org/#/c/18738/6/helpers.c@95 PS6, Line 95: #if defined(__DJGPP__)
Hmm, I wonder if it's still useful to have a check for glibc compatibility
These feature_test_macros(7) work the other way around: You define them before including any header file and the header file declares the guarded functions (see dmi.c for an example). So in case of glibc, we can just assume that we have strnlen().
I've done some more testing and investigation: The HAVE_STRNLEN check was introduced for older BSDs in 23e10b8. But I guess it was copied from examples that assume GNU autotools are used. It's working because the linker seems to ignore the conflicting imple- mentation.
I'll extend the `!defined(HAVE_STRNLEN)` with a libpayload guard. Just removing it would break these older BSDs again.