Commit Graph

94 Commits

Author SHA1 Message Date
skrll 5f0dd3a852 Add support for immediate PLT binding on SH5. Compile tested only as
shared libs don't actually work on SH5 (yet).

OK'd by Steve Woodford.
2005-07-28 12:35:21 +00:00
skrll 57e00bf69e Support immediate PLT binding on powerpc. Thanks to Simon Burge for
testing.

I can see the finish line...
2005-07-28 10:54:30 +00:00
skrll 56d4febf60 Support immediate PLT binding on m68k. Tested on NetBSD/sun3 using the new
version of tme.

Not far now...
2005-07-26 15:43:34 +00:00
skrll 51c5e03c82 Support immediate PLT binding on vax. Tested on simh.
Nearly there...
2005-07-24 08:02:23 +00:00
skrll 16044f3d38 Support immediate binding on x86_64.
Closes PR 30570. Thanks to TAMURA Kent for testing.
2005-07-17 05:57:21 +00:00
skrll 9c5ec319c5 Support LD_BIND_NOW on sh3.. 2005-05-31 19:30:38 +00:00
skrll 13901ecdef Support LD_BIND_NOW for alpha. 2005-05-25 13:39:46 +00:00
martin 0a1196da3e Add LD_BIND_NOW support for sparc and remove some relocation types that
are not supposed to happen in 32bit code.
From Nick Hudson.
2005-01-09 14:58:15 +00:00
martin 35130888e4 Add LD_BIND_NOW support for sparc64. 2005-01-05 09:16:03 +00:00
skrll 2728318e3c Add __RCSIDs.
OK'd by mycroft.
2004-10-22 05:39:56 +00:00
petrov 1ee4832b70 Don't print relocated content (in DEBUG mode) as it can cause
misaligned access. It needs to be done differently if needed at all.
Fix PR port-sparc64/20907.
2004-07-17 05:03:33 +00:00
skrll 701ae47cdf Fix the dynamic linker for hppa using ELF.
Lazy binding doesn't work 100% of the time so force immediate binding.
One possible reason is that the PLT stub blows away r20 which the
compiler might not take into account.
2004-05-17 13:16:02 +00:00
skrll c0148a0dfe Add a debug message. 2004-05-12 20:12:37 +00:00
skrll d900731978 Resolve dlsym(3) and friends directly so that dlsym(RTLD_NEXT,...) works.
Previously dlsym resolved to the version in crt0.o or libc which would
mean that the caller's shared object couldn't be determined correctly
using __builtin_return_address(0).

Mainly from FreeBSD, but adapted by me. Benefits of this solutions are:

	- backward comptibility maintained
	- existing broken binaries are fixed with a new ld.elf_so
	- __mainprog_obj can be removed from crt0.o
	- we do the same thing as FreeBSD

Fixes PR 22067.

OKed by Jason and Christos.
2003-08-12 09:18:38 +00:00
skrll 5f573ab68d ANSIfy and de-__P(). 2003-07-24 10:12:25 +00:00
skrll ddc9322f3b Support immediate binding on arm. 2003-07-21 15:34:35 +00:00
junyoung 9e11602ee9 Remove comment which is not true any more. alpha and i386 support
R_xxx_COPY relocations.
2002-12-14 09:13:00 +00:00
mycroft be3692c5a7 Back out the last two changes. They were misguided, and the code worked
correctly before.
2002-11-25 19:49:25 +00:00
junyoung 2cc0cde8f5 Now _rtld_relocate_objects() returns with error as soon as any of
subsequent calls in it fails.

Spotted by wiz and enami.
2002-11-22 04:39:37 +00:00
junyoung b5ffe4c33c Simplify code a bit. 2002-11-21 19:09:56 +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 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 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
junyoung d0e76e42b6 G/c dbg()'s. 2002-09-24 18:03: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
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
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 a3b892d178 Nuke -DRTLD_RELOCATE_SELF and `dodebug' from orbit. 2002-09-12 22:56:28 +00:00
mycroft 6f0fac5efa Pass down an additional flag to _rtld_relocate_nonplt_objects() which
indicates whether we're relocating ld.elf_so itself.  Use this in some places
rather than hackish tests on `dodebug'.  (The Alpha and HPPA `dodebug' tests
were actually noops, because RTLD_RELOCATE_SELF is not set, and therefore
dodebug is always true.)
2002-09-06 15:17:53 +00:00
mycroft 0df8d18100 Introduce a new flag, `isdynamic', which is used to remember whether the
executable was of type ET_DYN.  Use this instead of `mainprog' to determine
whether we need to do base-relative fixups of the PLT.  (This allows loading
non-relocatable objects, should we desire to do that at some point...)
2002-09-06 13:20:29 +00:00
mycroft 69b9a24021 More const poisoning. Now the entire _rtld_bind() path useds a const Obj_Entry. 2002-09-06 12:00:40 +00:00
mycroft a04012e731 Split _rtld_relocate_plt_object() into two MD functions:
* _rtld_relocate_plt_lazy() fixes up all the relocs pointing to the PLT.  (On
  most platforms it just does a simple base-relative fixup; on SPARC it does
  nothing.)
