Ignore:
Timestamp:
2016-04-12T16:59:41Z (8 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e2e9a8a
Parents:
3b0f1b9a
Message:

Source for R_*_COPY relocations must be searched for everywhere except for the executable itself (Thanks Jakub)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/arch/ia32/src/rtld/reloc.c

    r3b0f1b9a r0f792c28  
    6969        uint32_t sym_size;
    7070        char *str_tab;
    71        
     71
    7272        elf_symbol_t *sym_def;
    7373        module_t *dest;
     
    8080
    8181        DPRINTF("address: 0x%x, entries: %d\n", (uintptr_t)rt, rt_entries);
    82        
     82
    8383        for (i = 0; i < rt_entries; ++i) {
    8484//              DPRINTF("symbol %d: ", i);
     
    100100//                      DPRINTF("rel_type: %x, rel_offset: 0x%x\n", rel_type, r_offset);
    101101                        sym_def = symbol_def_find(str_tab + sym->st_name,
    102                             m, &dest);
     102                            m, ssf_none, &dest);
    103103//                      DPRINTF("dest name: '%s'\n", dest->dyn.soname);
    104104//                      DPRINTF("dest bias: 0x%x\n", dest->bias);
     
    137137                        /*
    138138                         * Copy symbol data from shared object to specified
    139                          * location.
     139                         * location. Need to find the 'source', i.e. the
     140                         * other instance of the object than the one in the
     141                         * executable program.
    140142                         */
    141143                        DPRINTF("fixup R_386_COPY (s)\n");
     144
     145                        sym_def = symbol_def_find(str_tab + sym->st_name,
     146                            m, ssf_noroot, &dest);
     147
     148                        if (sym_def) {
     149                                sym_addr = (uint32_t)
     150                                    symbol_get_addr(sym_def, dest);
     151                        } else {
     152                                printf("Source definition of '%s' not found.\n",
     153                                    str_tab + sym->st_name);
     154                                continue;
     155                        }
     156
    142157                        sym_size = sym->st_size;
    143158                        if (sym_size != sym_def->st_size) {
     
    147162                                        sym_size = sym_def->st_size;
    148163                        }
     164
    149165                        memcpy(r_ptr, (const void *)sym_addr, sym_size);
    150166                        break;
    151                        
     167
    152168                case R_386_RELATIVE:
    153169                        DPRINTF("fixup R_386_RELATIVE (b+a)\n");
Note: See TracChangeset for help on using the changeset viewer.