Commit Graph

1726 Commits

Author SHA1 Message Date
junyoung a189aa3eba Store pathnames of shared objects not found in search paths in cache
and utilize it. This greatly reduces the number of calls to open(2) and
malloc(3) for programs like mozilla that depend on many shared objects
while it doesn't affect performance of small programs.
2002-10-01 14:16:53 +00:00
wiz d6285bbf1d Begin new sentences on new lines.
Patch from Robert Elz (kre at munnari oz au).
2002-09-29 14:05:52 +00:00
wiz b6e0393610 End .Bl with .El. While here, sort options and improve markup a bit. 2002-09-29 14:04:59 +00:00
wiz 560a739939 Remove some unneeded backslashes. 2002-09-29 13:57:57 +00:00
junyoung b615e15549 Call NEW() rather than CNEW(). 2002-09-28 05:00:27 +00:00
thorpej 09a0767aa9 Only use the MKDYNAMICROOT semantics (i.e. -rpath=/lib,/usr/lib and
-dynamic-linker=/libexec/ld.elf_so) if the BINDIR of the program being
built is /bin or /sbin.

The reason we do this is because now all programs *except* those in
/bin and /sbin (i.e. the "special cases") match the default the compiler
uses, which is what is used for things in e.g. xsrc, pkgsrc, and other
random 3rd party programs.

This is done by decoupling where a shlib is installed from how it
is located.  Two new variables, SHLIBINSTALLDIR and SHLINKINSTALLDIR,
contain the former information, and key off MKDYNAMICROOT only.  SHLIBDIR
and SHLINKDIR contain the latter, and key off MKDYNAMICROOT and BINDIR.

The SHLIBINSTALLDIR, SHLIBDIR, _LIBSODIR, SHLINKINSTALLDIR, and
SHLINKDIR parameters are moved to a new <bsd.shlib.mk>; see bsd.README
for usage details.
2002-09-27 21:37:50 +00:00
mycroft c5739d43db Change the munmap() of the text-data gap to mprotect(PROT_NONE). This avoids
having scattered little mappings, although it's probably not the best way...
2002-09-27 19:48:24 +00:00
mycroft 0a20e1e977 We don't need to save r7, either... 2002-09-27 03:46:12 +00:00
mycroft b95736d94a Put back the short-circuiting code -- Matt claims there are functions that rely
on it.
OTOH, don't bother saving r6 a second time.
2002-09-27 03:34:22 +00:00
mycroft 6d8d08304c 1) There is no reason to flush the I$ here, given that we do not modify any
instructions.  Function calls use GOT indirection, and we only patch the
   GOT.
2) The mask-comparison optimization always fails, because the saved mask
   always has 0x2000 set, and the PLT stub mask never does.  So, remove it.
