What is the difference between executable and relocatable in elf format?

前端 未结 4 1710
醉话见心
醉话见心 2021-02-01 20:33

What is the difference between executable file in elf format and relocatable file in elf format?

4条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-01 21:13

    ELF executable, as we can understand from its name, is a file that can be executed. This file can be generated from C code for example.

    The process of relocation is fixing the addresses of labels and symbols which were created in the code. For example, if you write a program in assembly language and you look at the listing file of your source code, you'll find some places where [00000000] is written instead of a label mentioned at this line. This zeroes mean that he linker uses relocation in order to fix the address the its future value.

提交回复
热议问题