History

Give ARM asm mnemonic of PLT entries

Give ARM assembly mnemonic of PLT entries in put_got_entry

Thomas Preud'homme committed 12 years ago

Commit 599677a1 parent 3d4b57f1 file · +9 −9Browse files

Unified · Split

tccelf.c+9−9
@@ -1102,23 +1102,23 @@ static void put_got_entry(TCCState *s1, · 1101 unmodified lines
11021102 if (plt->data_offset == 0) {
11031103 /* first plt entry */
11041104 p = section_ptr_add(plt, 16);
1105− put32(p , 0xe52de004);
1106− put32(p + 4, 0xe59fe010);
1107− put32(p + 8, 0xe08fe00e);
1108− put32(p + 12, 0xe5bef008);
1105+ put32(p, 0xe52de004); /* push {lr} */
1106+ put32(p+4, 0xe59fe010); /* ldr lr, [pc, #16] */
1107+ put32(p+8, 0xe08fe00e); /* add lr, pc, lr */
1108+ put32(p+12, 0xe5bef008); /* ldr pc, [lr, #8]! */
11091109 }
11101110
11111111 if (s1->sym_attrs[sym_index].plt_thumb_stub) {
11121112 p = section_ptr_add(plt, 20);
1113− put32(p , 0x4778); /* bx pc */
1113+ put32(p, 0x4778); /* bx pc */
11141114 put32(p+2, 0x46c0); /* nop */
11151115 p += 4;
11161116 } else
11171117 p = section_ptr_add(plt, 16);
1118− put32(p , 0xe59fc004); /* ldr ip, [pc, #4] ; offset in GOT */
1119− put32(p+4, 0xe08fc00c); /* add ip, pc, ip ; absolute address or offset */
1120− put32(p+8, 0xe59cf000); /* ldr pc, [ip] ; load absolute address or load offset */
1121− put32(p+12, s1->got->data_offset);
1118+ put32(p, 0xe59fc004); /* ldr ip, [pc, #4] ; GOT entry offset */
1119+ put32(p+4, 0xe08fc00c); /* add ip, pc, ip ; addr of GOT entry */
1120+ put32(p+8, 0xe59cf000); /* ldr pc, [ip] ; jump to GOT entry */
1121+ put32(p+12, s1->got->data_offset); /* GOT entry off once patched */
11221122
11231123 /* the symbol is modified so that it will be relocated to
11241124 the PLT */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t