1 /* Copyright (C) 2001 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public
6 License as published by the Free Software Foundation; either
7 version 2.1 of the License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
14 You should have received a copy of the GNU Lesser General Public
15 License along with the GNU C Library; if not, write to the Free
16 Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
22 int __loadx(flag, module, arg1, arg2, arg3)
24 The __loadx() is a call to ld_loadutil() kernel function, which
25 does the real work. Note ld_loadutil() is not exported an cannot be
26 called directly from user space.
28 void *ld_loadutil() call is a utility function used for loader extensions
29 supporting run-time linking and dl*() functions.
31 void * - will return the modules entry point if it succeds of NULL
34 int flag - the flag field performas a dual role: the top 8 bits specify
35 the work for __loadx() to perform, the bottom 8 bits are
36 used to pass flags to the work routines, all other bits are
41 #define DL_LOAD 0x1000000 /* __loadx(flag,buf, buf_len, filename, libr_path) */
42 #define DL_POSTLOADQ 0x2000000 /* __loadx(flag,buf, buf_len, module_handle) */
43 #define DL_EXECQ 0x3000000 /* __loadx(flag,buf, buf_len) */
44 #define DL_EXITQ 0x4000000 /* __loadx(flag,buf, buf_len) */
45 #define DL_PREUNLOADQ 0x5000000 /* __loadx(flag,buf, buf_len, module_handle) */
46 #define DL_INIT 0x6000000 /* __loadx(flag,NULL) */
47 #define DL_GETSYM 0x7000000 /* __loadx(flag,symbol, index, modules_data_origin) */
48 #define DL_SETDEPEND 0x8000000 /* __loadx(flag,import_data_org, import_index, */
49 /* export_data_org, export_index) */
50 #define DL_DELDEPEND 0x9000000 /* __loadx(flag,import_data_org, import_index, */
51 /* export_data_org, export_index) */
52 #define DL_GLOBALSYM 0xA000000 /* __loadx(flag,symbol_name, ptr_to_rec_index, */
53 /* ptr_to_rec_data_org) */
54 #define DL_UNIX_SYSCALL 0xB000000 /* __loadx(flag,syscall_symbol_name) */
56 #define DL_FUNCTION_MASK 0xFF000000
57 #define DL_SRCHDEPENDS 0x00100000
58 #define DL_SRCHMODULE 0x00080000
59 #define DL_SRCHLOADLIST 0x00040000
60 #define DL_LOAD_LDX1 0x00040000
61 #define DL_LOAD_RTL 0x00020000
62 #define DL_HASHSTRING 0x00020000
63 #define DL_INFO_OK 0x00010000
64 #define DL_LOAD_DLINFO 0x00010000
65 #define DL_UNLOADED 0x00020000
67 typedef union _dl_info
70 uint _xflags
; /* flag bits in the array */
71 uint _size
; /* size of this structure */
72 uint _arraylen
; /* number of following elements */
75 caddr_t _textorg
; /* start of loaded program image */
76 caddr_t _dataorg
; /* start of data instance */
77 uint _datasize
; /* size of data instance */
78 ushort _index
; /* index of this le in la_dynlist */
79 ushort _mflags
; /* info about module from load() */
83 #define dlinfo_xflags _dl_stat._xflags
84 #define dlinfo_arraylen _dl_stat._arraylen
85 #define dlinfo_size _dl_stat._size
87 #define dlinfo_textorg _dl_array._textorg
88 #define dlinfo_datasize _dl_array._datasize
89 #define dlinfo_dataorg _dl_array._dataorg
90 #define dlinfo_index _dl_array._index
91 #define dlinfo_flags _dl_array._mflags
93 #define DL_HAS_RTINIT 0x1 /* indicates the module __rtinit symbols */
94 #define DL_IS_NEW 0x2 /* indicates that the module is newly loaded */
103 /* Shared Object DATA used for dl-open,dl-sym & dl-close support */
106 void *handle
; /* handle for __loadx */
107 uint type
; /* type of __loadx flag */
108 ushort index
; /* dlinfo_index */
109 caddr_t dataorg
; /* dlinfo_dataorg */