* _rtld_relocate_plt_object() does immediate binding for a PLT entry.
The basic gist is that this saves a bit of time on SPARC (where the iteration
through the pltrela table was gratuitous), and a little less time on all other
platforms.  A whole lot of #ifdef'ed crap is moved out of reloc.c, too.

NOT tested on: hppa sh x86_64
2002-09-06 03:05:35 +00:00
mycroft bdc2ac1520 A few things:
* Pass a symbol number to _rtld_find_symdef(), not a r_info.
* Don't try to do a symbol lookup when we find an unsupported relocation;
  instead get the symbol name from the referencing object's strtab.
* Add preliminary support for `-z combreloc'-style startup optimization on
  i386, `#ifdef COMBRELOC'.
2002-09-05 21:21:06 +00:00
mycroft 74444a2ddb Rename _rtld_relocate_nonplt_object() to _rtld_relocate_nonplt_objects(),
and push the outer loop into it.  This actually shaves a couple % off startup
time at least on PCs.
2002-09-05 20:08:14 +00:00
mycroft 00c3ad1f56 Split _rtld_relocate_nonplt_object() into separate MD files. 2002-09-05 18:25:45 +00:00
mycroft b4a8cd2dbf Split MIPS relocation goo into mips_reloc.c. 2002-09-05 17:58:02 +00:00
mycroft ae16986458 Simplify a couple of tests to !__mips__. 2002-09-05 17:06:11 +00:00
mycroft 9e3442dc47 Combine the code that skips COPY relocs on most platforms (other than MIPS).
Remove the code that skips JMP_SLOT relocs (thus making ld.elf_so bomb if it
hits one in the non-PLT relocation table).
2002-09-05 17:01:13 +00:00
junyoung 515622e6db Remove unused arguments of _rtld_find_symdef(). 2002-09-05 16:33:57 +00:00
mycroft 1ea7e8253b Remove support for PowerPC static relocations, which are not present in shared
objects, and in any case are implemented WRONG.  (They're symbol-relative, not
base-relative.)
2002-09-05 15:47:52 +00:00
mycroft 2635aa544a Make _rtld_setup_pltgot() a consistent interface on all platforms. 2002-09-05 15:38:22 +00:00
fredette e4526bd9fa Add support for dynamic linking on HP PA-RISC. 2002-07-10 15:12:33 +00:00
thorpej 67b1884571 Add support for dynamic linking on the SuperH. From Marcus Comstedt,
with some bug fixes (namely, don't forget to consider the addend when
processing relocations) from me.
2002-02-03 23:34:42 +00:00
eeh 0edae4622b Do not attempt to relocate any pltrela entries that are not JMP_SLOT on sparc64. 2002-01-06 03:54:42 +00:00
thorpej 8438068b4a Small whitespace fix. 2001-12-20 06:54:25 +00:00
thorpej 04eaa333b6 Upon further investigation, do NOT include an addend in RELATIVE
relations (the addend should always be zero, but this is safer).
2001-12-20 02:32:49 +00:00
thorpej fe822e84da Include the addend in GLOB_DAT relocations (!!). 2001-12-20 02:23:24 +00:00
thorpej 240ebfc364 * Move The Alpha R(RELATIVE) handling into an Alpha-specific code block,
thus isolating the "iffy hueristic" from the rest of the relocation code.
* In the "iffy hueristic", use _GOT_END_, not _DYNAMIC.
* Include the addend in Alpha R(RELATIVE) relocations.
2001-12-16 08:23:25 +00:00
thorpej 6e94624a62 Add code to peek into the PLT and determine which PLT entry format
is being used.
2001-12-14 00:53:06 +00:00