about summary refs log tree commit diff
path: root/src/ldso/dynlink.c
Commit message (Collapse)AuthorAgeFilesLines
* protect against cancellation in dlopenRich Felker2012-02-071-2/+5
| | | | | | | i'm not sure that it's "correct" for dlopen to block cancellation when calling constructors for libraries it loads, but it sure seems like the right thing. in any case, dlopen itself needs cancellation blocked.
* reduce some wasted space in dso structureRich Felker2012-02-071-3/+3
|
* run ctors/dtors for shared objects loaded with dlopenRich Felker2012-02-061-0/+1
|
* add support for init/finit (constructors and destructors)Rich Felker2012-02-061-0/+19
| | | | | | | | | | this is mainly in hopes of supporting c++ (not yet possible for other reasons) but will also help applications/libraries which use (and more often, abuse) the gcc __attribute__((__constructor__)) feature in "C" code. x86_64 and arm versions of the new startup asm are untested and may have minor problems.
* include dummied-out dlopen and dlsym functions for static binariesRich Felker2012-02-031-1/+10
| | | | | | | | | these don't work (or do anything at all) but at least make it possible to static link programs that insist on "having" dynamic loading support...as long as they don't actually need to use it. adding real support for dlopen/dlsym with static linking is going to be significantly more difficult...
* fix broken copy relocations from dynamic linker cleanupRich Felker2012-01-231-1/+4
| | | | | this issue affected programs which use global variables exported by non-libc libraries.
* dynamic linker support for PIE binaries (position-independent main program)Rich Felker2012-01-231-3/+6
| | | | | even with this change, PIE will not work yet due to deficiencies in the crt1.o startup code.
* cleanup dynamic linker, removing some code duplicationRich Felker2012-01-231-80/+66
|
* fix dynamic linker not to depend on DYNAMIC ptr in 0th entry of GOTRich Felker2012-01-201-3/+12
| | | | | | | | | | this fixes an issue using gold instead of gnu ld for linking. it also should eliminate the need of the startup code to even load/pass the got address to the dynamic linker. based on patch submitted by sh4rm4 with minor cosmetic changes. further cleanup will follow.
* fix char signedness bug in dynlinker hash functionRich Felker2012-01-171-1/+2
| | | | | this only affects non-ascii symbol names, which are probably not in use anyway..
* disable dynamic linking/loading code in static libc builds, for nowRich Felker2011-09-181-0/+2
| | | | | it does not work, but some configure scripts will falsely detect support then generate programs that crash when they call dlopen.
* ldso: move the suid/secure check code closer to env/auxv processingRich Felker2011-08-161-7/+7
| | | | | | this does not change behavior, but the idea is to avoid letting other code build up between these two points, whereby the environment variables might get used before security it checked.
* honor AT_SECURE aux vector flagRich Felker2011-08-161-2/+2
|
* RTLD_NEXT supportRich Felker2011-08-161-3/+8
| | | | | the asm wrapper is needed to get the return address without compiler-specific extensions.
* LD_PRELOAD supportRich Felker2011-08-161-0/+20
|
* when resolving symbols with only weak defs, use first def, not last defRich Felker2011-07-251-0/+1
|
* fix resolution of weak symbols (hopefully right now) and vdsoRich Felker2011-07-241-3/+9
|
* load vdso, if present, into the dso listRich Felker2011-07-241-2/+31
|
* simplify dynamic linker startupRich Felker2011-07-241-23/+17
| | | | | | instead of creating temp dso objects on the stack and moving them to the heap if dlopen/dlsym are used, use static objects to begin with, and just donate them to malloc if we no longer need them.
* fix dlopen UB due to longjmp/volatile rules violationRich Felker2011-07-011-1/+1
|
* simple rpath support (no token expansion yet) for dynamic linkerRich Felker2011-06-301-2/+8
|
* textrel support, cheap and uglyRich Felker2011-06-291-0/+5
|
* reclaim the memory wasted by dynamic linking for use by mallocRich Felker2011-06-281-0/+39
|
* use load address from elf header if possibleRich Felker2011-06-281-1/+1
| | | | | | | | | this is mostly useless for shared libs (though it could help for prelink-like purposes); the intended use case is for adding support for calling the dynamic linker directly to run a program, as in: ./libc.so ./a.out foo this usage is not yet supported.
* make dynamic linker relocate the main program image last, after all libsRich Felker2011-06-281-0/+1
| | | | | prior to this change, copy relocations for initialized pointer variables would not reflect the relocated contents of the pointer.
* fix stale pointer issue in dynamic linker with dlopenRich Felker2011-06-261-0/+1
|
* don't leave the lock held on dlopen failure..Rich Felker2011-06-261-2/+2
|
* add RTLD_DEFAULT supportRich Felker2011-06-261-1/+2
|
* in dlopen: don't use null pointerRich Felker2011-06-261-3/+3
| | | | deps can be null if a library has no dependencies (such as libc itself)
* fix resolving symbols in objects loaded in RTLD_LOCAL modeRich Felker2011-06-261-0/+11
| | | | | | basically we temporarily make the library and all its dependencies part of the global namespace but only for the duration of performing relocations, then return them to their former state.
* experimental dlopen/dlsym and dynlink changes needed to support themRich Felker2011-06-261-8/+125
|
* error handling in dynamic linkingRich Felker2011-06-261-2/+19
| | | | | | some of the code is not yet used, and is in preparation for dlopen which needs to be able to handle failure loading libraries without terminating the program.
* fix some symbol resolution issues in dynamic linkerRich Felker2011-06-251-4/+4
| | | | | 1. search was wrongly beginning with lib itself rather than dso head 2. inconsistent resolution of function pointers for functions in plt
* handle library paths better (ignore empty path components, etc.)Rich Felker2011-06-251-3/+5
|
* fix possible (questionable) strict aliasing violations and ptr arithRich Felker2011-06-251-3/+3
|
* proper path searching for dynamic linkerRich Felker2011-06-251-14/+38
| | | | | first, use $LD_LIBRARY_PATH unless suid. if that fails, read path from /etc/ld-musl-$ARCH.path and fallback to a builtin default.
* discard dso descriptors after performing relocationsRich Felker2011-06-251-0/+12
| | | | | eventually (once dlopen exists) this behavior will be conditional on dlopen/dlsym not being reachable.
* keep track of which dsos have been relocatedRich Felker2011-06-251-0/+1
|
* prepare support for LD_LIBRARY_PATH (checking suid/sgid safety)Rich Felker2011-06-231-0/+6
| | | | | | | | | | the use of this test will be much stricter than glibc and other typical implementations; the environment will not be honored whatsoever unless the program is confirmed non-suid/sgid by the aux vector the kernel passed in. no fallback to slow syscall-based checking is used if the kernel fails to provide the information; we simply assume the worst (suid) in this case and refuse to honor environment.
* dynamic linker 64bit fix: hash table entries are always 32bitRich Felker2011-06-181-2/+2
|
* experimental dynamic linker!Rich Felker2011-06-181-0/+385
some notes: - library search path is hard coded - x86_64 code is untested and may not work - dlopen/dlsym is not yet implemented - relocations in read-only memory won't work