summaryrefslogtreecommitdiff
path: root/ldso
AgeCommit message (Collapse)Author
2004-08-19Accunt for ELF_MACHINE_PLTREL_OVERLAP when relocating ldso.Joakim Tjernlund
2004-08-19Remove poor man's malloc. Not needed anymore.Joakim Tjernlund
2004-08-19Move "debug_addr" ptr from dl-startup.c to ldso.cJoakim Tjernlund
2004-08-19Move the app specific stuff from dl-startup.c to ldso.c.Joakim Tjernlund
2004-08-19Oops, forgot to remove unused variable.Joakim Tjernlund
2004-08-19This is now done in ldso.cJoakim Tjernlund
2004-08-18Clean up the _dl_boot code and make it similar to arm and sh.Joakim Tjernlund
2004-08-17Carl SHAW writes:Eric Andersen
I finally tracked down the problem with SH4 shared library loading - in file ldso/ldso/sh/dl-startup.h, the line #define DL_BOOT(X) static void __attribute_used__ _dl_boot2 (X) should be #define DL_BOOT(X) static void* __attribute_used__ _dl_boot2 (X) otherwise the application code will never be called and _dl_boot will just return causing a segmentation fault. Carl
2004-08-17David McCulloug writes:Joakim Tjernlund
"There's a bug in the SH asm, it calls into 'C' code without preserving all the important scratch registers. I have been meaning to double check the changes as I think more registers need to be saved, then I was going to send it back to uClibc. From the sound of it this isn't your problem, but you never know. Attached is the patch as it stands for the loader on SH." Glibc appears to do the same.
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-17Fix make clean rule.Joakim Tjernlund
2004-08-16The pagesize variable used when starting up is _not_ the sameEric Andersen
as the _dl_pagesize global, so do not alias the global. -Erik
2004-08-13Fixup PAGE_SIZE problemsEric Andersen
-Erik
2004-08-13Fix usage_count in ldso/libdl.Joakim Tjernlund
Don't' use atexit in libdl. Make destrutor in libdl actually run and to dlclose all dlopened libs. Remove dlclosed libs from the _dl_symbol_tables list.
2004-08-10Optimze _dl_memset() for PowerPC.Joakim Tjernlund
Other arches may also benefit from this iff it can do unaligned stores.
2004-08-10Forgot _dl_memcpy in previous checkin.Joakim Tjernlund
2004-08-10_dl_strlen,_dl_strcat,_dl_strcpy,_dl_strcmp,_dl_strncmp,Joakim Tjernlund
_dl_strchr,_dl_strrchr,_dl_strstr,_dl_memcmp: Optimize for archs which can do pre increment/decrement and load/store in one instruction.
2004-08-10_dl_get_last_path_component:Joakim Tjernlund
handle "" strings and optimze it. _dl_simple_ltoa,_dl_simple_ltoahex: Optimize for archs which can do pre increment/decrement and load/store in one instruction.
2004-08-10Revmoved _dl_brkp and _dl_envp. They are not needed anymore.Joakim Tjernlund
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-10Mike Frysinger writes:Joakim Tjernlund
in libdl, the XXFLAGS is set incorrectly if DODEBUG=y ... it has 'I.' added to it instead of '-I.' ... this of course pisses of gcc :) find attached a patch that cleans up the XXFLAGS setting so as to minimize this kind of thing ... when asked, mjn3 said it was a kosher idea ;) and later writes: hmm it seems ldso also utilizes USE_CACHE in the code (but LIBRARY_CACHE never propogates down to the Makefiles) so the fix is to add $(LIBRARY_CACHE) while setting $(XXFLAGS) Applied with minor fixes and also fixed up ldso/Makefile to match libdl/Makefile.
2004-08-09This should fix the dlsym problem Peter van Hoyweghen reported.Joakim Tjernlund
However RTLD_LOCAL still doesn't work. Everything is RTLD_GLOBAL.
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-08-06Joakim Tjernlund writes:Eric Andersen
This patch makes -fpic work for PCC and optimzes the relcation by moving the cache flushing stuff to JMP relocs only. Actually PPCs ldso can only handle small GOT tables(<=8192 entries)anyhow, so it makes little sense to compile PPC with -fPIC. libuClibc shrunk from 340724 to 330780 bytes with -fpic.
2004-07-30s/___brk_addr/__curbrk/gEric Andersen
Some utilities, such as valgrind, have a legitimate reason to know the address of the current brk. Since we know such utils will peek under our skirt, we might as well give them what they expect and not use a gratuitously different symbol name. -Erik
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-30Whitespace cleanupEric Andersen
2004-07-30Fix screwed up indentingEric Andersen
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-27Joakim Tjernlund writes:Eric Andersen
Hi yet again :) in dl-startup.c when performing boot strap relocation the following test exists to make sure that only "_dl_" symbols are relocated: /* We only do a partial dynamic linking right now. The user is not supposed to define any symbols that start with a '_dl', so we can do this with confidence. */ if (!symname || !_dl_symbol(symname)) { continue; } However on PPC(and the other archs as well I suspect) all symbols are "_dl_" symbols so the test is never true. The test can be removed and the whole loop simplified(smaller). This also makes it possible to simplify elfinterp.c This remove the scanning of ldso.so relocs, making relocation faster. I have tested this on PPC and it works well. Do you think this optimization will work for the other arches as well? I can't see why not. Jocke * Tested on x86, arm, mipsel, and powerpc by Erik and works nicely -Erik
2004-06-24Disable support for R_ARM_PC24, just like R_PPC_REL24 these shouldEric Andersen
only occur when shared libs are not compiled with -fPIC
2004-06-20Let dl-string.h include dl-sysdep.h, since it has proper include guardsEric Andersen
2004-06-20Whine about R_PPC_REL24 relocations, and tell people to compileEric Andersen
shared libraries with -fPIC
2004-06-19Joakim Tjernlund writes:Eric Andersen
Make old weak symbol handling work, if someone wants to enable it.
2004-06-19Joakim Tjernlund writes:Eric Andersen
Since MIPS don't have COPY relocs it seems apropiate to define DL_NO_COPY_RELOCS. This will optimize dl_find_hash somewhat.
2004-06-19Joakim Tjernlund writes:Eric Andersen
Glibc does not use COPY class for SHN_COMMOM in MIPS. Make uClibc ldso the same.
2004-06-19Bradley D. LaRonde writes:Eric Andersen
dl-string.h references do_rem, but do_rem is a #define in <arch>/dl-sysdep.h which is not included by dl-sysdep.h. This causes a problem in libdl: In file included from ../../ldso/include/ldso.h:27, from libdl.c:33: ../../ldso/include/dl-string.h: In function `_dl_simple_ltoa': ../../ldso/include/dl-string.h:216: warning: implicit declaration of function `do_rem' Include dl-sysdep.h in dl-string.h before using do_rem.
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-14Alexandre Oliva writes:Eric Andersen
Here are a number of minor changes to FR-V-specific bits of the uClibc port: - I've adjusted the definition of _dl_mmap to cope with the fact that there will be a definition for an mmap2-only system. - We don't have COPY relocs, so optimize the copy reloc-related code away. - Change the page size to 16KiB, to match the ABI spec, and not a stale value I'd copied from a linker config file. Oops. - Fix error handling in clone and vfork; parts of the changes by David Howells <dhowells@redhat.com> - Rearrange includes in crtreloc.c. - Change the API of __syscall_error, to reduce code size. - Improve __syscall_return in terms of code size, so as to enable tail-calling of __syscall_error, at least within libc. Ideally, __syscall_error should be hidden within libc.so, but this didn't work because of libdl. I haven't looked into why, and figured I'd leave it visible for now. - Rename enumerators and macros in sys/ucontext.h to reduce namespace pollution.
2004-05-13update libdl so it also groks the new _dl_errnoEric Andersen
2004-05-13Bradley D. LaRonde writes:Eric Andersen
Oops, this adds the page alignment offset to the mprotected size. Regards, Brad
2004-05-12Patch from Bradley D. LaRonde:Eric Andersen
ld.so mprotect rwx .dyanmic segment for mips DT_DEBUG Allow writing debug_addr into the .dynamic segment. Even though the program header is marked RWE, the kernel gives it to us rx.
2004-05-12Add a local '_dl_errno' to be used by syscalls in ldso, allowingEric Andersen
useful syscall failure diagnostics.
2004-05-11As noticed by the sharp eyed Joakim Tjernlund, I stupidlyEric Andersen
hard coded 4096 instead of PAGE_SIZE. Because I'm an idiot.
2004-05-11make certain that getpagesize() returns correct the value for mipsEric Andersen
by extracting the value from the ELF header.
2004-05-11Bradley D. LaRonde, brad at laronde dot org writes:Eric Andersen
If I change that ELF_RTYPE_CLASS_COPY to ELF_RTYPE_CLASS_PLT to tell _dl_find_hash to ignore stubs when resolving undefined functions without stubs, the dlopen tests all pass. dlopen gets a pointer to the libc.so malloc instead of a pointer to the libpthread malloc stub. Yay! :-)
2004-05-10Save r0 before modifying it.Tobias Anderberg
2004-04-20Cope with gcc 3.4's more aggressive persuit of attribute unusedEric Andersen