Subversion Repositories HelenOS

Rev

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

Rev 2997 Rev 2998
Line 81... Line 81...
81
 */
81
 */
82
void module_process_pre_arch(module_t *m)
82
void module_process_pre_arch(module_t *m)
83
{
83
{
84
    uint32_t *plt;
84
    uint32_t *plt;
85
    uint32_t *_plt_ent;
85
    uint32_t *_plt_ent;
86
    int i;
-
 
87
 
86
 
88
    plt = m->dyn.plt_got;
87
    plt = m->dyn.plt_got;
89
    if (!plt) {
88
    if (!plt) {
90
        /* Module has no PLT */
89
        /* Module has no PLT */
91
        return;
90
        return;
Line 189... Line 188...
189
            printf("rel_type: %x, rel_offset: 0x%x\n", rel_type, r_offset);
188
            printf("rel_type: %x, rel_offset: 0x%x\n", rel_type, r_offset);
190
            sym_def = symbol_def_find(str_tab + sym->st_name, &dest);
189
            sym_def = symbol_def_find(str_tab + sym->st_name, &dest);
191
            printf("dest name: '%s'\n", dest->dyn.soname);
190
            printf("dest name: '%s'\n", dest->dyn.soname);
192
            printf("dest bias: 0x%x\n", dest->bias);
191
            printf("dest bias: 0x%x\n", dest->bias);
193
            if (sym_def) {
192
            if (sym_def) {
194
                if (sym_def->st_shndx == SHN_ABS) {
-
 
195
                    /* Do not add bias to absolute symbols */
-
 
196
                    sym_addr = sym_def->st_value;
-
 
197
                } else {
-
 
198
                    sym_addr = sym_def->st_value + dest->bias;
193
                sym_addr = symbol_get_addr(sym_def, dest);
199
                }
-
 
200
                printf("symbol definition found, addr=0x%x\n", sym_addr);
194
                printf("symbol definition found, addr=0x%x\n", sym_addr);
201
            } else {
195
            } else {
202
                printf("symbol definition not found\n");
196
                printf("symbol definition not found\n");
203
                continue;
197
                continue;
204
            }
198
            }
Line 212... Line 206...
212
                printf("error: proc index out of range\n");
206
                printf("error: proc index out of range\n");
213
                //kputint(0xee00ee0ee00);
207
                //kputint(0xee00ee0ee00);
214
                while(1);
208
                while(1);
215
            }
209
            }
216
            //_plt_table[pidx] = sym_addr;
210
            //_plt_table[pidx] = sym_addr;
217
            plt[18+2*pidx] = _b(sym_addr, &plt[18+2*pidx]);
211
            plt[18+2*pidx] = _b((void *)sym_addr, &plt[18+2*pidx]);
218
            break;
212
            break;
219
 
213
 
220
        case R_PPC_ADDR32:
214
        case R_PPC_ADDR32:
221
            printf("fixup R_PPC_ADDR32 (b+v+a)\n");
215
            printf("fixup R_PPC_ADDR32 (b+v+a)\n");
222
            *r_ptr = r_addend + sym_addr;
216
            *r_ptr = r_addend + sym_addr;