Quantcast
Viewing all articles
Browse latest Browse all 22040

Error compiling Linux kernel 2.6 on a new version of GCC

I downloaded Linux kernel 2.6.34 and I wanted to compile it with GCC v8.3.0 on Debian10. Initially, I had problems with PIE executables that I solved by adding -fno-pie to the Makefile's CFLAGS. I succeeded to run the build but it, eventually, failed with the following error:

gcc: error: elf_x86_64: No such file or directorygcc: error: unrecognized command line option ‘-m’make[2]: *** [/linux/arch/x86/vdso/Makefile:34: arch/x86/vdso/vdso.so.dbg] Error 1make[1]: *** [scripts/Makefile.build:366: arch/x86/vdso] Error 2make: *** [Makefile:884: arch/x86] Error 2

Taking a look at /linux/arch/x86/vdso/Makefile:34

28  VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \29          -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=409630  31  $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so32  33  $(obj)/vdso.so.dbg: $(src)/vdso.lds $(vobjs) FORCE34          $(call if_changed,vdso)

It looks like the -m elf_x86_64 option passed to the linker that caused this error.

After several other random hacks and frustrations, I thought maybe this 10yo kernel can never be compiled on a modern system and I decided to compile it on a Ubuntu 12.04 LTS VM from 2012 which relatively has software versions (GCC v4.8) near the same kernel release year. Unfortunately, it didn't work and the same problem showed up again on GCC v4.8:

gcc: error: elf_x86_64: No such file or directorygcc: error: unrecognized command line option ‘-m’make[2]: *** [arch/x86/vdso/vdso.so.dbg] Error 1make[1]: *** [arch/x86/vdso] Error 2make: *** [arch/x86] Error 2

What is the reason behind this problem and how can I solve it ?


Viewing all articles
Browse latest Browse all 22040

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>