Commit Graph

778 Commits

Author SHA1 Message Date
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
yamt 8c93baa802 constify 2008-01-14 08:53:42 +00:00
yamt 8a58f724e1 tabify 2008-01-14 08:52:16 +00:00
christos 8fb14189dc make this compile again. 2007-12-29 01:44:03 +00:00
christos 716fde8fa0 simplify; mapbase == vaddrbase from the PaX author. 2007-12-28 19:36:21 +00:00
christos 8636ab52f6 Deal with ASLR PIE executables, by recognizing that phdr != phdr->v_addr
for PT_PHDR headers when the program has been loader to a vaddr other than
then one specified (a randomized one), and modifying the relocation base
address appropriately (idea from elad)
2007-12-26 21:14:41 +00:00
christos 8b0637156f No need for stack_protector.o if USE_FORT is no.
XXX: compiling a binary with -Wl,--dynamic-linker,${NETBSDSRCDIR}/libexec/...
results in stack overflow. Investigate!
2007-12-26 21:11:52 +00:00
christos 5ad1b72097 print the symbol we are seaching for [when debugging] 2007-12-26 21:10:03 +00:00
ad 558a5ffd0f rtld changes for PR bin/37347:
- Apply patch from J.T. Conklin to execute .init/.fini functions in order.
- Support DF_1_INITFIRST and mark libc with DF_1_INITFIRST. Shared libs
  should be recording a dependency on libc, but it's too late to do that.

Ok christos@.
2007-12-07 20:34:04 +00:00
christos 496f9be3e8 support %z 2007-11-24 18:32:26 +00:00
ad 71ac015ebf stack_protector.c has moved. 2007-11-13 15:34:51 +00:00
skrll 29353f93e2 Build a local copy of exit that doesn't call __cxa_finalize. It's not
needed and drags in a lot of libc via free.
2007-10-30 17:19:59 +00:00
christos ed1a8fea8d build stack protector locally so that we don't call syslog_ss that results
in 1/2 of libc dragged in.
2007-10-29 20:36:31 +00:00
ad bf4b000d16 - Don't use the names malloc/free/etc, since we can end up pulling in libc's
malloc which is not what we want.
- Remove ancient memory compaction hack. Realloc on free memory is now an
  error again (from joerg@).

Ok christos@.
2007-10-05 22:21:07 +00:00
christos 596c6ec5db provide xrealloc, and don't cast and use malloc and realloc directly. 2007-09-27 17:52:16 +00:00
christos 2cce1500a2 If we are using SSP, compile in a separate copy of the stack protector
functions so that we don't end up calling syslog_ss() which drags in
a large portion of libc. Found by skrll...
2007-09-27 17:51:40 +00:00
christos 6f875d32e2 Don't trust AT_SUN_EXECNAME, if we are set{u,g}id. 2007-09-21 13:57:09 +00:00
christos 6eac115581 delete debug printf
make regress compile again.
2007-09-20 19:42:53 +00:00
christos 40cfdb5e3a Use AT_SUN_EXECPATH instead of argv[0] for the executable name. This needs
kernel support, which is not there yet, thus $ORIGIN is broken at this time.
This is ok, nothing uses it yet.
2007-09-20 14:14:25 +00:00
cube f7779133cd Don't remove the last component of filename before calling
_rtld_digest_dynamic:  it is done in expand(), and doing it twice is once
too much.  This fixes $ORIGIN expansion for dependencies.
2007-09-20 07:50:32 +00:00
tnn ea0fc2f827 5 is not a valid version for .Nx, so change it to 5.0. 2007-09-13 21:32:14 +00:00
joerg ad61ac15d2 Don't define bool, false and true. Use stdbool.h. 2007-09-02 09:57:16 +00:00
christos 2ffe4b875f Use an elf note to handle pax arguments. This is a temporary solution to
avoid wasting OS flag bits. In the future we'll probably use fileassoc to
achieve this (once there is a way to make fileassoc persistent) or in the
shorter term libelf, so that we can add and remove the note on demand instead
of burning bits on each binary. Of course since this is a tool, this means
that we'll need to think about how to handle libelf...
2007-06-24 20:35:36 +00:00
christos 3b320420fe fix a comment. 2007-05-18 21:46:39 +00:00
christos 04ee85ad50 Support Solaris-like $ORIGIN etc. expansions in paths. 2007-05-18 21:44:08 +00:00
scw 596a371d09 Remove a test for defined(__SH5__). 2007-04-08 10:02:35 +00:00
scw 5764a76889 Remove support for NetBSD/{,evb}sh5. 2007-04-08 09:35:21 +00:00
matt 549524f84f Deal with MKPICLIB != no. 2007-03-15 17:27:15 +00:00
matt ee98d74a6b Remove MD COMBRELOC support since it's now MI.
Enable COMBRELOC for all arches
2007-02-23 01:17:11 +00:00
matt 364993dede Don't use cached results for plt lookups (nor save them). 2007-02-23 01:16:32 +00:00
matt 4d10e5e667 Make the COMBRELOC support generic. 2007-02-22 18:57:48 +00:00
martin 3cc1de3d7b Add COMBRELOC support 2007-02-15 19:42:13 +00:00
skrll 1fddd99f52 Provide COMBRELOC support for amd64 in answer to PR/35589.
Some statistics:

base + COMBRELOC
$ time (for i in `seq 100`;do noatun --help>/dev/null;done)
(; for i in `seq 100`; do; noatun --help > /dev/null; done; )  148.64s
user 4.82s system 99% cpu 2:33.93 total

base + DF caching:
$ time (for i in `seq 100`;do noatun --help>/dev/null;done)
(; for i in `seq 100`; do; noatun --help > /dev/null; done; )  151.15s
user 5.53s system 99% cpu 2:37.23 total

base:
$ time (for i in `seq 100`;do noatun --help>/dev/null;done)
(; for i in `seq 100`; do; noatun --help > /dev/null; done; )  492.36s user
5.34s system 99% cpu 8:19.17 total
2007-02-15 15:44:28 +00:00
wiz 09cb1d6f1c s/existance/existence/, from Zafer. 2006-11-24 22:52:16 +00:00
christos aac134252a From defend dot the dot world at gmail dot com: Sanitize environment variables
for set{u,g}id binaries, so that in case they are playing with set{u,g}id
and exec'ing other binaries they don't get affected by the
LD_{PRELOAD,DEBUG,LIBRARY_PATH} environment setup. We leave LD_BIND_NOW alone.
There are no binaries affected in the base system.
2006-11-22 21:46:36 +00:00
skrll 6f388cd224 Create _rtld_relocate_plt_object and use it in _rtld_bind and
_rtld_relocate_plt_objects.

