Loader specification(elf) - Hiroshi123/bin_tools GitHub Wiki

1st stage is mapping library.

This stage involves

mapping program header which should be loaded.

Retrieving dynamic vector offset, tls information, and gnu_relro on dso. PT_LOAD segments should be referred from loadmap which will be allocateed as external heap considering number of segments to be loaded.

Dynamic Section

Name Type Role when loading dso
NEEDED 1
PLTRELSZ 2
PLTGOT 3 got
DT_HASH 4 hashtab
STRTAB 5 decode_dyn function(900) strings
SYMTAB 6 syms
RELA 7
RELASZ 8
RELAENT 9
STRSZ 10
SYMENT 11
INIT 12
FINI 13
SONAME 14
RPATH 15 rpath_orig
SYMBOLIC 16
REL 17
RELSZ 18
RELENT 19
PLTREL 20
DEBUG 21
TEXTREL 22 This is actually first flags which will be checked during mapping.
BIND_NOW 24
INIT_ARRAY 25
FINI_ARRAY 26
INIT_ARRAYSZ 27
FINI_ARRAYSZ 28
RUNPATH 29 rpath_orig
FLAGS 30
GNU_HASH 0x6ffffef5 ghashtab
VERSYM 0x6ffffff0 versym

Dynamic Vector will be referred as dynv at __dls2/__dls3/decode_dyn(1829/1874)/load_library