Give ARM assembly mnemonic of PLT entries in put_got_entry
Unified · Split
| @@ -1102,23 +1102,23 @@ static void put_got_entry(TCCState *s1, · 1101 unmodified lines | ||
| 1102 | 1102 | if (plt->data_offset == 0) { |
| 1103 | 1103 | /* first plt entry */ |
| 1104 | 1104 | 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]! */ | |
| 1109 | 1109 | } |
| 1110 | 1110 | |
| 1111 | 1111 | if (s1->sym_attrs[sym_index].plt_thumb_stub) { |
| 1112 | 1112 | p = section_ptr_add(plt, 20); |
| 1113 | − put32(p , 0x4778); /* bx pc */ | |
| 1113 | + put32(p, 0x4778); /* bx pc */ | |
| 1114 | 1114 | put32(p+2, 0x46c0); /* nop */ |
| 1115 | 1115 | p += 4; |
| 1116 | 1116 | } else |
| 1117 | 1117 | 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 */ | |
| 1122 | 1122 | |
| 1123 | 1123 | /* the symbol is modified so that it will be relocated to |
| 1124 | 1124 | the PLT */ |