No functional change.
2006-10-17 08:33:36 +00:00
skrll 152e43d87a Support unaligned DIR32 relocs.
Closes PR 18293
2006-10-17 08:28:06 +00:00
skrll edf13fb5fb Reformat a comment. 2006-10-16 13:53:09 +00:00
skrll 78b8583054 Correct the frame size for a couple of ENTRYs 2006-10-16 13:52:47 +00:00
simonb 676a630d08 Simplify multiple MACHINE_ARCH endian checks with single MACHINE_CPU
checks.
2006-08-27 07:22:02 +00:00
skrll a238470b22 Add (back) -Wl,-static to the link. 2006-06-29 19:30:59 +00:00
simonb 428d37fad6 Fix unaligned loads and stores generated by gcc4. Problem described in
http://mail-index.NetBSD.org/tech-toolchain/2006/06/27/0001.html.
This cleaner version of the patch from Christos - thanks!
2006-06-28 16:48:38 +00:00
simonb 7d5684f475 Use .previous at the end of the NetBSD ident note so that we switch
back to the previous section.  Fixes build problems on MIPS with gcc4
and -g.
2006-06-13 13:55:58 +00:00
mrg 0f0f2b4e93 in _rtld_bind() initialise new_value for GCC4. 2006-05-23 16:27:41 +00:00
drochner eb92277cd7 sprinkle some __noreturn__ attributes, saves gcc4 warnings elsewhere 2006-05-22 19:49:09 +00:00
mrg d677e4a13a avoid more GCC4 uninitialised variable problems. (sh3 known, vax guessed.) 2006-05-21 04:17:35 +00:00
dan b995f58933 appease gcc4 uninitialiased warning
ok mrg.
2006-05-20 23:38:27 +00:00
mrg 82f7733046 in _rtld_bind() initialise result to appease GCC4. 2006-05-20 07:09:44 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
skrll c965f60a50 Remove empty lines. 2006-04-03 13:23:15 +00:00
christos 0339fe6614 Coverity CID 2749: Fix another double free. Instead of removing that last
free() call, change the allocation policy to leave the responsibility for
allocation/freeing the pathname to _rtld_map_object(), instead of having
the caller allocate it and _rtld_map_object() free it. This simplifies the
code a lot and it is more efficient.
2006-03-21 17:48:10 +00:00
christos 458b13dee7 Coverity CID 923: Avoid NULL deref. 2006-03-18 23:09:34 +00:00
matt ba8a81077b Fix some double frees / missing frees / use after freed all
relating to _rtld_load_object.  Fix Coverity CID 2601, 2600.
2006-03-18 02:34:30 +00:00
skrll 9f6658b9ff Remove the LD_BIND_NOW item 2006-03-04 09:00:22 +00:00
skrll 125d6a43ac Add LD_BIND_NOW support for mips.
This is the last arch to be done so remove the large ugly #if defined()
stuff in reloc.c.
2006-03-04 08:58:46 +00:00
rpaulo 94ef983148 Remove -Wl,-non_shared (same meaing as -static). 2006-02-03 02:01:19 +00:00
skrll 39aae79d93 Bring across a change from FreeBSD from back in 1998:
"Fix a bug that showed up when debugging dynamically linked programs.
References from GDB to "printf" and various other functions would
find the versions in the dynamic linker itself, rather than the
versions in the program's libc.  This fix moves the GDB link map
entry for the dynamic linker to the end of the search list, where
its symbols will be found only if they are not found anywhere else."

"printf" isn't true for us, but various libc symbols are, e.g. "malloc".

Fixes PR 32074 as noted by uwe@

OK'd by christos@
2006-01-12 22:40:17 +00:00
uwe a35d2a5b09 Add some comments. 2006-01-11 22:24:34 +00:00
uwe e7102691a2 Kill trailing whitespace.
Indent delay slots.
2006-01-11 22:05:27 +00:00
uwe b98cf46363 _GLOBAL_OFFSET_TABLE_ is only used if RTLD_DEBUG, so wrap its
declaration too.

32-bit SuperH can not pretend that _GLOBAL_OFFSET_TABLE_ is a normal
variable, because of the way PIC variable references is generated, but
as compiler arranges for _GLOBAL_OFFSET_TABLE_ address to be in r12
anyway, just use that value by declaring it as a global register
variable.  Makes sh3 compile with RTLD_DEBUG.
2006-01-11 21:40:12 +00:00
perry ae6ae2c362 Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 20:56:41 +00:00
skrll bd7cbb198e Correct the lookup order of _rtld_symlook_default and make
_rtld_find_symdef use _rtld_symlook_default.

This reduces the code size and means that dlsym(RTLD_DEFAULT,...) has the
correct lookup order.

Reviewed by kleink. Thanks.
2005-10-13 11:14:09 +00:00
chs 0c6e4dbbc4 ok, the change from rev 1.33 was unnecessary after all,
only the second part of the previous revision was needed.
put the logic for the initial icache invalidation of the PLT
back the way it was, but in a way that makes clearer what's going on,
and add some comments explaining it.
2005-09-27 07:20:32 +00:00
chs 96fb424f44 fix two problems with icache invalidation of the PLT:
- restore revision 1.33, it was correct.
 - fix pointer arithmetic in other calls to __syncicache().
