Skip to contentSkip to conversation

kbuild: honor HOSTCFLAGS and HOSTLDFLAGS in libelf test

PATCH New Matthias Reichl 1 participant 1 message Jul 1, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kbuild: honor HOSTCFLAGS and HOSTLDFLAGS in libelf test

Since commit 596a9f6768af ("objtool: Support HOSTCFLAGS and HOSTLDFLAGS") objtool can use a libelf installed in a non-standard location by passing in appropriate HOST flags.

The libelf check in the main Makefile is done without these flags and fails if no libelf is installed on the system.

Fix this by adding HOSTCFLAGS and HOSTLDFLAGS to the libelf check.

---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
index c9132594860b..b0485fddc554 100644
@@ -933,7 +933,7 @@ export mod_sign_cmd
 
 ifdef CONFIG_STACK_VALIDATION
   has_libelf := $(call try-run,\
-		echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lelf -,1,0)
+		echo "int main() {}" | $(HOSTCC) $(HOSTCFLAGS) -xc -o /dev/null -lelf $(HOSTLDFLAGS) -,1,0)
   ifeq ($(has_libelf),1)
     objtool_target := tools/objtool FORCE
   else
Signature · 1 line
2.11.0