Rev 2995 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 2995 | Rev 2996 | ||
---|---|---|---|
Line 158... | Line 158... | ||
158 | /* |
158 | /* |
159 | * Note that switches only work because we are using |
159 | * Note that switches only work because we are using |
160 | * -fno-jump-tables. |
160 | * -fno-jump-tables. |
161 | */ |
161 | */ |
162 | switch (tag) { |
162 | switch (tag) { |
163 | case DT_PLTRELSZ: jmp_rel_entries = dval/8; break; |
163 | case DT_PLTRELSZ: jmp_rel_entries = dval/sizeof(elf_rela_t); break; |
164 | case DT_JMPREL: jmp_rel_table = dptr; break; |
164 | case DT_JMPREL: jmp_rel_table = dptr; break; |
165 | case DT_PLTGOT: |
165 | case DT_PLTGOT: |
166 | /* PLT address */ |
166 | /* PLT address */ |
167 | plt = dptr; break; |
167 | plt = dptr; break; |
168 | case DT_SYMTAB: sym_table = dptr; break; |
168 | case DT_SYMTAB: sym_table = dptr; break; |
169 | case DT_RELA: rel_table = dptr; break; |
169 | case DT_RELA: rel_table = dptr; break; |
170 | case DT_RELASZ: rel_entries = dval / 8; break; |
170 | case DT_RELASZ: rel_entries = dval / sizeof(elf_rela_t); break; |
171 | default: break; |
171 | default: break; |
172 | } |
172 | } |
173 | 173 | ||
174 | // kputint(0x20); |
174 | // kputint(0x20); |
175 | 175 | ||
Line 289... | Line 289... | ||
289 | //_plt_table[i] == function address; |
289 | //_plt_table[i] == function address; |
290 | plt[18+i] = _b(_plt_call, &plt[18+i]); // b .PLTcall |
290 | plt[18+i] = _b(_plt_call, &plt[18+i]); // b .PLTcall |
291 | } |
291 | } |
292 | 292 | ||
293 | kputint(-5); |
293 | kputint(-5); |
- | 294 | kputint(_plt_table[0]); |
|
- | 295 | } |
|
294 | 296 | ||
295 | /* This will come in handy */ |
297 | /* This will come in handy */ |
296 | // runtime_env.rtld_dynamic = dynamic; |
298 | runtime_env.rtld_dynamic = dynamic; |
297 | // runtime_env.rtld.bias = bias; |
299 | runtime_env.rtld.bias = bias; |
298 | 300 | ||
299 | kputint(_plt_table[0]); |
- | |
300 | } |
- | |
301 | // volatile int ff=1; |
301 | // volatile int ff=1; |
302 | // while(ff); |
302 | // while(ff); |
303 | test_func(); |
303 | test_func(); |
304 | kputint(0x42); |
304 | kputint(0x42); |
305 | // while(1); |
305 | // while(1); |
Line 309... | Line 309... | ||
309 | 309 | ||
310 | kputint(33); |
310 | kputint(33); |
311 | __io_init(); |
311 | __io_init(); |
312 | kputint(-1); |
312 | kputint(-1); |
313 | kputint(0x52); |
313 | kputint(0x52); |
314 | printf("Hello, world! (from ppc rtld)\n"); |
314 | // printf("Hello, world! (from ppc rtld)\n"); |
315 | kputint(0x62); |
315 | kputint(0x62); |
316 | while(1); |
316 | // while(1); |
317 | // kputint(34); |
317 | kputint(34); |
318 | // _rtld_main(); |
318 | _rtld_main(); |
319 | // kputint(35); |
319 | kputint(35); |
320 | // __exit(); |
320 | __exit(); |
321 | 321 | ||
322 | // kputint(36); |
322 | kputint(36); |
323 | } |
323 | } |
324 | 324 | ||
325 | /** @} |
325 | /** @} |
326 | */ |
326 | */ |