Changeset 0f792c28 in mainline for uspace/lib/c/generic/rtld/symbol.c


Ignore:
Timestamp:
2016-04-12T16:59:41Z (9 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/generic/rtld/symbol.c

    r3b0f1b9a r0f792c28  
    111111 * @param name          Name of the symbol to search for.
    112112 * @param start         Module in which to start the search..
     113 * @param flags         @c ssf_none or @c ssf_noroot to not look for the symbol
     114 *                      in @a start
    113115 * @param mod           (output) Will be filled with a pointer to the module
    114116 *                      that contains the symbol.
    115117 */
    116 elf_symbol_t *symbol_bfs_find(const char *name, module_t *start, module_t **mod)
     118elf_symbol_t *symbol_bfs_find(const char *name, module_t *start,
     119    symbol_search_flags_t flags, module_t **mod)
    117120{
    118121        module_t *m, *dm;
     
    145148                list_remove(&m->queue_link);
    146149
    147                 s = def_find_in_module(name, m);
    148                 if (s != NULL) {
    149                         /* Symbol found */
    150                         sym = s;
    151                         *mod = m;
    152                         break;
     150                /* If ssf_noroot is specified, do not look in start module */
     151                if (m != start || (flags & ssf_noroot) == 0) {
     152                        s = def_find_in_module(name, m);
     153                        if (s != NULL) {
     154                                /* Symbol found */
     155                                sym = s;
     156                                *mod = m;
     157                                break;
     158                        }
    153159                }
    154160
     
    179185
    180186
    181 /** Find the definition of a symbol..
     187/** Find the definition of a symbol.
    182188 *
    183189 * By definition in System V ABI, if module origin has the flag DT_SYMBOLIC,
     
    188194 * @param name          Name of the symbol to search for.
    189195 * @param origin        Module in which the dependency originates.
     196 * @param flags         @c ssf_none or @c ssf_noroot to not look for the symbol
     197 *                      in the executable program.
    190198 * @param mod           (output) Will be filled with a pointer to the module
    191199 *                      that contains the symbol.
    192200 */
    193 elf_symbol_t *symbol_def_find(const char *name, module_t *origin, module_t **mod)
     201elf_symbol_t *symbol_def_find(const char *name, module_t *origin,
     202    symbol_search_flags_t flags, module_t **mod)
    194203{
    195204        elf_symbol_t *s;
     
    212221        if (runtime_env->program) {
    213222                /* Program is dynamic -- start with program as root. */
    214                 return symbol_bfs_find(name, runtime_env->program, mod);
     223                return symbol_bfs_find(name, runtime_env->program, flags, mod);
    215224        } else {
    216225                /* Program is static -- start with @a origin as root. */
    217                 return symbol_bfs_find(name, origin, mod);
     226                return symbol_bfs_find(name, origin, ssf_none, mod);
    218227        }
    219228}
Note: See TracChangeset for help on using the changeset viewer.