Added a private call to get the dependencies of a loaded image. This will be used
to determine linkage of libnet.so vs. libsocket.so/libbind.so in the libnetwork.so. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@19008 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
db893fd8d8
commit
7f4e6824df
@ -34,6 +34,8 @@ struct rld_export {
|
||||
int32 *nameLength, int32 *symbolType, void **_location);
|
||||
status_t (*test_executable)(const char *path, uid_t user, gid_t group,
|
||||
char *starter);
|
||||
status_t (*get_next_image_dependency)(image_id id, uint32 *cookie,
|
||||
const char **_name);
|
||||
|
||||
const struct uspace_program_args *program_args;
|
||||
};
|
||||
|
@ -7,13 +7,24 @@
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <image.h>
|
||||
|
||||
|
||||
struct uspace_program_args;
|
||||
struct real_time_data;
|
||||
|
||||
extern char _single_threaded;
|
||||
/* This determines if a process runs single threaded or not */
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
status_t __parse_invoke_line(char *invoker, char ***_newArgs,
|
||||
char * const **_oldArgs, int32 *_argCount);
|
||||
status_t __get_next_image_dependency(image_id id, uint32 *cookie,
|
||||
const char **_name);
|
||||
status_t __test_executable(const char *path, char *invoker);
|
||||
void __init_env(const struct uspace_program_args *args);
|
||||
void __init_heap(void);
|
||||
@ -22,9 +33,8 @@ void __init_time(void);
|
||||
void __arch_init_time(struct real_time_data *data, bool setDefaults);
|
||||
bigtime_t __arch_get_system_time_offset(struct real_time_data *data);
|
||||
|
||||
|
||||
extern char _single_threaded;
|
||||
/* This determines if a process runs single threaded or not */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* LIBROOT_PRIVATE_H */
|
||||
|
@ -182,6 +182,13 @@ __parse_invoke_line(char *invoker, char ***_newArgs,
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
__get_next_image_dependency(image_id id, uint32 *cookie, const char **_name)
|
||||
{
|
||||
return __gRuntimeLoader->get_next_image_dependency(id, cookie, _name);
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
__test_executable(const char *path, char *invoker)
|
||||
{
|
||||
|
@ -1419,6 +1419,37 @@ get_symbol(image_id imageID, char const *symbolName, int32 symbolType, void **_l
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
get_next_image_dependency(image_id id, uint32 *cookie, const char **_name)
|
||||
{
|
||||
image_t *image = find_loaded_image_by_id(id);
|
||||
uint32 i, j, searchIndex = *cookie;
|
||||
struct Elf32_Dyn *dynamicSection;
|
||||
|
||||
if (image == NULL)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
dynamicSection = (struct Elf32_Dyn *)image->dynamic_ptr;
|
||||
if (dynamicSection == NULL || image->num_needed <= searchIndex)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
||||
for (i = 0, j = 0; dynamicSection[i].d_tag != DT_NULL; i++) {
|
||||
if (dynamicSection[i].d_tag != DT_NEEDED)
|
||||
continue;
|
||||
|
||||
if (j++ == searchIndex) {
|
||||
int32 neededOffset = dynamicSection[i].d_un.d_val;
|
||||
|
||||
*_name = STRING(image, neededOffset);
|
||||
*cookie = searchIndex + 1;
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
}
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
|
||||
|
@ -49,13 +49,21 @@ export_test_executable(const char *path, uid_t user, gid_t group, char *starter)
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
export_get_next_image_dependency(image_id id, uint32 *cookie, const char **_name)
|
||||
{
|
||||
return get_next_image_dependency(id, cookie, _name);
|
||||
}
|
||||
|
||||
|
||||
struct rld_export gRuntimeLoader = {
|
||||
// dynamic loading support API
|
||||
export_load_add_on,
|
||||
export_unload_add_on,
|
||||
export_get_image_symbol,
|
||||
export_get_nth_image_symbol,
|
||||
export_test_executable
|
||||
export_test_executable,
|
||||
export_get_next_image_dependency
|
||||
};
|
||||
|
||||
|
||||
|
@ -34,6 +34,7 @@ status_t get_nth_symbol(image_id imageID, int32 num, char *nameBuffer, int32 *_n
|
||||
int32 *_type, void **_location);
|
||||
status_t get_symbol(image_id imageID, char const *symbolName, int32 symbolType,
|
||||
void **_location);
|
||||
status_t get_next_image_dependency(image_id id, uint32 *cookie, const char **_name);
|
||||
int resolve_symbol(image_t *image, struct Elf32_Sym *sym, addr_t *sym_addr);
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user