Changes in uspace/lib/c/generic/rtld/symbol.c [9d58539:17341d4] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/generic/rtld/symbol.c
r9d58539 r17341d4 39 39 40 40 #include <elf/elf.h> 41 #include <rtld/module.h> 41 42 #include <rtld/rtld.h> 42 43 #include <rtld/rtld_debug.h> … … 111 112 * @param name Name of the symbol to search for. 112 113 * @param start Module in which to start the search.. 114 * @param flags @c ssf_none or @c ssf_noroot to not look for the symbol 115 * in @a start 113 116 * @param mod (output) Will be filled with a pointer to the module 114 117 * that contains the symbol. 115 118 */ 116 elf_symbol_t *symbol_bfs_find(const char *name, module_t *start, module_t **mod) 119 elf_symbol_t *symbol_bfs_find(const char *name, module_t *start, 120 symbol_search_flags_t flags, module_t **mod) 117 121 { 118 122 module_t *m, *dm; … … 129 133 130 134 /* Mark all vertices (modules) as unvisited */ 131 modules_untag( );135 modules_untag(start->rtld); 132 136 133 137 /* Insert root (the program) into the queue and tag it */ … … 145 149 list_remove(&m->queue_link); 146 150 147 s = def_find_in_module(name, m); 148 if (s != NULL) { 149 /* Symbol found */ 150 sym = s; 151 *mod = m; 152 break; 151 /* If ssf_noroot is specified, do not look in start module */ 152 if (m != start || (flags & ssf_noroot) == 0) { 153 s = def_find_in_module(name, m); 154 if (s != NULL) { 155 /* Symbol found */ 156 sym = s; 157 *mod = m; 158 break; 159 } 153 160 } 154 161 … … 179 186 180 187 181 /** Find the definition of a symbol. .188 /** Find the definition of a symbol. 182 189 * 183 190 * By definition in System V ABI, if module origin has the flag DT_SYMBOLIC, … … 188 195 * @param name Name of the symbol to search for. 189 196 * @param origin Module in which the dependency originates. 197 * @param flags @c ssf_none or @c ssf_noroot to not look for the symbol 198 * in the executable program. 190 199 * @param mod (output) Will be filled with a pointer to the module 191 200 * that contains the symbol. 192 201 */ 193 elf_symbol_t *symbol_def_find(const char *name, module_t *origin, module_t **mod) 202 elf_symbol_t *symbol_def_find(const char *name, module_t *origin, 203 symbol_search_flags_t flags, module_t **mod) 194 204 { 195 205 elf_symbol_t *s; … … 210 220 /* Not DT_SYMBOLIC or no match. Now try other locations. */ 211 221 212 if ( runtime_env->program) {222 if (origin->rtld->program) { 213 223 /* Program is dynamic -- start with program as root. */ 214 return symbol_bfs_find(name, runtime_env->program, mod);224 return symbol_bfs_find(name, origin->rtld->program, flags, mod); 215 225 } else { 216 226 /* Program is static -- start with @a origin as root. */ 217 return symbol_bfs_find(name, origin, mod);227 return symbol_bfs_find(name, origin, ssf_none, mod); 218 228 } 219 229 }
Note:
See TracChangeset
for help on using the changeset viewer.