Commit Graph

1715 Commits

Author SHA1 Message Date
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
mycroft
1ad20cb78f Previous change was done wrong. 2002-09-24 18:23:14 +00:00
junyoung
d0e76e42b6 G/c dbg()'s. 2002-09-24 18:03:46 +00:00
junyoung
5afbf1cbce Make sure that dbg() is disabled if LD_DEBUG is not defined. Now
debugging is easier with RTLD_DEBUG_RELOC.
2002-09-24 17:51:11 +00:00
mycroft
64d3d6215a Ignore JMP_SLOT relocs when doing non-PLT relocations. The relalim trimming
hack doesn't always work, because ld(1) sometimes puts the sections in the
wrong order.
2002-09-24 15:04:48 +00:00
mycroft
bddb0d021d Similarly, remove support for short arguments. 2002-09-24 14:09:43 +00:00
mycroft
fa344ccc4b Remove quad support. We don't need it, and it wastes a lot of space. (It
pulls in {,u}{div,mod}di3() and qdivrem().)
2002-09-24 14:05:33 +00:00
mycroft
56288dc0e5 %ld -> %p 2002-09-24 13:59:31 +00:00
mycroft
fa5df29420 Include xassert() only if DEBUG, like the real assert().
Also, xassert() calls abort(), so there's no need to do it in all of the
callers.
2002-09-24 13:06:07 +00:00
mycroft
7f44855294 Remove the SVR4_LIBDIR madness. 2002-09-24 12:52:20 +00:00
mycroft
3c16ffb1dd Woops, unmap the first page in the `win' case, too.
Tidy up a bit.
2002-09-24 12:44:58 +00:00
mycroft
72b0e512c3 Change the comment about l_offs. 2002-09-24 12:18:32 +00:00