19

Whenever I run file on an ELF binary I get this output:

[jonescb@localhost ~]$ file a.out
a.out: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for
GNU/Linux 2.6.9, dynamically linked (uses shared libs), for GNU/Linux 2.6.9, 
not stripped

I'm just wondering what changed in Linux 2.6.9 that this binary couldn't run on 2.6.8? Wasn't ELF support added in Linux 2.0?

Rui F Ribeiro
  • 55,929
  • 26
  • 146
  • 227
jonescb
  • 1,908
  • 1
  • 16
  • 21

1 Answers1

24

glibc has a configure option called --enable-kernel that lets you specify the minimum supported kernel version. When object files are linked with that glibc build, the linker adds a SHT_NOTE section to the resulting executable named .note.ABI-tag that includes that minimum kernel version. The exact format is defined in the LSB, and file knows to look for that section and how to interpret it.

The reason your particular glibc was built to require 2.6.9 depends on who built it. It's the same on my system (Gentoo); a comment in the glibc ebuild says that it specifies 2.6.9 because it's the minimum required for the NPTL, so that's likely a common choice. Another one that seems to come up is 2.4.1, because it was the minimum required for LinuxThreads, the package used before NPTL

Michael Mrozek
  • 91,316
  • 38
  • 238
  • 232
  • 1
    Do you gain performance improvements when increasing the minimum required kernel version? What are the benefits to doing so? – Aaron Franke Feb 05 '19 at 14:56
  • Here (Fedora 31, x86_64) /lib/libc-2.30.so requires kernel 3.20 (current kernel version is 5.3.12-300) – vonbrand Nov 29 '19 at 12:39