Changeset 04803bf in mainline for uspace/lib/c/rtld


Ignore:
Timestamp:
2011-03-21T22:00:17Z (15 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
143932e3
Parents:
b50b5af2 (diff), 7308e84 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes (needs fixes).

Location:
uspace/lib/c/rtld
Files:
26 moved

Legend:

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

    rb50b5af2 r04803bf  
    5555void rel_table_process(module_t *m, elf_rel_t *rt, size_t rt_size)
    5656{
    57         int i;
     57        unsigned i;
    5858
    5959        size_t rt_entries;
     
    6262        unsigned rel_type;
    6363        elf_word sym_idx;
    64         uintptr_t sym_addr;
     64        uint32_t sym_addr;
    6565       
    6666        elf_symbol_t *sym_table;
     
    104104//                      DPRINTF("dest bias: 0x%x\n", dest->bias);
    105105                        if (sym_def) {
    106                                 sym_addr = symbol_get_addr(sym_def, dest);
     106                                sym_addr = (uint32_t)
     107                                    symbol_get_addr(sym_def, dest);
    107108//                              DPRINTF("symbol definition found, addr=0x%x\n", sym_addr);
    108109                        } else {
     
    111112                                continue;
    112113                        }
     114                } else {
     115                        sym_addr = 0;
     116                        sym_def = NULL;
    113117                }
    114118
  • uspace/lib/c/rtld/dynamic.c

    rb50b5af2 r04803bf  
    3636
    3737#include <stdio.h>
    38 #include <string.h>
     38//#include <string.h>
    3939
    4040#include <elf_dyn.h>
  • uspace/lib/c/rtld/include/dynamic.h

    rb50b5af2 r04803bf  
    7979        size_t sym_ent;
    8080
    81         void *init;     /**< Module initialization code */
    82         void *fini;     /**< Module cleanup code */
     81        void *init;             /**< Module initialization code */
     82        void *fini;             /**< Module cleanup code */
    8383
    84         char *soname;   /**< Library identifier */
    85         char *rpath;    /**< Library search path list */
     84        const char *soname;     /**< Library identifier */
     85        char *rpath;            /**< Library search path list */
    8686
    8787        bool symbolic;
  • uspace/lib/c/rtld/include/module.h

    rb50b5af2 r04803bf  
    6262
    6363void module_process_relocs(module_t *m);
    64 module_t *module_find(char *name);
    65 module_t *module_load(char *name);
     64module_t *module_find(const char *name);
     65module_t *module_load(const char *name);
    6666void module_load_deps(module_t *m);
    6767
  • uspace/lib/c/rtld/include/symbol.h

    rb50b5af2 r04803bf  
    3939#include <elf.h>
    4040
    41 elf_symbol_t *symbol_bfs_find(char *name, module_t *start, module_t **mod);
    42 elf_symbol_t *symbol_def_find(char *name, module_t *origin, module_t **mod);
    43 uintptr_t symbol_get_addr(elf_symbol_t *sym, module_t *m);
     41elf_symbol_t *symbol_bfs_find(const char *name, module_t *start, module_t **mod);
     42elf_symbol_t *symbol_def_find(const char *name, module_t *origin, module_t **mod);
     43void *symbol_get_addr(elf_symbol_t *sym, module_t *m);
    4444
    4545#endif
  • uspace/lib/c/rtld/module.c

    rb50b5af2 r04803bf  
    9090 * path components are ignored.
    9191 */
    92 module_t *module_find(char *name)
     92module_t *module_find(const char *name)
    9393{
    9494        link_t *head = &runtime_env->modules_head;
     
    9696        link_t *cur;
    9797        module_t *m;
    98         char *p, *soname;
     98        const char *p, *soname;
    9999
    100100        /*
     
    123123 * Currently this trivially tries to load '/<name>'.
    124124 */
    125 module_t *module_load(char *name)
     125module_t *module_load(const char *name)
    126126{
    127127        elf_info_t info;
  • uspace/lib/c/rtld/symbol.c

    rb50b5af2 r04803bf  
    3737#include <stdio.h>
    3838#include <stdlib.h>
    39 #include <string.h>
     39//#include <string.h>
    4040
    4141#include <rtld.h>
     
    6060}
    6161
    62 static elf_symbol_t *def_find_in_module(char *name, module_t *m)
     62static elf_symbol_t *def_find_in_module(const char *name, module_t *m)
    6363{
    6464        elf_symbol_t *sym_table;
     
    114114 *                      that contains the symbol.
    115115 */
    116 elf_symbol_t *symbol_bfs_find(char *name, module_t *start, module_t **mod)
     116elf_symbol_t *symbol_bfs_find(const char *name, module_t *start, module_t **mod)
    117117{
    118118        module_t *m, *dm;
     
    191191 *                      that contains the symbol.
    192192 */
    193 elf_symbol_t *symbol_def_find(char *name, module_t *origin, module_t **mod)
    194 {
    195         module_t *m, *dm;
    196         elf_symbol_t *sym, *s;
    197         link_t queue_head;
    198         size_t i;
     193elf_symbol_t *symbol_def_find(const char *name, module_t *origin, module_t **mod)
     194{
     195        elf_symbol_t *s;
    199196
    200197        if (origin->dyn.symbolic) {
     
    216213                /* Program is dynamic -- start with program as root. */
    217214                return symbol_bfs_find(name, runtime_env->program, mod);
    218         } else {       
     215        } else {
    219216                /* Program is static -- start with @a origin as root. */
    220217                return symbol_bfs_find(name, origin, mod);
     
    222219}
    223220
    224 uintptr_t symbol_get_addr(elf_symbol_t *sym, module_t *m)
     221void *symbol_get_addr(elf_symbol_t *sym, module_t *m)
    225222{
    226223        if (sym->st_shndx == SHN_ABS) {
    227224                /* Do not add bias to absolute symbols */
    228                 return sym->st_value;
     225                return (void *) sym->st_value;
    229226        } else {
    230                 return sym->st_value + m->bias;
     227                return (void *) (sym->st_value + m->bias);
    231228        }
    232229}
Note: See TracChangeset for help on using the changeset viewer.