Relationship Between. plt. rel. dyn. rel. plt. got. got. plt in the elf File.. plt. rel. dyn
. Plt is a stepping stone that stores the offset of a symbol in the relocation table (used to find a symbol for the first time) and the corresponding address of. got. plt.
. Rel. dyn saves the start address of the. got segment, which has not been proved
. Rel. plt stores information about the relocated table.
. Got is said to have saved the offset of each symbol of the elf file, that is, do not dynamically link it. It is not proved
. Got. plt saves the Relocation Address.
For example, if printf is a relocation symbol and needs to be connected to the symbol, the process is as follows:
Main function call. an address in the plt segment. The first sentence here is to transfer. got. the printf address saved in plt. If this is the first time, the saved address is. in plt, the next sentence is pushed into this symbol. rel. the offset of the relocation table in plt. Then, the ld program finds the address based on the information in the relocation table and saves it to the address pointed to by the relocation table. This address is actually. got. an address of the plt segment.
The address saved in. got. plt can be obtained directly during the second call.
In short, this design is very complete and relevant, 6666666