diff --git a/scripts/Makefile.build b/scripts/Makefile.build index b897c7806711..7bdad35660e8 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -169,9 +169,14 @@ ifdef CONFIG_MODVERSIONS # genksyms on the preprocessed source and dump them into the .cmd file. # o modpost will extract versions from that file and create *.c files that will # be compiled and linked to the kernel and/or modules. +ifeq ($(CONFIG_LTO_CLANG),) + SYM_CHECK = $(READELF) -sW +else + SYM_CHECK = $(NM) +endif gen_symversions = \ - if $(NM) $@ 2>/dev/null | grep -q ' __export_symbol_'; then \ + if $(SYM_CHECK) $@ 2>/dev/null | grep -q ' __export_symbol_'; then \ $(call cmd_gensymtypes_$(1),$(KBUILD_SYMTYPES),$(@:.o=.symtypes)) \ >> $(dot-target).cmd; \ fi