2 * Copyright 2003-2011, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
5 * Copyright 2002, Manuel J. Petit. All rights reserved.
6 * Distributed under the terms of the NewOS License.
10 #include "runtime_loader_private.h"
14 // exported via the rld_export structure in user space program arguments
18 export_load_add_on(char const *name
, uint32 flags
)
21 return load_library(name
, flags
, true, &handle
);
26 export_unload_add_on(image_id id
)
28 return unload_library(NULL
, id
, true);
33 export_load_library(char const *name
, uint32 flags
, void **_handle
)
35 return load_library(name
, flags
, false, _handle
);
40 export_unload_library(void* handle
)
42 return unload_library(handle
, -1, false);
46 struct rld_export gRuntimeLoader
= {
47 // dynamic loading support API
51 export_unload_library
,
55 get_nearest_symbol_at_address
,
57 get_executable_architecture
,
58 get_next_image_dependency
,
62 elf_reinit_after_fork
,
63 NULL
, // call_atexit_hooks_for_range
66 // the following values will be set later
68 NULL
, // commpage_address
72 rld_export
* __gRuntimeLoader
= &gRuntimeLoader
;
78 gRuntimeLoader
.program_args
= gProgramArgs
;
79 gRuntimeLoader
.commpage_address
= __gCommPageAddress
;
83 /*! Is called for all images, and sets the minimum ABI version found to the
84 gRuntimeLoader.abi_version field.
87 set_abi_version(int abi_version
)
89 if (gRuntimeLoader
.abi_version
== 0
90 || gRuntimeLoader
.abi_version
> abi_version
) {
91 gRuntimeLoader
.abi_version
= abi_version
;