about summary refs log tree commit diff
path: root/src/ldso
Commit message (Collapse)AuthorAgeFilesLines
* 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..
* dlsym entry point for armRich Felker2011-10-011-0/+6
|
* dynamic linker entry point for armRich Felker2011-10-011-0/+14
| | | | mildly tested, seems to work
* 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.
* fix RTLD_NEXT on x86_64Rich Felker2011-09-031-1/+1
| | | | | the return address was being truncated to 32 bits, preventing the dlsym code from determining which module contains the calling code.
* 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-164-3/+32
| | | | | 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.
* make ldso asm more uniform with rest of codebase (no unnecessary suffixes)Rich Felker2011-06-191-12/+12
|
* x86_64: ensure that dtor pointer passed to app is 0 so it won't be usedRich Felker2011-06-191-0/+1
| | | | | leaving it uninitialized caused unpredictable crashes or worse due to calling an indeterminate function pointer.
* dynamic linker 64bit fix: hash table entries are always 32bitRich Felker2011-06-181-2/+2
|
* experimental dynamic linker!Rich Felker2011-06-183-0/+412
| | | | | | | | 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
* various changes in preparation for dynamic linking supportRich Felker2011-02-241-0/+8
prefer using visibility=hidden for __libc internal data, rather than an accessor function, if the compiler has visibility. optimize with -O3 for PIC targets (shared library). without heavy inlining, reloading the GOT register in small functions kills performance. 20-30% size increase for a single libc.so is not a big deal, compared to comparaible size increase in every static binaries. use -Bsymbolic-functions, not -Bsymbolic. global variables are subject to COPY relocations, and thus binding their addresses in the library at link time will cause library functions to read the wrong (original) copies instead of the copies made in the main program's bss section. add entry point, _start, for dynamic linker.