[Linux内核编译]:静态调用依赖于 libelf 的版本?

幻想 2026年06月23日 3 0

背景

由于需要,去编译centos5可用内核,成功编译了i386(实际i686)的5.10内核,要编译x86_64时出现此问题。

问题

ld: warning: arch/x86/kvm/../../../virt/kvm/kvm_main.o has a corrupt section with a size (7472747368732e00) larger than the file size
arch/x86/kvm/../../../virt/kvm/kvm_main.o: file not recognized: file format not recognized

解决

centos5自带的libelf:

rpm -qa | grep libelf
elfutils-libelf-devel-static-0.137-3.el5
elfutils-libelf-devel-0.137-3.el5
elfutils-libelf-devel-static-0.137-3.el5
elfutils-libelf-0.137-3.el5
elfutils-libelf-0.137-3.el5
elfutils-libelf-devel-0.137-3.el5

是0.137,但此问题在0.158解决,因此只能自编译升级,以此记录。

参考

Last Updated: 2026/06/23 20:00:53
【AI生成】HomeInventory 项目**原始需求**