Why does readelf show "System V" as my OS instead of Linux?
5,610
There are few differences between ELF executables on different platforms. “UNIX - System V” is the common ground; System V is where the ELF format came from. The corresponding numerical value is 0. This value indicates that the executable doesn't use any OS-specific extension. Debian GNU/Linux, at least, configures GCC/binutils to generate executables with this field set to 0 by default.
Related videos on Youtube
Author by
alex_reader
Updated on September 18, 2022Comments
-
alex_reader almost 2 years
I compiled a small C program (2 lines of codes) with gcc to try to understand ELF file format. Doing a
readelf -h
on the object file, I have in the header :OS/ABI: UNIX - System V
I am using Fedora, so why isn't it Linux instead ?
Edit: I compiled
int main(){ int x = 0; x++; }
with
gcc -o main.o -c main.c
. My gcc version isgcc (GCC) 4.5.1 20100924 (Red Hat 4.5.1-4)
-
terdon about 10 yearsPlease show us i) the code you compiled ii) the output of
gcc --version
and iii) the exact command you used to compile it. -
alex_reader about 10 yearsI've edited the question accordingly.
-
ctrl-alt-delor about 10 yearsI just did
readelf -h /bin/ls
on debian gnu/linux. It also showedOS/ABI: UNIX - System V
. My guess is that the ABI is used on more than one kernel, not just linux. I also know that linux supports more than one ABI. -
Stéphane Chazelas about 10 yearsWikipedia says It [the OSABI field in the ELF header] is often set to 0 [SysV] regardless of the target platform
-
Leiaz about 10 yearsThis field tells if the ELF file is using any OS specific extensions, the default is 0. More detailled description here(at EI_OSABI).
-
Jakob Bennemann about 10 years@StephaneChazelas, that's probably the answer. Maybe good to post it as one. :)
-
-
Ciro Santilli Путлер Капут 六四事 about 8 yearsAnd the ELF standard says 0 means "ELFOSABI_NONE 0 No extensions or unspecified" sco.com/developers/gabi/2003-12-17/ch4.eheader.html