What is the version number field in the output of the linux file command

后端 未结 1 1721
不知归路
不知归路 2021-01-18 13:53

If I do the following command on my executable called \"version\", compiled on Fedora Core 11, I get this output

file version

version: ELF 32-bit LSB executa

相关标签:
1条回答
  • 2021-01-18 14:05

    It's the kernel version of the machine the binary was compiled on. If you use precompiled binaries from your distribution, it's the kernel version of a machine of the distribution vendor, probably in its compile farm.

    It's relevant e.g. when considering syscalls. Say your binary uses the syscall no. X and you use a kernel which does not support X yet or worse has assigned syscall no. X to a different syscall.

    The vanilla Linux Kernel User API is stable. That means every syscall available in Linux version A is available in Linux version B if A <=B. But it may happen that some developer releases his/her own development version of Linux (something like linux-2.6.18-xy) and s/he implements a new syscall. If s/he now compiles a binary using that kernel version, the binary gets tagged with that version. So, you are later on able to know that it may or may not work.

    Btw, /usr/include/asm/unistd_32.h contains syscall numbers, excerpt:

    [...]
    #define __NR_restart_syscall      0
    #define __NR_exit         1
    #define __NR_fork         2
    #define __NR_read         3
    #define __NR_write        4
    #define __NR_open         5
    [...]
    
    0 讨论(0)
提交回复
热议问题