1995-04-03 20:49:14 +00:00
|
|
|
/*
|
|
|
|
hpux-load - Definitions and translations for dynamic loading with HP-UX
|
|
|
|
|
1998-10-06 20:06:01 +00:00
|
|
|
Copyright (C) 1995, Free Software Foundation
|
1995-04-03 20:49:14 +00:00
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __hpux_load_h_INCLUDE
|
|
|
|
#define __hpux_load_h_INCLUDE
|
|
|
|
|
|
|
|
#include <dl.h>
|
|
|
|
|
1998-10-06 20:06:01 +00:00
|
|
|
/* This is the GNU name for the CTOR list */
|
|
|
|
#define CTOR_LIST "__CTOR_LIST__"
|
|
|
|
|
1995-08-02 16:37:09 +00:00
|
|
|
/* link flags */
|
|
|
|
#define LINK_FLAGS (BIND_IMMEDIATE | BIND_VERBOSE)
|
|
|
|
|
1995-04-03 20:49:14 +00:00
|
|
|
/* Types defined appropriately for the dynamic linker */
|
|
|
|
typedef shl_t dl_handle_t;
|
|
|
|
typedef void* dl_symbol_t;
|
|
|
|
|
|
|
|
/* Do any initialization necessary. Return 0 on success (or
|
|
|
|
if no initialization needed.
|
|
|
|
*/
|
|
|
|
static int
|
|
|
|
__objc_dynamic_init(const char* exec_path)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Link in the module given by the name 'module'. Return a handle which can
|
|
|
|
be used to get information about the loded code.
|
|
|
|
*/
|
|
|
|
static dl_handle_t
|
|
|
|
__objc_dynamic_link(const char* module, int mode, const char* debug_file)
|
|
|
|
{
|
1995-08-02 16:37:09 +00:00
|
|
|
return (dl_handle_t)shl_load(module, LINK_FLAGS, 0L);
|
1995-04-03 20:49:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Return the address of a symbol given by the name 'symbol' from the module
|
2003-07-28 17:09:28 +00:00
|
|
|
* associated with 'handle'
|
|
|
|
* This function is not always used, so we mark it as unused to avoid warnings.
|
|
|
|
*/
|
|
|
|
static dl_symbol_t
|
|
|
|
__objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
|
|
|
|
__attribute__((unused));
|
1995-04-03 20:49:14 +00:00
|
|
|
static dl_symbol_t
|
|
|
|
__objc_dynamic_find_symbol(dl_handle_t handle, const char* symbol)
|
|
|
|
{
|
|
|
|
int ok;
|
|
|
|
void *value;
|
1995-08-02 16:37:09 +00:00
|
|
|
ok = shl_findsym(&handle, symbol, TYPE_UNDEFINED, value);
|
|
|
|
if (ok != 0)
|
|
|
|
value = 0;
|
1995-04-03 20:49:14 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* remove the code from memory associated with the module 'handle' */
|
|
|
|
static int
|
|
|
|
__objc_dynamic_unlink(dl_handle_t handle)
|
|
|
|
{
|
|
|
|
return shl_unload(handle);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Print an error message (prefaced by 'error_string') relevant to the
|
|
|
|
last error encountered
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
__objc_dynamic_error(FILE *error_stream, const char *error_string)
|
|
|
|
{
|
|
|
|
fprintf(error_stream, "%s\n", error_string);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Debugging: define these if they are available */
|
|
|
|
static int
|
|
|
|
__objc_dynamic_undefined_symbol_count(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char**
|
|
|
|
__objc_dynamic_list_undefined_symbols(void)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2000-10-28 21:58:48 +00:00
|
|
|
// TODO: search for an hp-ux equivalent of dladdr() */
|
|
|
|
static char *
|
|
|
|
__objc_dynamic_get_symbol_path(dl_handle_t handle, dl_symbol_t symbol)
|
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
1995-08-02 16:37:09 +00:00
|
|
|
#endif /* __hpux_load_h_INCLUDE */
|