Add address of GOT + 8 in PLT + 16 and fix PLT0
commit60374d01ae56e59308d1b5441bc1986295507ec6
authorThomas Preud'homme <robotux@celest.fr>
Sat, 12 Nov 2016 15:16:05 +0000 (12 23:16 +0800)
committerThomas Preud'homme <robotux@celest.fr>
Sat, 3 Dec 2016 17:26:51 +0000 (3 17:26 +0000)
treef2ed503793c96b6d28188cb3655e6f0bde208529
parentf924d0ca964bc6f45fb905bf587ae4ef44fb92c2
Add address of GOT + 8 in PLT + 16 and fix PLT0

On ARM targets, the jump to ld.so resolution routine is done in PLT0 by
loading the offset to the GOT found in PLT+16 and from there loading the
address in GOT+8 and jumping to it.

Currently tcc starts the first regular PLT entry at PLT+16 which thus
does not contain the offset to the GOT. This commit fixes that.

Note that calls via PLT still worked nonetheless because of some missing
dynamic tag which makes ld.so behaves as if RTLD_BIND_NOW was specified
in the environment for all executable created by tcc.
tccelf.c