0c85bd054e
the per-root-image breadth-first sorted image array. Instead we have a per-image hook function to resolve the symbols. The default function uses the sLoadedImages list directly, which is breadth-first sorted anyway. There's also a BeOS function for old-style symbol resolution and one for add-ons, which lacks a proper implementation yet (just uses old-style ATM). * Made the dl*() functions POSIX compliant: - dlopen() does no longer use load_add_on(), but loads the object as a library. It also properly supports a NULL name, now -- the previous "_APP_" work-around did only work, if this soname was set on the program (unlikely for programs using this API). - Implemented RTLD_{GLOBAL,LOCAL}. - dlsym() looks up symbols properly now, i.e. not just in the given image, but breadth-first for an actual image or in load order for the global scope. It also supports the not-quite POSIX RTLD_DEFAULT and RTLD_NEXT extensions. Our RTLD_NEXT finds more symbols than in Linux (also in later dlopen()ed libraries), but that should be fine. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28568 a95241bf-73f2-0310-859d-f6bbb57e9c96
68 lines
1.2 KiB
C
68 lines
1.2 KiB
C
/*
|
|
* Copyright 2003-2006, Axel Dörfler, axeld@pinc-software.de.
|
|
* Distributed under the terms of the MIT License.
|
|
*
|
|
* Copyright 2002, Manuel J. Petit. All rights reserved.
|
|
* Distributed under the terms of the NewOS License.
|
|
*/
|
|
|
|
|
|
#include "runtime_loader_private.h"
|
|
|
|
|
|
// exported via the rld_export structure in user space program arguments
|
|
|
|
|
|
static image_id
|
|
export_load_add_on(char const *name, uint32 flags)
|
|
{
|
|
void* handle;
|
|
return load_library(name, flags, true, &handle);
|
|
}
|
|
|
|
|
|
static status_t
|
|
export_unload_add_on(image_id id)
|
|
{
|
|
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);
|
|
}
|
|
|
|
|
|
struct rld_export gRuntimeLoader = {
|
|
// dynamic loading support API
|
|
export_load_add_on,
|
|
export_unload_add_on,
|
|
export_load_library,
|
|
export_unload_library,
|
|
get_symbol,
|
|
get_library_symbol,
|
|
get_nth_symbol,
|
|
test_executable,
|
|
get_next_image_dependency,
|
|
|
|
elf_reinit_after_fork,
|
|
NULL, // call_atexit_hooks_for_range
|
|
terminate_program
|
|
};
|
|
|
|
|
|
void
|
|
rldexport_init(void)
|
|
{
|
|
gRuntimeLoader.program_args = gProgramArgs;
|
|
}
|