2002-09-27 02:46:05 +00:00
mycroft 42fb5b53c2 Save one more instruction. 2002-09-27 02:14:38 +00:00
mycroft 06f9fa98b0 Save relocbase in %r10, not %r1.
Also, save one instruction.
2002-09-26 23:28:52 +00:00
mycroft d437f6520b Implement a self-relocate function for the VAX. 2002-09-26 22:26:26 +00:00
mycroft 1c495430dd Remove the `self' args to _rtld_relocate_objects() and
_rtld_relocate_nonplt_objects().
2002-09-26 20:42:10 +00:00
mycroft 7d4bbc7f4e Add an iffy heuristic that allows us to do lazy binding with new objects, but
detect old objects and deal with them.
2002-09-26 20:41:34 +00:00
mycroft 73a80999b7 Clean up _rtld_init() -- there is no need to avoid globals.
Remove the call to _rtld_relocate_objects() completely -- except on VAX, where
we TEMPORARILY call _rtld_relocate_nonplt_objects() directly.
Also add more assertions -- ld.elf_so should never have PLT relocations.
2002-09-26 20:35:56 +00:00
mycroft 5f24ee89f3 Don't bogusly set obj->pltrela{,lim} if there is no DT_PLTREL. 2002-09-26 20:27:50 +00:00
mycroft a217e118cd *poof*
-fomit-frame-pointer works on 68k.
2002-09-26 14:30:47 +00:00
mycroft 3e9c6b1044 -vomit-frame-pointer is buggy on 68k. *sigh* 2002-09-26 13:56:01 +00:00
mycroft 273d2b19b4 Hm, the const isn't going to work. 2002-09-26 13:43:52 +00:00
mycroft 00088c228c Do not attempt to free(_rtld_objself.path) -- it's a pointer into our data
segment.
2002-09-26 13:42:05 +00:00
mycroft f4f740de3a By default, compile without DEBUG, and with -fomit-frame-pointer. 2002-09-26 12:59:29 +00:00
mycroft 15025431b4 Update a comment. 2002-09-26 03:25:29 +00:00
mycroft fd7e0d92f3 Add a rdbg() in _rtld_bind(). 2002-09-26 02:52:05 +00:00
mycroft 723a5f8a50 Remove a meaningless bit from a rdbg(). 2002-09-26 02:51:27 +00:00
mycroft ee398b4d07 Remove vestigal comments about _rtld_bind_start_0() -- it works now. 2002-09-26 02:25:57 +00:00
mycroft 26043b23b0 Make room for the argument save area in _rtld_start(). The PLT stub already
made room from _rtld_bind_start(), but add a comment explaining the instruction
it uses.
2002-09-26 02:14:10 +00:00
mycroft f1c792d648 Make the stack frame 96 bytes, like GCC does. 2002-09-26 02:05:41 +00:00
mycroft bde7a965da Tweak the save instruction in the PLT stub rather than adding an instruction
to the binder entry stub...
2002-09-26 01:59:16 +00:00
mycroft d314d82b47 Allocate space for the argument space area in both _rtld_start() and
_rtld_bind_start().  Not needed normally, but if we compile ld.elf_so with
-g, it blows up without this.
2002-09-26 01:54:52 +00:00
mycroft 6bff9ffc3d For consistency, use Elf_Word* to point to code, not Elf_Addr*. 2002-09-25 22:33:54 +00:00
mycroft 0079455251 Add a comment explaining some of the magick. 2002-09-25 22:29:12 +00:00
mycroft f6db390b5a Fix a bug that caused PLT entries to effectively not be patched.
Also, fix more bugs in the large-PLT case -- my test program works now.
2002-09-25 22:25:11 +00:00
mycroft 2997d64776 Make this work with PLTs larger than 8192 entries (64KB). Not tested
exhaustively, but it works in some simple cases.
2002-09-25 21:11:18 +00:00
mycroft d4e6f3ff08 Swap registers %o0 and %o1 in the binder stub to say one instruction.
Fix an obvious bug in the 64-bit PLT fixup: the SLLX was by 12 bits, when it
should be 32.

Fix what *appear* to be two bugs in the >32768 PLT entry stub:
* One division was wrong (/14 rather than /24).
* We need to subtract 1048576 (to make the offset relative to the beginning of
  the upper section), not add it.
This path is still untested, and buggy.
2002-09-25 16:35:08 +00:00
mycroft 9e31b44846 There is no need to save and restore a second register window in the binder
stub.
2002-09-25 14:38:51 +00:00
mycroft afb1082706 _rtld_bind_start_0_stub() is not actually used. 2002-09-25 14:36:37 +00:00
mycroft 028dd5150a Push a multiple from _rtld_bind_start_[01]() to _rtld_bind(). 2002-09-25 14:35:39 +00:00
mycroft 23b2275ee8 Partly fix this port -- still needs a self-reloc function. 2002-09-25 08:37:57 +00:00
mycroft a9c999925c We don't need to save quite as many registers in the stub. 2002-09-25 08:00:26 +00:00
mycroft 729925dfb9 Push the _rtld_bind() interface into MD code -- it's just a trivial wrapper
anyway.
2002-09-25 07:27:49 +00:00
mycroft 305b0ffce5 #if defined -> #ifdef 2002-09-25 06:43:46 +00:00
itojun d80101c91c Allocate vis_user on the stack instead of using malloc(). This
way we don't have to worry about malloc() failure.  Also closes
a memory leak since vis_user was never free()d.  Lack of malloc()
checking pointed out by Peter Werner.
from openbsd
2002-09-25 04:57:59 +00:00
mycroft 896795d8a3 Minor cleanup, for clarity. 2002-09-25 03:57:15 +00:00
mycroft a3c903f7cb Resolve the GOT before doing relocations. Then, when doing relocations, for
symbols in the global part of the symbol table, use the updated GOT entry
rather than doing a lookup.  (This provides the same effect as `-z combreloc'
on other platforms -- at most one lookup is done per symbol.)

Unfortunately, it is necessary to turn off lazy binding on MIPS.  As the
comment says:

                         * XXX DANGER WILL ROBINSON!
                         * You might think this is stupid, as it intentionally
                         * defeats lazy binding -- and you'd be right.
                         * Unfortunately, for lazy binding to work right, we
                         * need to a way to force the GOT slots used for
                         * function pointers to be resolved immediately.  This
                         * is supposed to be done automatically by the linker,
                         * by not outputting a PLT slot and setting st_value
                         * to 0, but GNU ld does not do so reliably.
2002-09-25 03:52:06 +00:00
mycroft 646628d7fa DOH! Adjust all the stack slots in _rtld_bind_start() so that the saved $a0
is not in _rtld_bind_mips()'s $a3 argument save area.
2002-09-24 21:57:20 +00:00
mycroft fb3dfbb81b Add a comment about the function pointer nonsense. 2002-09-24 20:27:07 +00:00
mycroft 216a20fcc4 Put back the `in_plt' nonsense for now.
It turns out there is some deep-seated wackiness WRT function pointer
comparisons...
2002-09-24 20:23:11 +00:00
mycroft 9d1d2c30c8 Reverse the previous patch, but make the dbg()s more informative. 2002-09-24 18:28:42 +00:00
mycroft 8510028476 Touch up a little more -- some of the dbg()s never actually printed anything. 2002-09-24 18:25:54 +00:00