2005-09-26 05:45:13 +00:00
skrll 680596d08e Add __RCSID. 2005-08-20 19:01:16 +00:00
skrll 9f486044a0 KNF 2005-08-15 10:52:42 +00:00
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
fair af23ff4dbb appease gcc -Wuninitialized 2005-06-08 00:19:18 +00:00
he 7ed57630be Initialize a bunch of local variables in _rtld_relocate_nonplt_self().
Found by -Wuninitialized while compiling for newsmips.

Reviewed by lukem.
2005-06-07 09:20:19 +00:00
chs 7bbdd188e1 appease gcc -Wuninitialized on hp700. 2005-06-05 19:08:28 +00:00
lukem 3ed9ffcae1 Explicitly prefix ld(1) options in LDFLAGS with "-Wl," rather than
using the ${LDFLAGS:@F@-Wl,$F@} make substitution because that breaks
if LDFLAGS is already set.
2005-06-04 16:17:17 +00:00
lukem a50c8ab399 Add some sanity checking inspired by gcc -Wuninitialized. 2005-06-01 14:57:22 +00:00
lukem a12d17494d appease gcc -Wuninitialized 2005-06-01 14:14:55 +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
skrll 504512d318 Copyright maintenance. 2005-05-21 06:43:39 +00:00
chs 14480c4191 in _rtld_is_exported(), use a function pointer type instead of Elf_Addr
so that hppa knows to do the plabel thang.
2005-05-10 13:15:56 +00:00
christos 01592c7cfe not supporting %c is confusing and it only uses up a few bytes. 2005-04-24 21:11:58 +00:00
skrll f5ee31d050 Update and be more descriptive about one of the machine specific #ifdefs 2005-02-26 22:26:18 +00:00
martin d7931a6191 Quote symbol names in a debug message (to make it easier to spot an empty
symbol name, a common failure mode)
2005-01-11 21:58:27 +00:00
martin d977618dcf Backout -DDEBUG that I accidently commited with the last change 2005-01-11 07:47:37 +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
simonb c364c98f98 Don't process DT_DEBUG on MIPS as the dynamic section is mapped
read-only.  DT_MIPS_RLD_MAP is used instead.

Patch from Nick Hudson.
2005-01-09 12:43:23 +00:00
martin 995d8a8e4b Add support for unaligned relocs on sparc, from PR 26858.
Should also fix PR 25901 and PR 18296.
2005-01-05 09:18:53 +00:00
martin 35130888e4 Add LD_BIND_NOW support for sparc64. 2005-01-05 09:16:03 +00:00
mycroft ac7236712a ELF32_ST_TYPE -> ELF_ST_TYPE 2004-12-17 10:53:27 +00:00
skrll 38fb01be3a Apply fixes from Charles:
- Fix how _rtld_relocate_nonplt_self deals with REL32 relocations.

- Change the assert so that it is correct for binutils 2.14 and 2.15.

There are still problems with the libraries generated with binutils 2.15,
but at least ld.elf_so doesn't crash.
2004-12-15 10:26:29 +00:00
skrll 2728318e3c Add __RCSIDs.
OK'd by mycroft.
2004-10-22 05:39:56 +00:00
uwe 255de8f40e Preserve r2 in _rtld_bind_start - in r2 functions that return
aggregate types are passed the address of the memory area to store the
returned result to.

Fixes PR port-sh3/26949.
2004-09-14 21:34:01 +00:00
rearnsha 3fa803b523 Check the type of symbols; if it's a Thumb function, then set the Thumb
bit in the relocated value (JUMP_SLOT, ABS32 & GLOB_DAT).
2004-08-21 11:14:07 +00:00
rearnsha c3e148044f Use BX if available. 2004-08-21 11:12:03 +00:00
thorpej 2a63e04007 - Change the strong dlfcn names in libc to ___name, and make the __name
versions used by others in libc weak, so that we have:
	name: weak
	__name: weak
	___name: strong
