RLD(1) RISC/os Reference Manual RLD(1)
NAME
rld - MIPS runtime linker
DESCRIPTION
rld, the MIPS runtime linker, runs on MIPS machines under
RICS/os. It is invoked when running a dynamic executable.
It maps in shared objects used by this executable, resolves
relocations as ld does at static link time, and allocates
common if required.
Crt1.o is the startup object linked with all programs using
the MIPS compiler. It will either use the name /lib/rld for
the runtime linker, or, if set, the contents of the environ-
ment variable RLDPATH, to find the rld object and execmap
rld.
Rld will construct an explicit shared object list. If the
environment variable RLDLIST is set, it overrides the
dynamic executable's list. The user may include DEFAULT in
_RLD_LIST to include the executable's list and just add
before or after it. If you want to insert into it, you must
include the full object list in _RLD_LIST. The object list
is specified as a colon (:) seperated list of objects and
libraries.
The user can override the normal library search paths
(/lib:/lib/cmplrs/cc: /usr/lib:/usr/lib/cmplrs/cc) by using
either the environment variable LDLIBRARYPATH or
RLDROOT.
The search path for shared objects is acquired in the fol-
lowing order:
1) the path of the shared object if given in the liblist,
2) RPATH if it is defined in the main executable,
3) LD_LIBRARY_PATH if defined
4) default path
(/lib:/lib/cmplrs/cc:/usr/lib:/usr/lib:/usr/lib/cmplrs/cc)
if _RLD_ROOT is defined, then it is appended to the front of
RPATH and the default path. _RLD_ROOT itself is also a
colon(:) seperated list.
To ensure compatibility, applications may choose to disallow
exectime or runtime library replacement. The linktime
loader will support a flag, -no_library_replacement, to
facilitate this feature.
Security also dictates that RLD should not allow library
replacement for setuid and setgid programs unless the user
is root.
Printed 11/19/92 Page 1
RLD(1) RISC/os Reference Manual RLD(1)
System deveoper's interface
RLD keeps a doubly linked list of structures and crt1.o con-
tains a pointer to the head of the list of obj structures
called __rld_obj_head .
Runtime linker entry points
RLD enters through crt1 and lazy_text_resolve. Before exit-
ing, programs or objects need to call _rld_new_interface or
_rld_interface (as in the old user to ensure that the pro-
gram executes all of the ".fini" sections for all of the
shared objects. Crt1 and _exit(2) library routines will
call _rld_new_interface(_SHUT_DOWN) or
_rld_interface(_SHUT_DOWN).
New default user entry points
void *rldnewinterface(Elf32Word operation, ...)
where
if (operation == _SHUT_DOWN) then
user should use
(int)_rld_new_interface(_SHUT_DOWN)
if (operation == _RLD_FIRST_PATHNAME) then
user should use (char
*)_rld_new_interface(_RLD_FIRST_PATHNAME)
if (operation == _RLD_NEXT_PATHNAME) then
user should use (char
*)_rld_new_interface(_RLD_NEXT_PATHNAME)
if (operation == _RLD_MODIFY_LIST) then
user should use (char
*)_rld_new_interface(_RLD_MODIFY_LIST, Elf32_Word
operation, char *original_pathname, char *name)
if (operation == _RLD_ADDR_TO_NAME) then
user should use (char
*)_rld_new_interface(_RLD_ADDR_TO_NAME, Elf32_Addr
address)
if (operation == _RLD_NAME_TO_ADDR) then
user should use
(Elf32_Addr)_rld_new_interface(_RLD_NAME_TO_ADDR, char
*name)
Notice the casting in the return value for
_rld_new_interface, if the user don't do the casting, a cfe
warning will be generated.
Old Rld user entry points (invoked
(char *) rldfirstpathname()
returns the string "MAIN" and resets an internal
pointer inside of rld.
Page 2 Printed 11/19/92
RLD(1) RISC/os Reference Manual RLD(1)
(char *) rldnextpathname()
returns the next pathanme in rld's object list and
increments its internal pointer. It returns NULL when
rld reaches the end of the list.
(char *) rldmodifylist(
Elf32_Word operation,
char *orig_pathname,
char *name
)
where operation ==
#define _RLD_OP_NONE 0 /* nop */
#define _RLD_OP_INSERT 1 /* insert new object
'name' before */
/* 'orig_pathname' */
#define _RLD_OP_ADD 2 /* add new object
'name' after */
/* 'orig_pathname', if
'orig_pathname' */
/* is omitted, new object will
be */
/* added at the end of the
list */
#define _RLD_OP_DELETE 3 /* delete 'orig_pathname'
from the list */
#define _RLD_OP_REPLACE 4 /* replace
'orig_pathname' with new */
/* object 'name' */
allows users to link and unlink objects. When users
insert or add an object, they must specify the new
object in name. They may specify a full path or take
advantage of rld's searching mechanism. Users may not
insert before MAIN. If the orig_pathname is zero, rld
will operate on the last element in the list.
(Elf32Addr) rldnametoaddress( char *name)
returns actaul address of 'name', NULL if rld cannot
find the passed argument.
(Elf32Addr) rldaddresstoname( Elf32Addr addr)
returns the symbol name of the address passed in as
argument, NULL if rld cannot find it.
Note that if the users want to use any of the above rld
interface routines, they have to include the file
<rld_interface.h> in their programs.
Rld options
Printed 11/19/92 Page 3
RLD(1) RISC/os Reference Manual RLD(1)
Users may specify runtime linker options by setting the
_RLD_ARGS environment variable to any combination of the
following options:
-clearstack
For programs that assume local variable to be initial-
ized to zero upon entry, this option forces rld to zero
any stack it uses before returning to user code.
-ignoreallversions
ignore versions on all objects.
-ignoreversion sharedobject
ignore the version stamp checking on the object speci-
fied.
-ignoreunresolved
doesn't complain or abort when rld can't resolve
unresolved data symbols.
-interact
rld interactively prompts the user on stdin to fix
problems in the link (e.g. rld will ask the user to
provide a full pathname for a missing shared object.)
-log file
prints all messages to a log file instead of standard
output.
-pixie
includes rld in the pixie statistics (see pixie man
page for more info on how to profile shared objects
with or without rld statistics.)
-stat
prints rld statistics to stdout.
-trace
prints all actions done for the user by rld.
-v prints general actions (less verbose than -trace.)
-oldinterface
Use the old user entry points to rld.
See also ABI-mips supplement
Page 4 Printed 11/19/92