Commit Graph

656 Commits

Author SHA1 Message Date
mjf
27cb8d0e73 After a recent WARNS= bump on ld.elf_so it fails to build on hppa,
complaining that we're "discarding qualifier from pointer target
type".

Use const char * instead of caddr_t to avoid the warning and get
distribution building on hppa again.
2009-05-23 17:50:34 +00:00
martin
c131490c29 Use the new Elf_SOff (signed offset) type to fix a few signed/unsigned
problems.
2009-05-22 21:47:46 +00:00
christos
b19e027aab fix signed/unsigned comparisons and const cast away (untested) 2009-05-20 22:31:46 +00:00
ad
51a76d6f11 Add a reminder about ldd depending on ld.so. 2009-05-20 19:38:38 +00:00
christos
fa64a5bf9b warns=4 2009-05-19 20:44:52 +00:00
lukem
e91bd42f43 Fix const issues (cast const pointers to "const uint8_t *" instead of "caddr_t") 2009-04-12 13:29:29 +00:00
lukem
b4fba76b41 Fix const issues (cast const pointers to "const uint8_t *" instead of "caddr_t")
NOTE: change based on ../i386/mdreloc.c 1.27
XXX: not compile tested
2009-03-16 02:46:47 +00:00
lukem
337930db10 Fix const issues (cast const pointers to "const uint8_t *" instead of "caddr_t") 2009-03-16 02:44:47 +00:00
lukem
500db00274 Default to WARNS=4
Exceptions that need a lower level are:
	getty ld.elf_so lfs_cleanerd makewhatis telnetd tftpd
	hpropd ipropd-master ipropd-slave kadmind kpasswdd
2009-03-16 02:24:55 +00:00
lukem
b8276deac1 rename a variable to avoid a compiler warning 2009-03-15 23:53:03 +00:00
mrg
fb3cc85fef add some (uintptr_t) to some casts, so these compile with ELFSIZE=32
*and _LP64.  necessary for 32/64 bit combo ldd support.
2009-01-06 04:01:46 +00:00
mrg
9108f12f6b move the defines for RTLD_ARCH_SUBDIR into a sub-sub-makefile so we can
grab these values via reach-over more easily.
2009-01-06 02:15:06 +00:00
mrg
8679e33545 if LD32DIR is defined:
- look in src/compat/lib/libc for libc_pic.
- define RTLD_ARCH_SUBDIR to "i386" or "sparc" for amd64 and sparc64
  builds, respectively
if RTLD_ARCH_SUBDIR is defined, add this path before
RTLD_DEFAULT_LIBRARY_PATH in the default search path.
2008-10-26 07:11:54 +00:00
christos
3b55965a05 Never build this with PIE. 2008-10-16 14:36:20 +00:00
skrll
8c9056ada8 lib/39649: dlsym(3) does not follow dependencies
Pull across code from FreeBSD to do a search of the passed object and it's
NEEDED objects (dependencies).

Reviewed by gimpy.
2008-10-04 09:37:12 +00:00
macallan
982ae38f15 avoid usind __builtin_return_address(0) on PowerPC because it fails in
Xorg's module loader.
Should fix PR37812
2008-09-27 03:52:05 +00:00
matt
86d6d815ae Make sure to call dlerror() to clear any error messages after the relocations
are done and there are no errors.  This will prevent spurious undefined weak
symbol errors being returned by dlerror().

Fixes PR bin/39240.
2008-07-29 16:27:01 +00:00
skrll
dccd9ddf7f RCSID police 2008-07-24 06:51:58 +00:00
matt
38bdc8954f Refactor common code to _rtld_relocate_plt_object to i386 and arm so they
act like the other versions.
In _rtld_bind, if the result is 0, call _rtld_die.
Initialize _rtld_sym_zero.st_value to -_rtld_objself.maprelocbase.  Now when
the symbol is resolved, st_value + maprelocbase will equal 0 and the above
check in _rtld_bind will fire and a call to NULL will be avoided.
2008-07-24 04:39:25 +00:00
christos
d3b459e727 abort() if we are trying to use an undefined weak symbol from the plt. Remove
check from relocate_plt_object() since we cannot return _rtld_sym_zero anymore.
Code from gimpy.
2008-07-23 18:16:42 +00:00
christos
0d33a45b97 handle sym_zero like x86_64; other ports might need this too. 2008-07-22 22:27:07 +00:00
christos
56e895e29f deal specially with sym_zero, returned by a weak symbol that was not found,
by retrieving it's name instead of printing random garbage.
2008-07-21 20:19:28 +00:00
ad
156176be13 Fix error in previous. From nakayama@. 2008-06-05 00:03:20 +00:00
ad
53c5ea5da9 Don't bother unmapping the ELF header unless it overlaps the first load
section.
2008-06-03 19:32:32 +00:00
ad
9795e155ec __progname isn't const. 2008-06-03 19:22:07 +00:00
ad
36b49f84f3 Try read() on ld.so.conf. If the file is small, it avoids stat+mmap+munmap. 2008-06-03 18:36:59 +00:00
wiz
488200e6ea Remove trailing whitespace and superfluous .Pp. 2008-05-25 19:48:35 +00:00
martin
11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
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