Léandre
Léandre

Reputation: 125

Location of Relocation table in ELF file

I don't find any information about where is located the relocation table in ELF file.

My project is to display information about a ELF file like readelf. I did the display of the Header, Section Header and Symbol table but I don't know where to find the relocation table.

Could anyone explain me where relocation table is in ELF file ?

Thanks

Upvotes: 1

Views: 1878

Answers (1)

Mike Kinghan
Mike Kinghan

Reputation: 61590

It depends what kind of ELF file you are talking about, and in any case there can be more than one relocation table.

In an ELF 32-bit object file, static code relocations are specified in the rel.text section; for an ELF 64-bit object file, static code relocations are specified in the rela.text section. There may be additional static relocation sections {rel|rela}.??? that specify relocations for objects in the ??? section, e.g. .rela.eh_frame, .rela.init_array.

In an ELF executable or DSO, the .rela.dyn section specifies dynamic relocations for variables. The rela.plt section specifies dynamic relocations for functions.

Upvotes: 1

Related Questions