Subversion Repositories HelenOS

Rev

Rev 3681 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3681 Rev 3688
Line 33... Line 33...
33
/**
33
/**
34
 * @file
34
 * @file
35
 */
35
 */
36
 
36
 
37
#include <stdio.h>
37
#include <stdio.h>
-
 
38
#include <stdlib.h>
38
 
39
 
39
#include <arch.h>
40
#include <arch.h>
40
#include <elf_dyn.h>
41
#include <elf_dyn.h>
41
#include <symbol.h>
42
#include <symbol.h>
42
#include <rtld.h>
43
#include <rtld.h>
Line 224... Line 225...
224
        case R_PPC_JMP_SLOT:
225
        case R_PPC_JMP_SLOT:
225
            DPRINTF("fixup R_PPC_JMP_SLOT (b+v)\n");
226
            DPRINTF("fixup R_PPC_JMP_SLOT (b+v)\n");
226
            pidx = (r_ptr - _plt_ent) / 2;
227
            pidx = (r_ptr - _plt_ent) / 2;
227
            if (pidx >= plt_n) {
228
            if (pidx >= plt_n) {
228
                DPRINTF("error: proc index out of range\n");
229
                DPRINTF("error: proc index out of range\n");
229
                //kputint(0xee00ee0ee00);
-
 
230
                while(1);
230
                exit(1);
231
            }
231
            }
232
            //_plt_table[pidx] = sym_addr;
-
 
233
            plt[18+2*pidx] = _b((void *)sym_addr, &plt[18+2*pidx]);
232
            plt[18+2*pidx] = _b((void *)sym_addr, &plt[18+2*pidx]);
234
            break;
233
            break;
235
 
234
 
236
        case R_PPC_ADDR32:
235
        case R_PPC_ADDR32:
237
            DPRINTF("fixup R_PPC_ADDR32 (b+v+a)\n");
236
            DPRINTF("fixup R_PPC_ADDR32 (b+v+a)\n");
Line 256... Line 255...
256
           
255
           
257
        case R_PPC_RELATIVE:
256
        case R_PPC_RELATIVE:
258
            DPRINTF("fixup R_PPC_RELATIVE (b+a)\n");
257
            DPRINTF("fixup R_PPC_RELATIVE (b+a)\n");
259
            *r_ptr = r_addend + m->bias;
258
            *r_ptr = r_addend + m->bias;
260
            break;
259
            break;
-
 
260
 
261
        case R_PPC_REL24:
261
        case R_PPC_REL24:
262
//          printf("ignore R_PPC_REL24 at 0x%04x\n", (uintptr_t) r_ptr);
-
 
263
            *r_ptr = (sym_addr + r_addend - (uint32_t)r_ptr) >> 2;
-
 
264
            DPRINTF("fixup R_PPC_REL24 (s+a-p)>>2\n");
262
            DPRINTF("fixup R_PPC_REL24 (s+a-p)>>2\n");
-
 
263
            *r_ptr = (sym_addr + r_addend - (uint32_t)r_ptr) >> 2;
-
 
264
            break;
-
 
265
 
-
 
266
        case R_PPC_DTPMOD32:
-
 
267
            /*
-
 
268
             * We can ignore this as long as the only module
-
 
269
             * with TLS variables is libc.so.
265
            /*TODO*/
270
             */
-
 
271
            DPRINTF("Ignoring R_PPC_DTPMOD32\n");
266
            break;
272
            break;
-
 
273
 
267
        default:
274
        default:
268
            printf("unknown relocation type %d\n", rel_type);
275
            printf("Error: Unknown relocation type %d.\n",
-
 
276
                rel_type);
-
 
277
            exit(1);
269
            break;
278
            break;
270
        }
279
        }
271
    }
280
    }
272
 
281
 
273
    /*
282
    /*