GOT GOT table and PLT PLT table in the program of the role is very large, the next explanation I hope you can take a closer look
We use a very simple example to illustrate the following code:
Figure 1
Then we compile
We directly gdb./a.out gdb/a.out to perform the anti-compilation process, and then through Disasmain Disas Main, look at the anti-compilation code in main main function as follows:
Figure 3
We can observe the two functions of Gets@plt gets@plt and Puts@plt puts@plt, and why we add a @plt @plt, because this is the address of the data in the PLT PLT table. Then why does the code address in the anti-compilation be the address in the PLT plt table?
Reason
In order to better user experience and memory CPU CPU utilization, the program will be compiled with two tables to assist, one for the PLT PLT table, one for the GOT GOT table, the PLT PLT table can be called the internal function table, GOT GOT table for the Global function table (also can be said to be a dynamic function table This is a self-proclaimed), The two tables are relative, what is called relative, the PLT plt table data is an address in the GOT GOT table, it can be understood that must be one by one corresponding, as shown below:
Fig. 4 4
The data contents of each item in the PLT PLT table are corresponding to the address of an item in the GOT GOT table. This is fixed, and here we also know that the PLT PLT table data is not the actual address of the function, but the address of the GOT GOT table entry, good pit AH.
In fact, when you enter a function with a @plt @plt symbol, this function is actually a transitional function, because <