Instead of explicitly depending on libelf, use kernel.moduleBuildDependencies which was introduced in 1e77d0b9 ("kernel 4.14 require libelf to compile modules.").