Hi folks,
Please backport commit f634ca650f72 "kbuild: Add $(KBUILD_HOSTLDFLAGS) to 'has_libelf' test" to stable series 5.10.y, 5.4.y & 4.19.y.
This backport is needed to fix builds with CONFIG_UNWINDER_ORC=y where HOSTLDFLAGS is given on the make command line containing library paths needed to link against libelf. The issue was found when trying to build stable kernel branches for x86-64 using Yocto Project after commit 7fd06a57a1d9 "kernel: Rework kernel make flag to variable mappings" was added to openembedded-core back in October.
The backport to 5.10.y is trivial. The backports to 5.4.y & 4.19.y need a minor tweak so I'll send patches for those following this email.
The build failure is also seen in 4.14.y but I can't see a trivial way to address this as KBUILD_HOSTLDFLAGS does not exist in 4.14.y and backporting the commit which introduces KBUILD_HOSTLDFLAGS would change several other kbuild areas. I'm happy to workaround this locally by disabling CONFIG_UNWINDER_ORC for 4.14.y builds but it may be worth considering alternative fixes for this branch.
Let me know if there are any questions.