Reposition Absolute Reference (absolute reference relocation)
Or to undertake the previous program, in swap.c "int *bufp0 = &buf[0];" Bufp0 is initialized to a global array address, so it needs to relocate, details <PIC1> and <pic2>, r.offset=0xc, R.symbol=buf, r.type=r_386_32, relocation entries tell the compiler , this is an absolute 32-bit reference and must be relocated to point to the last buf.
<pic1, Objdump-rs swap.o>
<pic2, readelf-a swap.o >
<PIC3, Readelf-a p>
by analyzing the target file you can know the runtime address of the BUF, <pic3>, ADDR (r.symbol) =addr (BUF) =0x0804a014, and then relocate:
*refptr = (unsigned) (ADDR (R.symbol) + *refptr)
= (unsigned) (0x0804a014 + 0)
= (unsigned) (0x0804a014)
In the final executable target file, <pic4> See that the value stored in the bufp0 in 0x0804a028 is 0x0804a014 (small end).
<PIC4, objdump-d-j .data>
Reposition Absolute Reference (absolute reference relocation)