diff options
| author | Thomas Preud'homme <robotux@celest.fr> | 2013-12-17 21:01:05 +0800 |
|---|---|---|
| committer | Thomas Preud'homme <robotux@celest.fr> | 2014-02-02 17:23:15 +0800 |
| commit | 599677a5e29000618d6086ed1781520103aba954 (patch) | |
| tree | 7d18f880609d8521a810a390861f973cbd1132cc | |
| parent | 3d4b57ffe3f31bfc5ee5859ddba6a24d16a7223e (diff) | |
| download | tinycc-599677a5e29000618d6086ed1781520103aba954.tar.gz tinycc-599677a5e29000618d6086ed1781520103aba954.tar.bz2 | |
Give ARM asm mnemonic of PLT entries
Give ARM assembly mnemonic of PLT entries in put_got_entry
| -rw-r--r-- | tccelf.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1102,23 +1102,23 @@ static void put_got_entry(TCCState *s1, if (plt->data_offset == 0) { /* first plt entry */ p = section_ptr_add(plt, 16); - put32(p , 0xe52de004); - put32(p + 4, 0xe59fe010); - put32(p + 8, 0xe08fe00e); - put32(p + 12, 0xe5bef008); + put32(p, 0xe52de004); /* push {lr} */ + put32(p+4, 0xe59fe010); /* ldr lr, [pc, #16] */ + put32(p+8, 0xe08fe00e); /* add lr, pc, lr */ + put32(p+12, 0xe5bef008); /* ldr pc, [lr, #8]! */ } if (s1->sym_attrs[sym_index].plt_thumb_stub) { p = section_ptr_add(plt, 20); - put32(p , 0x4778); /* bx pc */ + put32(p, 0x4778); /* bx pc */ put32(p+2, 0x46c0); /* nop */ p += 4; } else p = section_ptr_add(plt, 16); - put32(p , 0xe59fc004); /* ldr ip, [pc, #4] ; offset in GOT */ - put32(p+4, 0xe08fc00c); /* add ip, pc, ip ; absolute address or offset */ - put32(p+8, 0xe59cf000); /* ldr pc, [ip] ; load absolute address or load offset */ - put32(p+12, s1->got->data_offset); + put32(p, 0xe59fc004); /* ldr ip, [pc, #4] ; GOT entry offset */ + put32(p+4, 0xe08fc00c); /* add ip, pc, ip ; addr of GOT entry */ + put32(p+8, 0xe59cf000); /* ldr pc, [ip] ; jump to GOT entry */ + put32(p+12, s1->got->data_offset); /* GOT entry off once patched */ /* the symbol is modified so that it will be relocated to the PLT */ |