- Add __name strong aliases of the dlfcn names in ld.elf_so, so that we have:
	name: strong
	__name: strong

This allows ld.elf_so to self-resolve both the name and __name variants
of the dlfcn functions, the former being required for dlfcn support in
applications, the latter being required for dlfcn support in libc.

Fixes the problem described in:

    http://mail-index.netbsd.org/tech-toolchain/2004/07/17/0000.html

Reviewed by Nick.
2004-07-18 17:26:19 +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
cube d1b3d841ee Make ld.elf_so use the new sysctl API. That allows the user to give any
sysctl variable name in /etc/ld.so.conf.  It also makes the ld.elf_so
binary slightly smaller (at least on i386), and has no impact on
performance.

Fixes PR 26100.
2004-07-05 11:50:07 +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 e88c851d08 Test before commit. 2004-05-17 11:00:01 +00:00
skrll 0556cd7d3c Re-arrange/correct some asserts. 2004-05-17 10:23:58 +00:00
skrll 8431fb3c4c Wrap a couple of lines to <80 columns 2004-05-14 11:59:14 +00:00
skrll c788a1a535 Whitespace. 2004-05-14 11:11:02 +00:00
skrll 212b905081 Garbage collect the RTLD_RELOCATE_SELF error. 2004-05-12 20:23:29 +00:00
skrll c0148a0dfe Add a debug message. 2004-05-12 20:12:37 +00:00
mhitch b6825b1e42 The -symbolic flag in gcc 2.95.3 is not passed to the linker, which is
required.  Restore the -Bsymbolic option in LDFLAGS on the vax.  Fixes
the problem with ld.elf_so mentioned on port-vax.
2004-04-28 02:04:56 +00:00
skrll 236df38503 Be more pedantic about where we use -shared, etc. 2004-03-24 08:01:26 +00:00
atatat 1de60baa7c The <sys/sysctl.h> header already provides a perfectly good struct for
this purpose, so...uh...use it.
2004-03-16 05:25:12 +00:00
enami 76eaac1d6f Whitespace. 2004-02-26 21:45:59 +00:00
skrll 52581467e2 Whitespace. 2004-02-23 21:27:20 +00:00
skrll 4d30716d36 Remove the millicode hack - its not needed anymore.
Get the entry point right.
2004-02-23 21:20:40 +00:00
uwe 8eb5ba6d09 Use CC instead of LD to link the ld.elf_so. This will correctly link
"millicode" from libgcc_pic.a on platforms that need it.

