summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-elf.c
AgeCommit message (Collapse)Author
2004-08-25Patch from Stefan Allius:Joakim Tjernlund
Remove unused function parameter in ldso. Remove echo option '-e' since it is not supported on Solaris.
2004-08-17Let ldso decide if it should relocate itselft a second time. ThisJoakim Tjernlund
is needed if ldso should use libcs malloc whenever possible. Fix RTLD_LAZY propagation to RTLD_NOW relocation when requested by libdl.
2004-08-10Mike Frysinger writes:Joakim Tjernlund
i was sticking some libraries in non-standard (i.e. not-hardcoded) paths and then updating ld.so.conf accordingly ... oddly though, i couldnt get binaries that linked against those libraries to run ... `ldconfig -v` showed the required libraries being detected/cached, so something seemed wrong ... turns out the libraries were being tagged as LIB_ELF_LIBC0 in the cache and the loader currently only accepts LIB_ELF_LIBC{5,6} ... since readsoname.c in ldconfig defines needed_tab with the mapping 'libc.so.0' -> LIB_ELF_LIBC0 it seems like the loader should accept this type too find attached a small patch which adds LIB_ELF_LIBC0 along side LIB_ELF_LIBC{5,6} as an accepted lib type in the loader when dealing with the ld.so.cache file
2004-08-06Joakim Tjernlund writes:Eric Andersen
PPC32, SPARC32/64 and S390 includes the PLT in its RELA size. This caused ldso to always do unlazy relocation of the JMPRELs. This patch fixes it.
2004-07-30Teach libdl to use normal libc symbols whenever possible, i.e. mallocEric Andersen
rather than _dl_malloc, fprintf rather than _dl_printf, etc. -Erik
2004-07-16Revert this stuff for nowEric Andersen
2004-07-14Sigh. I got things working this morning, then checked stuff in from the wrongEric Andersen
tree. Bad boy, No doughnut. -Erik
2004-07-14Based on a patch from Alexandre Oliva, make sure _dl_malloc returns a nicelyEric Andersen
aligned pointer that may be aligned up to page_size. Also add _dl_free,
2004-06-12Jakub Bogusz from pld-linux dot org writes:Eric Andersen
Hello, I managed to get ldso (and thus shared linking to uClibc) to work on sparc (actually sparc64 kernel with 32-bit userspace), at least on simple "hello world" program (more complex ones not tested). Some notes on attached patch (against 0.9.26, would require some work to apply on current CVS - but I tested 0.9.26, not CVS): - ELF magic cannot be examined by _dl_strncmp so early, probably because of string constant, like on ppc/mips/sh (note that early SEND_STDERR still crashes when trying to do _dl_strlen - I suppose that string constants require relocation; but adding load_addr didn't help, just ELF header was displayed instead of crash) - mmap() is syscall6 like on ppc/mips/sh, not old i386 mmap() - for generic sparc (i.e. not sparcv8/sparcv9) gcc produces .udiv/.urem calls for unsigned integer / and % operators - so these operations must be avoided. I copied do_rem definition from arm header. But / and % are used also in _dl_simple_ltoa() and _dl_simple_ltoahex(); in ltoahex gcc optimizes it to shifts (but I think it's safer to use shifts explicitly, not rely on optimization...). I changed % in ltoa to do_rem, but as there was no do_div definition, I changed all "%d" specifiers to "%x" to avoid crashes (this changes wouldn't be needed if _dl_simple_ltoa() were fixed to not use division on sparc). - "#define SOLARIS_COMPATIBLE" in ld_sysdep.h broke ldso on Linux because of redefining _dl_linux_resolve only in some places (it was still referenced in INIT_GOT before redefinition). So _dl_linux_resolve redefinition should be moved before INIT_GOT definition or removed. - sparc64 kernel requires mmap() addresses to be aligned to 8192, not 4096, otherwise mmap() call failed - reloc_entry must be shifted by 10, not 12 (I found similar operation in glibc sources) Aside of sparc-specific fixes: - I moved some _dl_dprintf()s inside if(_dl_debug_*) conditions (to avoid debugging messages when LD_DEBUG is not defined) - it seems that there was possible off-by-one in ltoa and ltoahex? they are called with char[22] as 1st argument, and then '\0' is stored in local[22] (_before_ p decrementation)... or am I missing something? If not, fix is included in patch.
2004-05-11make certain that getpagesize() returns correct the value for mipsEric Andersen
by extracting the value from the ELF header.
2004-03-18Look in /usr/X11R6/lib as wellEric Andersen
2004-02-17When doing _dl_mmap to obtain a bit of anonymous memory, use a much moreEric Andersen
sensible -1 fd, rather than pretending to work off of fd 0, which makes absolutely no sense.
2004-02-14Joakim Tjernlund writes:Eric Andersen
Hi it is me again. This is the latest ldso patch. the NEW weak symbol handling works now with a little special handling in _dl_find_hash(). You get to chose if you want the new or old handling :) There was 2 missing _dl_check_if_named_library_is_loaded() calls in _dlopen(). I then disabled the _dl_check_if_named_library_is_loaded() in dl-elf.c since it is rendundant. Question, why does some _dl_linux_resolver(), like i386, have 2 calls to _dl_find_hash()? I think that is wrong, isn't it? I really hope you can check this out soon ...
2004-02-10oops, manditory forgotten patchEric Andersen
2004-02-10Fixup the definition of _dl_open, and move some bits back where they were,Eric Andersen
till I properly finish the next step in my evil plan.
2004-02-08Move _dl_printf and _dl_malloc to ldso, which is a more sensibleEric Andersen
location for this stuff
2004-02-08Cleanup whitespace and formattingEric Andersen
2004-02-07Step one, begin shuffling things around a bitEric Andersen
2004-02-07Use unsigned char * pointersEric Andersen
2004-02-06Remove trailing whitespaceEric Andersen
2004-02-04Use a static const char array for static stringsEric Andersen
2004-01-29Modify interfaces for _dl_parse_relocation_information()Eric Andersen
_dl_parse_lazy_relocation_information() and _dl_parse_copy_information() so they are all consistant, allowing for future consolidation. Trim some trailing whitespace as well.
2004-01-29Scrub up use of ELF_USES_RELOCA and eliminte some unsightly ifdefsEric Andersen
2004-01-29Eliminate separate passes for _dl_copy_fixups() and _dl_fixup(), andEric Andersen
do both operations in a single pass.
2003-12-17Use PAGE_SIZE rather than hard coding 4096Eric Andersen
2003-12-17When I switched from using stack allocated space for printf, I missed a caseEric Andersen
where a sizeof(foo) was changed to the sizeof a pointer. This caused _dl_printf to complain a lot when debug is enabled (which itself revealed a bug since it should have exited on buffer overflow), and let me to find another bug, where memory failures would try to recursively call _dl_printf.... What a mess.
2003-12-05move _dl_fixup so staticly linked apps using dlopen have aEric Andersen
chance of actually working
2003-12-03Eliminate some static buffers based on a patch from Tobias AnderbergEric Andersen
2003-11-05Fix a buglet that shows up on powerpcEric Andersen
2003-11-04Rework the config system. Better utilize the Kconfig languageEric Andersen
which should simplify enabling arbitrary architectures. -Erik
2003-10-09move the test for loading the wrong C library into theEric Andersen
_dl_check_if_named_library_is_loaded function
2003-09-19Initialize strings as pointers instead of arrays.Tobias Anderberg
2003-09-11Simplify an expression. Use static const on strings to avoidEric Andersen
a gcc 2.95 compiler problem on powerpc.
2003-09-02cleanup/simplify duplicate handling.Eric Andersen
2003-08-31Weed out duplicates before trying to load libraries.... DelayedEric Andersen
checking for duplicates and returning an alias if an existing lib is already loaded is still correct for the dlopen case.
2003-08-19Cool. Found most of the problem. Turns out we were inadvertanly loading someEric Andersen
libraries multiple times, wasting memory and causing different libraries to use different symbol sets, some of which were not properly resolved. Continue scrubbing ld.so and converting it to use proper types.
2003-08-19Phase one of my evil plan to clean up ld.so...Eric Andersen
2003-06-18Be extra careful to memset the correct size, not the size of some randomEric Andersen
pointer. Fix printing of '0x0x' in ldd output. Simplify discrimination of libname, so doing things like dlopen("./libfoo.so",RTLD_NOW) with a leading "./" in the path will work as expected. -Erik
2003-03-01Fix the shared library loader so we can properly debug things like pthreads.Eric Andersen
Mips gdb support for pthreads and similar complex stuff is broken, but then it couldn't have worked before either... -Erik
2003-01-24Support having libs in /usr/X11R6/lib by default as wellEric Andersen
2002-12-12Rework things such that staticly linked applications can useEric Andersen
dlopen and have it be successful. This required moving some things out of ldso.c into readelflib1.c, and directly including hash.c and readelflib1.c into dlib.c when building the static version of the library. -Erik
2002-11-20Kill SVR4_BUGCOMPATEric Andersen
2002-11-20Patch from Stefan Allius:Eric Andersen
- Invert all FORCE_SHAREABLE_TEXT_SEGMENTS checks. - Define FORCE_SHAREABLE_TEXT_SEGMENTS in the Makefile, so it can be configured by the config system. - linuxelf.h inspects that we don't combine FORCE_SHAREABLE_TEXT_SEGMENTS and SVR4_BUGCOMPAT - Add a new config option for FORCE_SHAREABLE_TEXT_SEGMENTS
2002-11-19Per suggestion from Stefan Allius, change DO_MPROTECT_HACKS toEric Andersen
the more clear FORCE_SHAREABLE_TEXT_SEGMENTS.
2002-11-19Stefan Allius writes:Eric Andersen
I fixed two little bugs in ldso.c: - For LDD support we test the old environment variable LD_TRACE_LOADED_OBJECTS. - Before we init the GOT table of the dynamic loader we have to check, if we have a DT_PLTGOT entry. If DT_PLTGOT was zero we patch somthing in the header of the dynamic loader. This was the cause, why we have to enable the DO_MPROTECT_HACKS option for all targets, to avoid segment faults. In readelflib1.c I added a warning, if we try to load a shared library, which wasn't compiled with -fPIC or -fpic. So if we disable the DO_MPROTECT_HACKS option we are sure, that we don't waste memory by shared libraries which aren't able to share their text segment. I think this is a helpful option on little embedded systems.
2002-11-05Massive scrubbing of the shared lib loader error handling.Eric Andersen
Move all configuration options into the new config system. -Erik
2002-10-01This commit contains a patch from Stefan Allius <allius@atecom.com> to changeEric Andersen
how uClibc handles _init and _fini, allowing shared lib constructors and destructors to initialize things in the correct sequence. Stefan ported the SH architecture. I then ported x86, arm, and mips. x86 and arm are working fine, but I don't think I quite got things correct for mips.
2002-09-05Fixed another address alignment where a pagesize of 4k were assumed.Tobias Anderberg
2002-08-19some updates from Stefan Allius to make up the SuperH shared libEric Andersen
loader build properly. Mostly just sprinkling casts, and making static some things that should be static.
2002-08-08Patch from Stefan Allius and Edie C. Dost to add SuperHEric Andersen
shared library support. This also adds some cleaner error handling, which I (Erik) then ported over to x86 and arm. In addition Stefan added the following fixes: - in hash.c was the lvalue handling of global library functions wrong. To fix this I had to change the prototype of _dl_find_hash. (==> TIS and ELF spec. Vers. 1.2) - in ldso.c was the order of the .init sections calls wrong. Before we call the initialization code of a library we have to check that all dependend libraries are already initialized. This can easily made by calling it in the revers loading order. For this I added a previous pointer chain. - in ldso.c the ELF magics wasn't checked fo PPC, MIPS and SH architecture