2003-01-12 19:37:40 +03:00
|
|
|
/*
|
2006-03-30 20:29:53 +04:00
|
|
|
* Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de.
|
2005-03-14 03:53:59 +03:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*
|
|
|
|
* Copyright 2002, Manuel J. Petit. All rights reserved.
|
|
|
|
* Distributed under the terms of the NewOS License.
|
|
|
|
*/
|
|
|
|
|
2003-01-12 19:37:40 +03:00
|
|
|
|
2006-03-30 20:29:53 +04:00
|
|
|
#include "runtime_loader_private.h"
|
2003-01-12 19:37:40 +03:00
|
|
|
|
|
|
|
|
|
|
|
// exported via the rld_export structure in user space program arguments
|
|
|
|
|
|
|
|
|
|
|
|
static image_id
|
|
|
|
export_load_add_on(char const *name, uint32 flags)
|
|
|
|
{
|
2008-11-09 01:40:56 +03:00
|
|
|
void* handle;
|
|
|
|
return load_library(name, flags, true, &handle);
|
2003-01-12 19:37:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static status_t
|
|
|
|
export_unload_add_on(image_id id)
|
|
|
|
{
|
2008-11-09 01:40:56 +03:00
|
|
|
return unload_library(NULL, id, true);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static image_id
|
|
|
|
export_load_library(char const *name, uint32 flags, void **_handle)
|
|
|
|
{
|
|
|
|
return load_library(name, flags, false, _handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static status_t
|
|
|
|
export_unload_library(void* handle)
|
|
|
|
{
|
|
|
|
return unload_library(handle, -1, false);
|
2003-01-12 19:37:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-01-06 06:48:11 +03:00
|
|
|
struct rld_export gRuntimeLoader = {
|
|
|
|
// dynamic loading support API
|
|
|
|
export_load_add_on,
|
|
|
|
export_unload_add_on,
|
2008-11-09 01:40:56 +03:00
|
|
|
export_load_library,
|
|
|
|
export_unload_library,
|
2006-10-06 15:46:23 +04:00
|
|
|
get_symbol,
|
2008-11-09 01:40:56 +03:00
|
|
|
get_library_symbol,
|
2006-10-06 15:46:23 +04:00
|
|
|
get_nth_symbol,
|
|
|
|
test_executable,
|
2007-08-11 04:14:26 +04:00
|
|
|
get_next_image_dependency,
|
|
|
|
|
2008-01-13 15:08:34 +03:00
|
|
|
elf_reinit_after_fork,
|
2008-10-12 16:26:27 +04:00
|
|
|
NULL, // call_atexit_hooks_for_range
|
|
|
|
terminate_program
|
2006-01-06 06:48:11 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
void
|
2005-06-14 15:23:29 +04:00
|
|
|
rldexport_init(void)
|
2003-01-12 19:37:40 +03:00
|
|
|
{
|
2006-01-06 06:48:11 +03:00
|
|
|
gRuntimeLoader.program_args = gProgramArgs;
|
2003-01-12 19:37:40 +03:00
|
|
|
}
|