Rev 2996 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2996 | Rev 2997 | ||
---|---|---|---|
Line 112... | Line 112... | ||
112 | plt[8] = _mtctr(11); // mtctr r11 |
112 | plt[8] = _mtctr(11); // mtctr r11 |
113 | plt[9] = _bctr(); |
113 | plt[9] = _bctr(); |
114 | 114 | ||
115 | /* .PLTi, i = 0..N-1 */ |
115 | /* .PLTi, i = 0..N-1 */ |
116 | // kputint(-4); |
116 | // kputint(-4); |
117 | for (i = 0; i < plt_n; ++i) { |
117 | /* for (i = 0; i < plt_n; ++i) { |
118 | //_plt_table[i] == function address; |
118 | //_plt_table[i] == function address; |
119 | plt[18+i] = _b(_plt_call, &plt[18+i]); // b .PLTcall |
119 | plt[18+i] = _b(_plt_call, &plt[18+i]); // b .PLTcall |
120 | } |
120 | }*/ |
121 | } |
121 | } |
122 | 122 | ||
123 | void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size) |
123 | void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size) |
124 | { |
124 | { |
125 | /* Unused */ |
125 | /* Unused */ |
Line 211... | Line 211... | ||
211 | if (pidx >= plt_n) { |
211 | if (pidx >= plt_n) { |
212 | printf("error: proc index out of range\n"); |
212 | printf("error: proc index out of range\n"); |
213 | //kputint(0xee00ee0ee00); |
213 | //kputint(0xee00ee0ee00); |
214 | while(1); |
214 | while(1); |
215 | } |
215 | } |
216 | _plt_table[pidx] = sym_addr; |
216 | //_plt_table[pidx] = sym_addr; |
- | 217 | plt[18+2*pidx] = _b(sym_addr, &plt[18+2*pidx]); |
|
217 | break; |
218 | break; |
218 | 219 | ||
219 | case R_PPC_ADDR32: |
220 | case R_PPC_ADDR32: |
220 | printf("fixup R_PPC_ADDR32 (b+v+a)\n"); |
221 | printf("fixup R_PPC_ADDR32 (b+v+a)\n"); |
221 | *r_ptr = r_addend + sym_addr; |
222 | *r_ptr = r_addend + sym_addr; |
Line 224... | Line 225... | ||
224 | case R_PPC_RELATIVE: |
225 | case R_PPC_RELATIVE: |
225 | printf("fixup R_PPC_RELATIVE (b+a)\n"); |
226 | printf("fixup R_PPC_RELATIVE (b+a)\n"); |
226 | *r_ptr = r_addend + m->bias; |
227 | *r_ptr = r_addend + m->bias; |
227 | break; |
228 | break; |
228 | case R_PPC_REL24: |
229 | case R_PPC_REL24: |
229 | printf("ignore R_PPC_RELATIVE\n"); |
230 | printf("ignore R_PPC_REL24\n"); |
230 | /*TODO*/ |
231 | /*TODO*/ |
231 | break; |
232 | break; |
232 | } |
233 | } |
233 | } |
234 | } |
234 | 235 |