skrll
1f45aab781
Sprinkle some KNF.
2010-12-19 17:26:51 +00:00
skrll
ad7786ec8b
Remove unnecessary #ifdef RTLD_DEBUG
2010-12-19 17:17:50 +00:00
wiz
617acddc41
Remove superfluous Pp.
2010-12-17 08:50:26 +00:00
skrll
1ee8ff33ba
Remove implementation detail.
...
Bump date.
2010-12-17 07:04:52 +00:00
joerg
c4120e324e
Replace use of errlist with a single concatenated version and an offset
...
array. This requires less storage and avoids one runtime relocation per
errno value.
2010-12-16 22:52:32 +00:00
joerg
67cc8c0871
Don't use normal environment handling functions from libc, but iterate
...
once over the array and clean out entries as needed.
2010-12-16 22:47:27 +00:00
skrll
126c589398
s/rdbg/dbg/ in a few places.
2010-12-16 19:59:39 +00:00
skrll
76d5f138f4
Remove incorrect comment.
2010-12-16 19:35:38 +00:00
wiz
fbc697a1ed
Note that $ORIGIN kernel support (in kern/kern_exec.c) is currently disabled.
...
Info from skrll@.
Bump date.
2010-12-16 19:25:41 +00:00
joerg
67e01e0a99
Build ld.elf_so with -fvisibility=hidden. Exploit this for i386/x86_64
...
to simplify the assembler code.
2010-12-05 00:56:06 +00:00
joerg
91118529e4
ANSIfy
2010-12-03 23:07:49 +00:00
joerg
239c31f883
Add comment about the unusual stack alignment in .rtld_bind_start.
2010-12-03 22:48:25 +00:00
tron
1fbd900608
Don't use internal libc function __findenv().
2010-11-14 22:09:16 +00:00
christos
acfd35dad9
PR/44010: YAMAMOTO Takashi: sbrk: grow 0xb3ba2000 failed, error = 12"
...
(due to setenv changes?)
Provide a mini unsetenv that does not allocate/free memory and does not
bother about locking.
2010-10-29 15:08:17 +00:00
skrll
8b916d603d
Add cast so that usr.bin/ldd/elf32 builds.
2010-10-16 17:48:12 +00:00
skrll
e6cdac9c4b
Implement dl_iterate_phdr.
...
Somewhat taken from FreeBSD. Manual page from OpenBSD.
2010-10-16 10:27:06 +00:00
skrll
0a77584d8f
Revert previous for now. It's part of a larger commit which will arrive
...
soon.
2010-10-15 15:08:05 +00:00
skrll
a048346afd
Be more tolerant to the location of PT_PHDR in the segment list.
2010-10-15 07:22:44 +00:00
christos
45bdf1678c
restore binary compatibility for pre-2.0 binaries, requested by skrll and core.
2010-10-10 21:27:16 +00:00
skrll
a108583dc7
Oops. Remove trailing whitespace in previous.
2010-09-30 19:45:24 +00:00
skrll
d965c46816
Improve debug output.
2010-09-30 19:43:11 +00:00
skrll
0e07ba7138
Add the magic branch instruction that is used by GCC's
...
__canonicalize_funcptr_for_compare() function to fixup relocations in
order to do function pointer comparisons.
From OpenBSD.
2010-09-30 19:32:40 +00:00
skrll
06acf46b03
Introduce a new type Elf_Symindx for use in decoding the symbol hash table
...
section and allow this type to be overridden.
The ELF specification says it should always be uint32_t (Elf_Word), but
alpha decided to be different (not sure why). Define Elf_Symindx to be
uint64_t on alpha.
Alpha no longer uses non-standard definitions of Elf64_Sword and
Elf64_Word. Remove the ability to override these types.
Fixes ld.elf_so after Herculean effort from me and martin.
2010-09-30 09:11:18 +00:00
matt
af56990d0c
Make the GOT1_MASK 64-bit clean.
2010-09-24 15:20:52 +00:00
skrll
8f77c5159b
Comment reformat.
2010-09-24 12:00:10 +00:00
skrll
2c56298dd9
Wrap long line.
2010-09-24 11:59:28 +00:00
skrll
09601c884f
Whitespace.
2010-09-24 11:57:11 +00:00
skrll
6229c56fea
Wrap long lines
...
Reformat comments.
2010-09-24 11:41:46 +00:00
joerg
11fdf81f84
Avoid casting from d_val to plttype of different signedness.
...
Just two booleans for the same purpose.
2010-09-23 13:03:35 +00:00
skrll
07666b6356
Wrap long line.
2010-09-11 11:11:52 +00:00
joerg
6972211664
Stricter matching for _rtld_invalid_paths by ensuring separator.
...
Use mem* functions instead of str* for strings of known size.
2010-08-07 19:47:34 +00:00
joerg
f40b256f09
Reduce header pollution for mdreloc.c. Make Obj_Entry argument of
...
_rtld_relocate_nonplt_objects non-const in preparation for TLS support.
2010-08-06 16:33:17 +00:00
mrg
c8cf27943d
make sure to look in CFLAGS, COPTS and CPPFLAGS for abi options.
...
fixes sgimips64 build of n64 ld.elf_so.
2010-07-11 07:43:12 +00:00
mrg
4c92852a80
remove almost all the ability to build netbsd with an a.out target.
...
we're ELF now, and there are many missing checks against OBJECT_FMT.
if we ever consider switching, the we can figure out what new ones
we need but for now it's just clutter.
this doesn't remove any of the support for exec_aout or any actually
required-for-boot a.out support, only the ability to build a netbsd
release in a.out format. ie, most of this code has been dead for
over a decade.
i've tested builds on vax, amd64, i386, mac68k, macppc, sparc, atari,
amiga, shark, cats, dreamcast, landisk, mmeye and x68k. this covers
the 5 MACHINE_ARCH's affected, and all the other arch code touched.
it also includes some actual run-time testing of sparc, i386 and
shark, and i performed binary comparison upon amiga and x68k as well.
some minor details relevant:
- move shlib.[ch] from ld.aout_so into ldconfig proper, and cut them
down to only the parts ldconfig needs
- remove various unused source files
- switch amiga bootblocks to using elf2bb.h instead of aout2bb.h
2010-07-06 05:59:50 +00:00
joerg
ff0f2fb483
Use fast_remainder32 for the ELF hash. For the hot cache case, this
...
speeds up Firefox startup by over 2% on AMD64.
Limit hash table buckets to 32bit.
2010-04-05 14:01:26 +00:00
skrll
134b0fcc8f
Only apply -Wno-stack-protector where alloca is used.
2010-03-20 16:36:35 +00:00
roy
51085124f6
Use the gcc directive to disable SSP warnings.
2010-03-19 20:53:50 +00:00
roy
d5e8f757b8
Use alloca(3) instead of local xmalloc for creating our DoneLists.
...
This allows threaded programs to use us a little better, PR lib/43005.
We need to disable SSP when using alloca.
2010-03-18 22:17:55 +00:00
roy
b02ec7e9f8
Implement negative cache checks for symbol lookups.
...
Uses the Donelist idea from FreeBSD.
2010-02-27 11:16:38 +00:00
skrll
d306de736d
Restore backwards compatibility for binaries referencing the main
...
Obj_Entry.
2010-01-17 08:04:20 +00:00
skrll
2e0bcc8d3b
Remove cargo cult dlinfo entry point.
2010-01-16 10:37:51 +00:00
skrll
418048d731
Put the dlopen,and friends entry points back.
...
They're needed by pre-2.0 binaries. Backward compatibiliity for these
was broken by another commit recently which I'll fix shortly.
2010-01-15 07:07:11 +00:00
skrll
699646b3ea
Remove the entry points for dlopen() and friends. They haven't been used
...
since Aug 2003.
2010-01-14 21:52:07 +00:00
skrll
15b7ff0199
Make DEBUG build compile.
2010-01-14 12:12:07 +00:00
skrll
f88b3d9061
Wrap a few long lines.
2010-01-14 11:58:31 +00:00
skrll
c2796a5929
Shut gcc up.
2010-01-14 11:57:06 +00:00
skrll
8b4b9f3e56
Shut gcc up.
2010-01-13 22:34:07 +00:00
christos
12bd4dbd45
PR/39240: Satoshi Suetake: Don't fail when attempting to resolve weak symbols
...
when we are doing immediate binding, leave them alone and they will be dealt
with later during lazy binding. From skrll@
2010-01-13 20:17:21 +00:00
skrll
8f7db61734
Reset the COMBRELOC cache Obj_Entry if it was freed.
...
Fixes PR 41482. Done slightly differently to the patch in the PR.
2010-01-10 07:29:47 +00:00
skrll
fa7832d0b1
Fixup comment.
2010-01-10 06:37:32 +00:00
skrll
09298c1411
Small tidyup.
2010-01-09 15:36:43 +00:00
mrg
249d1f1111
use COPTS for -G0.
...
replace ${CPUFLAGS:M-mabi=64:M-mabi=o64} with two constructs.
the former doesn't seem to work anymore.
2009-12-18 17:10:07 +00:00
matt
d8d1440d5c
Merge from matt-nb5-mips64:
...
Add N32/N64 support for mips dynamic loader.
2009-12-14 00:41:18 +00:00
mrg
750ad3d59d
simplify the logic for compat ld.elf_so and move it here. we now can
...
find the libc objdir for multiple compat ld.elf_so's, too.
2009-12-13 09:31:47 +00:00
mrg
6af15ae20b
if BSD_MK_COMPAT_FILE is defined, .include it.
2009-12-13 09:01:45 +00:00
mrg
f7f0bc40ae
rename LD32DIR to MLIBDIR.
2009-12-13 08:25:20 +00:00
christos
1dc0b61eca
If the environment is corrupt, die. From FreeBSD.
2009-12-02 15:50:13 +00:00
skrll
77fd7698f3
Make _rtld_pagesz of type size_t.
...
Fixes round_down for alpha which made ldd(1) break.
2009-11-17 18:44:33 +00:00
skrll
b9fe4e7d17
Add RCSID
2009-11-11 14:15:41 +00:00
skrll
ef99e95537
Fix start symbols for new binutils.
2009-11-04 17:02:43 +00:00
skrll
d43e9fc212
Fix start symbol for newer binutils.
2009-10-22 21:56:13 +00:00
skrll
15653ebb45
ld.elf_so grew more PLABELS with dlinfo so bump HPPA_PLABEL_PRE.
2009-09-25 17:49:56 +00:00
pooka
4c1e54d82b
Add Solarisa-like dlinfo() interface to the ELF dynamic linker.
...
Implement RTLD_DI_LINKMAP which returns a pointer to the linkmap
chain at the given object. Other Solaris queries are currently
unimplemented.
2009-09-24 21:21:33 +00:00
skrll
ffb28af545
Fix start symbol. I have no idea how this worked before.
2009-09-19 14:54:17 +00:00
skrll
4b849729b2
Fix the start symbol.
2009-09-12 07:22:16 +00:00
jmmv
2cb749c2fd
Remove trailing \n in calls to _rtld_error: a newline is automatically
...
added by a call to the function.
2009-08-29 13:46:54 +00:00
he
45932f91e5
Apply fix borrowed from i386: Fix const issue (cast const pointers
...
to "const uint8_t *" instead of "caddr_t").
2009-05-24 20:35:41 +00:00
he
237687b934
Copy build fix from i386: Fix const issues (cast const pointers
...
to "const uint8_t *" instead of "caddr_t").
2009-05-24 18:29:03 +00:00
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
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