OSDN Git Service

Linker writes to wrong memory location when processing DT_MIPS_RLD_MAP
authorBenjamin Adolphi <b.adolphi@gmail.com>
Tue, 18 Feb 2014 23:50:32 +0000 (00:50 +0100)
committerBenjamin Adolphi <b.adolphi@gmail.com>
Tue, 18 Feb 2014 23:50:32 +0000 (00:50 +0100)
commit006f9ad8910c945cd50e54f6c34d8c27b11c1193
tree233f6c8e419d899cf32a33e682969afbc8ad6ee6
parent3623d80675e5321b92c2d88a7b7ec6bd998d81d5
Linker writes to wrong memory location when processing DT_MIPS_RLD_MAP

When bionic's dynamic linker processes the .dynamic section of a MIPS ELF binary and encounters the DT_MIPS_RLD_MAP dynamic array tag, it calculates the address of where to write a pointer to the _r_debug structure. The current implementation simply reads the value given in the d_ptr field and writes the pointer address to that location. However, this value has to be adjusted to reflect the real load address of the binary. Otherwise the linker will write to a faulty location possibly resulting in a crash when linking a MIPS binary that includes DT_MIPS_RLD_MAP. This change corrects that problem.

Change-Id: I1a91874f7ab47289001fe72d9016660c14c70362
Signed-off-by: Benjamin Adolphi <b.adolphi@gmail.com>
linker/linker.cpp