From Nick Hudson <skrll@netbsd>.
2004-02-22 01:39:43 +00:00
skrll b5330c98c7 Add the standard XXX about CPPFLAGS and -fpic here. 2004-02-21 16:02:06 +00:00
skrll d93f13855a Move common LDFLAGS into Makefile from arch/*/Makefile.inc 2004-02-21 15:56:03 +00:00
skrll 151426159b Whitespace. 2004-02-20 20:58:24 +00:00
enami 074a9e8fee Salvage the instruction to save the pointer to ps_strings for later use
so that setproctitle() works again.  The problem reported by Naoki Fukaumi
on japanese mailing list.

Approved by: Ross Harvey
2004-02-18 23:04:49 +00:00
enami f1740378ad Don't assume past the mmaped region is accessible. 2004-02-15 02:59:04 +00:00
enami 63fcb5a042 Fix warning message: the failed operation is not fstat but mmap. 2004-02-15 02:56:53 +00:00
mrauch f06ab72b6e Change the symbol lookup order to search RTLD_GLOBAL objects
before referencing object's DAG. This makes it possible for
C++ exceptions to work across shared libraries.

Patch taken from FreeBSD: src/libexec/rtld-elf/rtld.c: 1.67 -> 1.68,
committed there by kan@FreeBSD.org.
2003-12-07 09:36:06 +00:00
christos 1a2b5965a9 Don't try to preload an empty string. 2003-11-25 14:36:49 +00:00
simonb 28817edd35 Restore handling of reloc entries that point to unaligned locations
that seems to have disappeared in rev 1.34.

Thanks to Jason Thorpe for suggesting where to look.
Fixes the simple test case in PR port-mips/23366.
2003-11-19 19:41:57 +00:00
lukem 130ab7336b Rework how MAKEVERBOSE operates:
*	Don't bother prefixing commands with a line of  ${_MKCMD}\
	and instead rely upon "make -s".  This is less intrusive on
	all the Makefiles than the former.  Idea from David Laight.

    *	Rename the variables use to print messages.  The scheme now is:
	    _MKMSG_FOO		Run  _MKMSG 'foo'
	    _MKTARGET_FOO	Run  _MKMSG_FOO ${.TARGET}
	From discussion with Alistair Crooks.
2003-10-21 10:01:19 +00:00
fvdl d83c6c4294 Don't use NULL for integers. 2003-10-21 01:19:10 +00:00
lukem ddff99b7f4 rework to use the newer _MKMSGCREATE (et al) macros 2003-10-19 04:45:01 +00:00
lukem 6cf0d872cd support MAKEVERBOSE 2003-10-19 01:19:10 +00:00
matt fd1caff7c2 Update to new reality. XXX _rtld_bind still needs to be written. 2003-10-06 16:08:35 +00:00
mycroft 65ed3bdcdd Make the effect of the hack clearer. 2003-09-24 10:25:26 +00:00
mycroft 7242c1114c One more tweak... 2003-09-24 10:18:52 +00:00
mycroft 7b234fd232 Make the comment a little more accurate. 2003-09-24 09:59:45 +00:00
mycroft 89ea37c60a Temporary workaround for some binutils/ld lossage. See the comment for more
information.
2003-09-24 09:55:35 +00:00
mycroft 5fb0b88880 Some notes... 2003-09-24 06:20:33 +00:00
enami 9c2e06fe24 Space after the keyword `if'. 2003-09-22 14:37:57 +00:00
mycroft 5bd33bcad6 Back out revision 1.100. There is something screwier going on. 2003-09-07 22:17:43 +00:00
mycroft 323a574dc3 dlsym() should not leave an error set. It confuses programs that check
dlerror() (such as pkgsrc/graphics/transcode).
2003-08-31 21:52:01 +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
agc 8e6ab8837d Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22284, verified by myself.
2003-08-07 09:46:37 +00:00
skrll 59b0f10729 KNF 2003-08-05 19:41:53 +00:00
salo 99410184e7 netbsd.org->NetBSD.org 2003-07-26 19:24:24 +00:00
mrg 88bb1d9b3b include <string.h> or <stdlib.h> for all prototypes 2003-07-26 15:04: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
skrll b2695e5a1f arm and sh5 also have bogus DT_TEXTRELs. sh5 was already covered so just
update the comment.
2003-07-21 15:17:55 +00:00
skrll 619dee76f6 Correct the in_plt parameter of a couple of _rtld_find_symdef calls.
The mips_reloc.c case is a no-op as _rtld_symlook_obj ignores in_plt for
MIPS.

OK'ed by Charles.
2003-07-17 13:56:32 +00:00
skrll d4cfd1c666 s/_rltd_obj_rtld/_rtld_objself/ in #ifdef notyet code. 2003-07-15 07:39:55 +00:00
skrll 9192c2eed4 Whitespace 2003-07-15 07:38:29 +00:00
marcus fae2567c9b Removed unused function. 2003-07-05 20:48:39 +00:00
tsutsui 0e65101f60 Add function prototype declarations. 2003-07-05 18:18:51 +00:00
marcus a4878b4349 Bugfix: Don't pick addend both from reloc and contents at the same time. 2003-07-02 15:29:34 +00:00
marcus 6aeeb40d4a Updated to work with current rtld code. 2003-06-30 00:50:46 +00:00
marcus 5404577abf SH also has a bogus DT_TEXTREL, it seems. 2003-06-30 00:49:25 +00:00
simonb a9f5b3f871 KNF- blank lines before code at start of functions. 2003-06-05 10:41:32 +00:00
christos 683092605c Add RTLD_FIRST, RTLD_NEXT, RTLD_DEFAULT, from FreeBSD 2003-05-30 15:43:33 +00:00
petrov 458dbd70ac Fix alignment problem in debug output.
Happens only under RTLD_DEBUG_RELOC.
2003-05-23 20:13:50 +00:00
mycroft f57f7ac072 Back out previous change for now -- it needs more work. 2003-04-24 16:55:29 +00:00
mycroft 8826c5e475 Attempt to give dlsym() the same symbol-searching semantics as _rtld_bind().
Tested in a handful of cases.
Reviewed by: a dead silence
2003-04-23 17:40:25 +00:00
scw 0b8f02edad Handle unaligned relocations, and RELATIVE relocs with non-zero addends.
This gets binaries linked against libstdc++ working (FSVO "working").
2003-04-21 11:54:46 +00:00
scw e6b13790fa SH5 needs __HAVE_FUNCTION_DESCRIPTORS defined in order for ld.elf_so
to resolve SHmedia function pointers correctly.
2003-03-26 14:46:32 +00:00
scw d174ad2eab Add support for shared libraries/dynamically linked binaries on sh5.
With the latest SuperH toolchain, NetBSD/evbsh5 can now
run with a fully dynamic userland (modulo a few remaining
gremlins affecting a couple of binaries).
2003-03-25 13:11:53 +00:00
taca 28d2056e12 make it compile in /usr/src/rescue directory. 2003-03-06 17:01:27 +00:00
matt 7b28c56025 Align psections to their specified alignment (if possible). Use
mmap(2) MAP_ALIGNED.
2003-03-06 07:34:56 +00:00
mycroft 7cbba1750d Shorten rtld_start() by 2 instructions or 8 bytes, and make it not use GOT
entries.
2003-03-02 22:56:14 +00:00
mycroft d2fd5f837d Shorten rtld_start() slightly -- there's a base-relative _DYNAMIC pointer at
the beginning of the GOT, so we don't need an extra one here.  Also, remove a
bogus comment -- we do in fact have to do fixups, because there are pointers in
ld.elf_so's data segment that need to be relocated.
2003-03-02 22:03:40 +00:00
mycroft 33131cb294 Update copyright. 2003-03-01 15:14:59 +00:00
christos 861ff9be73 we have constants for all this crap. don't hard-code things. 2003-02-28 23:05:24 +00:00
mycroft 9939b38056 Eliminate GOT usage in rtld_start() on this platform, too. 2003-02-28 22:37:35 +00:00
thorpej 527c1efca7 Use the "__NetBSD_Version__" constant rather than the "NetBSD" constant
in the NetBSD version note.  The old "NetBSD" constant was stuck in stone,
and thus didn't really convey any useful information.
2003-02-28 18:20:33 +00:00
mycroft 9cb7d16b11 Similar to other rela platforms, do not use any GOT entries (other than the
first entry, which is a special case) in rtld_start, because they could be
all 0s.  Instead we use the difference between the real _DYNAMIC address
(which we can determine on 68k with a "lea (%pc,_DYNAMIC),..." and the
base-relative one (at the beginning of the GOT) to figure out the relocation
offset.

Not needed for binutils-current, but I might as well fix it now.
2003-02-28 07:06:16 +00:00
mycroft eea1001a73 Adjust for the fact that the GOT is all 0s in new binutils -- do the trick of
disassembling a call to _DYNAMIC to determine its real address, and using the
first entry of the GOT as its base-relative address.

It's evil, but it works.
2003-02-27 05:39:42 +00:00
uwe 6a4d4259ae Do not add ${LIBC_PIC} to DPADD if MKPICINSTALL is "no". 2003-02-26 06:03:40 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
mycroft c42fd7b479 Revert previous change. 2003-02-21 01:12:56 +00:00
fvdl c8ba6436ed If fstat info was passed, and from it it can be seen that the file size
is smaller than an ELF header, don't even bother to try to look at it.
Avoids coredumps with zero-sized files.
2003-02-06 12:38:17 +00:00
matt 0655a07988 Fix bug where only 2/3 of the PLT was being synched with the icache.
PLT entries are 12 bytes.  Add a #define for that and replace the
explicit values with the PLT_ENTRY_SIZE.  This bug can cause random
SIGILL signals to happen.
2003-01-11 01:33:56 +00:00
junyoung 8707cd2a36 Gracefully exit when invoked directly. Use of assert() here caused a segfault.
Address PR#11785.
2002-12-14 15:37:57 +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
junyoung fd1f5e8f1b A bit speedup: in _rtld_load_object(), save the number of calls to
strcmp() by performing path name length comparison first. In the test
with Mozilla, the number was reduced to 1068 from 7182 (yes, we saved
6114 strcmp()!).
2002-12-05 04:56:56 +00:00
thorpej 044aeabaad Bintuils-current initializes the GOT entries to 0 (instead of the
base-relative offsets that were placed there previously), so we
must use a different mechanism to compute our reloc base.

Patch from Charles Hannum.
2002-12-04 01:19:37 +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
fvdl 100e201ec6 Replace return -1 in rtld_bind with _rtld_die() call. 2002-11-24 18:19:23 +00:00
fvdl d93db1cfce Implement self-relocation as is required now. 2002-11-24 18:16:45 +00:00
fvdl 5505734fa9 For the debug case, print relocbase as well at the start of _rtld(). 2002-11-24 18:13:30 +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
nathanw 15f633fbd3 In _rtld_load_library(), ensure that the old _rtld_error state (a message from
a previous error, or NULL) is preserved if the search eventually succeeds.

Addresses the problem pointed out in PR pkg/19024.
2002-11-14 21:07:46 +00:00
nathanw 6c24ccfd1f Remove "extern const chat *_rtld_error_message;". There is no such
variable, and never has been.
2002-11-14 20:11:48 +00:00
matt 01ba93bc3c Convert to register prefixes. 2002-10-31 20:23:25 +00:00
thorpej b777dba640 _rtld_bind(): Don't use "rela" until after we've (potentially) adjusted
it.
2002-10-18 20:35:25 +00:00
junyoung d0c512001c Embedded whitespace in dirname is supported again. 2002-10-06 01:36:36 +00:00
junyoung 2036ad0c3f A line whose length is 0 always begins with '#'. 2002-10-05 16:26:37 +00:00
junyoung e4d4608a8b Minor cleanup. 2002-10-05 16:13:31 +00:00
junyoung 1b5e50eb7b Disable DEBUG again. 2002-10-05 15:52:15 +00:00
junyoung 2e85345237 Better fix of parser bug. 2002-10-05 15:43:56 +00:00
junyoung 89342b95bb Don't call _rtld_process_mapping() with null string. 2002-10-05 15:04:49 +00:00
mycroft 80b0665a93 Simplify the hint file parser a bit. 2002-10-05 12:23:39 +00:00
mycroft ad8ccd6290 Minor cleanup. 2002-10-05 11:59:03 +00:00
mycroft 5d4bc1adf5 Make this work for ldd again. 2002-10-05 00:13:27 +00:00
mycroft 2a88686d7a Recode _rtld_elf_hash() so it compiles better (at least on i386 and arm).
Still could be better on i386, but only written in assembler...
2002-10-04 20:34:10 +00:00
mycroft 6f56cdc91f Rearrange _rtld_map_object() a little, so that we don't have to have the first
page of the object double-mapped.  Not that it matters much, but someone was
whinging about it.
While I'm at it, nuke obj->phdr and obj->phsize; they're unused.
2002-10-04 18:50:43 +00:00
mycroft 0a519951b5 Pull out some objlist functions in ldd. 2002-10-04 04:04:26 +00:00
mycroft 3c57a33db5 Don't actually bother maintaining _rtld_list_main and _rtld_list_global in
ldd.
2002-10-04 04:01:13 +00:00