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
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
mycroft
9d8c69b929
Remove vestiges of VARPSZ.
2002-09-24 12:12:07 +00:00
junyoung
175c20cbcf
Nuke PAGESIZE.
2002-09-24 09:45:59 +00:00
junyoung
4b4a707c66
Use _rtld_pagesz instead of PAGESIZE.
2002-09-24 09:35:13 +00:00
junyoung
d190613fbb
space -> tab.
2002-09-24 09:26:43 +00:00
junyoung
93f2d9023a
Don't need to use union any longer.
2002-09-24 09:22:51 +00:00
junyoung
272e959468
Remove '\n' at the end of dbg strings.
2002-09-24 08:56:30 +00:00
junyoung
61e1361da6
END_SYM is no longer used.
2002-09-24 06:43:14 +00:00
mycroft
97aed9957d
-I${.CURDIR} is done at the top-level, so there's no need to do it here.
2002-09-24 01:59:44 +00:00
mycroft
b59c269424
Nuke reference to RTLD_RELOCATE_SELF.
2002-09-24 01:58:44 +00:00
mycroft
c3ece2a45f
Use/require AT_PAGESZ on all platforms. (The kernel has exported it for ~3
...
years now.) Use _rtld_pagesz instead of getpagesize() to determine the page
size in our local malloc(). Saves a system call.
Also, since we're now relocated early, we don't need to be careful to avoid
globals, so most of the VARPSZ hacks are eliminated.
2002-09-24 01:24:44 +00:00
mycroft
d1351c627c
Um, a little bit of sanity here:
...
l_addr is always supposed to be obj->relocbase -- or so says the GDB code that
uses it. So, set it to this on all platforms. It already was on VAX
explicitly, and on everything else except MIPS implicitly (because
mapbase==relocbase for all existing shlibs). For some silly/stupid reason, a
new field was created that the MIPS GDB currently uses.
Another MD #ifdef bites it.
2002-09-24 00:33:39 +00:00
mycroft
f1184d192e
Very minor cleanup of the previous.
2002-09-24 00:02:46 +00:00
mycroft
86103e2f0e
Several small changes that shave 7-8% off the simple-exec-loop test:
...
* Rename _rtld_find_library() to _rtld_load_library(). It now calls
_rtld_load_object() if necessary to actually load the object, rather
than having the caller do it. To do this, it also takes the `mode'
argument that gets passed to _rtld_load_object().
* On a related note, remove _rtld_check_library(), and instead call
_rtld_load_object() to instead try actually loading the object. We
save two extra namei's and a bunch of redundant work (almost
literally the same code) this way.
* In _rtld_map_object(), mmap(2) the first page read-only, rather than
read(2)ing it.
* In _rtld_symlook_obj(), compare the *second* character of the symbol
name before calling strcmp(). (This first character is too
frequently `_', and turns out to not be helpful, in libc.)
* Also in _rtld_symlook_obj(), remove the bogus STT_FUNC special case
-- this also allows removing the `in_plt' argument to
_rtld_symlook_list() and _rtld_symlook_obj().
Also:
* In _rtld_obj_from_addr(), rather than trying to look up `_end' in
the each object, instead use obj->mapsize as the upper bound.
2002-09-23 23:56:46 +00:00
mycroft
c3a2d8b7ba
Add combreloc code here too.
2002-09-21 17:51:44 +00:00
junyoung
930998f892
Print the name of dynamic linker actually loaded.
2002-09-21 05:24:17 +00:00
junyoung
48910dcfc1
Cosmetic changes (long lines).
2002-09-20 03:39:22 +00:00
junyoung
18139870a5
Cosmetic changes.
2002-09-19 14:05:37 +00:00
christos
6d0f752a65
don't core dump setting progname if argv[0] == NULL. From xs@kittenz.org
2002-09-19 13:59:46 +00:00
junyoung
a5390eb121
_rtld_setup_pltgot() belongs to reloc.c.
2002-09-18 07:35:40 +00:00
junyoung
9754fa4d8e
Make immediate binding work again by actually implementing
...
_rtld_relocate_plt_objects(). Note that this is for i386 only;
any efforts to make it work on other platforms are left to
those who are using them...
2002-09-17 07:29:46 +00:00
thorpej
7e6d181789
No PC24 relocs will ever be unaligned. Pointed out by mycroft.
2002-09-15 01:08:04 +00:00
thorpej
672853f217
It is possible for reloc entries to point to unaligned locations; handle
...
this.
2002-09-15 00:52:08 +00:00
thorpej
a2130a3a09
It is possible for reloc entries to point to unaligned locations; handle
...
this.
2002-09-14 23:53:21 +00:00
thorpej
b01748bb26
It is possible for reloc entries to point to unaligned locations; handle
...
this.
2002-09-14 23:21:13 +00:00
mycroft
a95d62a38e
In _rtld_bind_mips(), if the symbol is undefined, die.
2002-09-13 20:32:24 +00:00
mycroft
712b838f43
Kill the extra newline in assert messages.
2002-09-13 19:50:00 +00:00
mycroft
cc2b1e9844
Add an explanatory comment.
2002-09-13 19:27:19 +00:00
mycroft
e3db70741f
Turn DEBUG back on by default. It doesn't take much space.
2002-09-13 18:28:58 +00:00
mycroft
60330f4a69
The sense of the SHN_ABS test has always been reversed. Fortunately nobody
...
ever tried to reference stuff like _DYNAMIC_LINK and _gp_disp in C code...
2002-09-13 17:36:00 +00:00
mycroft
8f7fa0cfde
Put back the lazy binding. For some bizarre reason, the linker occasionally
...
does not create a PLT entry for a symbol, so we test st_value!=0 to see
whether we can do a PLT fixup.
2002-09-13 17:07:12 +00:00
mycroft
a8dd8878cf
Er, turn off lazy binding for the moment. It doesn't seem to be fully working.
2002-09-13 16:54:14 +00:00
mycroft
c1cf8538ec
Simplify the GOT relocation code somewhat.
2002-09-13 16:31:28 +00:00
mycroft
e8b2fe1d2a
Actually do lazy binding on this platform.
2002-09-13 16:03:20 +00:00
mycroft
89a39bb54e
The textrel special case is only needed for MIPS (due to a bug in BFD).
2002-09-13 15:27:30 +00:00
mycroft
7a962f974a
Kill the sparc64 argc conversion hack.
2002-09-13 14:23:07 +00:00
mycroft
a18c524897
Figure out obj->pltrel(a) after the dynamic section is parsed, so the relative
...
order of DT_PLTREL and DT_JMPREL is irrelevant. Removes the need for yet
another weird #ifdef.
Also, be slightly more careful with the rel(a)lim trimming.
2002-09-13 13:28:43 +00:00
mycroft
c74fdd7069
Use the addend on GLOB_DAT relocs (same as ABS32).
2002-09-13 05:45:46 +00:00
mycroft
c65330320a
Do not use the implicit addend on REFQUAD relocs (same as GLOB_DAT).
2002-09-13 05:45:13 +00:00
mycroft
daf8118731
Remove an old comment.
2002-09-13 04:09:49 +00:00
mycroft
2f59687514
Almost all of the items in here are done.
2002-09-13 04:05:00 +00:00
mycroft
777a2b8bb0
If we match a symbol name, but it's undefined, do not continue searching the
...
hash chain.
2002-09-13 03:40:40 +00:00
mycroft
bbe45a0623
Remove a dumb #ifdef -- if VARPSZ is not defined on sparc, the build will
...
bomb anyway.
2002-09-13 03:22:08 +00:00
mycroft
4de09f873b
Nuke an unneeded hack for the Alpha.
2002-09-13 03:17:21 +00:00
mycroft
807a6ace45
Nuke two frivolous assert()s.
2002-09-13 03:12:40 +00:00
mycroft
4b55da479c
_rtld_bind() is not used on MIPS. Should probably move it to MD code.
2002-09-13 03:09:38 +00:00
mycroft
f64e457cee
Remove one more `dodebug' argument.
2002-09-12 23:11:37 +00:00
mycroft
a3b892d178
Nuke -DRTLD_RELOCATE_SELF and `dodebug' from orbit.
2002-09-12 22:56:28 +00:00
mycroft
f13bdd9850
Add some consts.
2002-09-12 21:06:38 +00:00
mycroft
5ad776fbd2
Move another declaration that doesn't belong in MI source.
2002-09-12 20:27:34 +00:00
mycroft
de4565ee93
Prototype different functions.
2002-09-12 20:24:03 +00:00
mycroft
547bc13b97
_rtld_bind_start() is not used in MI code, so declare it in the MD code.
2002-09-12 20:20:58 +00:00
mycroft
bf04efbfda
ld.elf_so has no textrels on arm, i386 or vax -- and shouldn't on any platform,
...
but that's beside the point.
2002-09-12 19:43:03 +00:00
mycroft
6530c89689
Slight tweak.
2002-09-12 18:43:17 +00:00
mycroft
326f270bfb
The GOT is Elf_Addr[], not Elf_Word[]...
2002-09-12 18:36:43 +00:00
mycroft
6f0bda739f
This ld script is now unnecessary.
2002-09-12 18:33:39 +00:00
mycroft
1165ce6f38
Clean up a little.
2002-09-12 18:28:53 +00:00
mycroft
2346aaad04
Move GOT relocation code from _rtld_setup_pltgot() to
...
_rtld_relocate_nonplt_objects(). Add GOT self-relocation in
_rtld_relocate_nonplt_self().
MIPS ld.elf_so can now relocate itself.
2002-09-12 18:21:18 +00:00
mycroft
2b2534febf
Add a `relocbase' argument to _rtld() and _rtld_init(), which is passed in
...
from the glue code in _rtld_start(). This is used to set objself.relocbase,
rather than assuming that it's the same as objself.mapbase (or 0 on MIPS).
Now -- with a bug fix to the kernel -- ld.elf_so can be linked at any VMA.
2002-09-12 17:45:41 +00:00
mycroft
d04429c6a7
Figure out the relocation offset and pass it to _rtld().
2002-09-12 17:43:30 +00:00
mycroft
ebf50cdfbc
Update comments.
2002-09-12 17:18:37 +00:00
mycroft
ac81e3266b
Snapshot of work to make MIPS ld.elf_so relocatable.
2002-09-12 17:08:32 +00:00
mycroft
5ee0e5e1c4
Pass the calculated relocation offset down to _rtld().
2002-09-12 17:07:25 +00:00
bjh21
3cc5ae01bc
Correct somewhere where, in rev 1.3, two new sentences had been dropped
...
into the middle of an existing sentence, and put them after it instead.
2002-09-11 23:11:41 +00:00
mycroft
1da1ca49f2
Do the _rtld_relocate_nonplt_self() thing here, and nuke the ld script.
2002-09-11 22:28:32 +00:00
mycroft
fb69b8bec4
Implement _rtld_relocate_nonplt_self() here.
2002-09-11 21:14:08 +00:00
mycroft
a57ae642a3
We don't use _GLOBAL_OFFSET_TABLE_ any more, so don't .global it.
2002-09-11 20:56:09 +00:00
mycroft
fa0b5c37b2
This is a gratuitous null commit to force rtld.o to be rebuilt.
2002-09-11 20:48:21 +00:00
mycroft
f1725abea5
Add a _rtld_relocate_nonplt_self() here too.
2002-09-11 20:45:52 +00:00
mycroft
403e42f619
Do self-relocation similar to sparc.
2002-09-11 19:46:40 +00:00
mycroft
e46eb805f1
This ld script is no longer necessary.
2002-09-11 19:46:04 +00:00
mycroft
aa1330ce71
Do the _rtld_relocate_nonplt_self() thing for SPARC.
2002-09-11 19:11:05 +00:00
mycroft
82148aec74
The ld script is no longer necessary.
2002-09-11 18:20:47 +00:00
mycroft
d603bed369
Implement _rtld_relocate_nonplt_self() on Alpha.
2002-09-11 18:18:37 +00:00
mycroft
735f9f38c0
Split the `self' case out of _rtld_relocate_nonplt_objects, into a new function
...
_rtld_relocate_nonplt_self(), which is called from _rtld_start.
Now we're completely relocated before main() is called.
We also no longer need _GOT_END_, so junk the ld script.
This code assumes that ld.elf_so only contains RELATIVE relocs, but that's
supposed to be the case for -Bsymbolic anyway.
2002-09-11 17:23:23 +00:00
junyoung
b240241362
Add $NetBSD$.
2002-09-11 14:19:30 +00:00