Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ELF file type - ET_EXEC and ET_DYN [duplicate]

Tags:

x86

elf

Alright, as far as I know ET_EXEC is used to indicate that the file is an executable whereas ET_DYN indicates that the file is a shared library. So to be sure I wrote a simple program in C, the problem however is that readelf -h is yielding the following:

ELF Header:
Magic:   7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 
Class:                             ELF64
Data:                              2's complement, little endian
Version:                           1 (current)
OS/ABI:                            UNIX - System V
ABI Version:                       0
Type:                              DYN (Shared object file)
  .
  .
  .

I thought this had something to do with the compiler I used so I did the same with some utilities in /bin but unfortunately got the same results. So here's the question: Why is readelf identifying executables as shared libraries?

like image 531
Trey Avatar asked May 12 '18 05:05

Trey


1 Answers

Why is readelf identifying executables as shared libraries?

Because it is (a special kind of) shared library. See also this answer.

like image 171
Employed Russian Avatar answered Oct 08 '22 10:10

Employed Russian