summaryrefslogtreecommitdiff
path: root/ldso/ldso/dl-hash.c
AgeCommit message (Collapse)Author
2018-08-10rtld: Add #if defined (__FDPIC__)Christophe Lyon
Like for other FDPIC targets, add defined(__FDPIC__) where needed. * include/link.h: Include bits/elf-fdpic.h if __FDPIC__ is defined. (link_map): Use elf32_fdpic_loadaddr if __FDPIC__ is defined. (dl_phdr_info): Likewise. * ldso/include/dl-elf.h (__dl_parse_dynamic_info): Support __FDPIC__. * ldso/include/dl-hash.h (elf_resolve): Add funcdesc_ht field if __FDPIC__ is defined. * ldso/ldso/dl-hash.c (_dl_find_hash): Support __FDPIC__. * libc/misc/elf/dl-iterate-phdr.c (dl_iterate_phdr): Support __FDPIC__. Signed-off-by: Mickaël Guêné <mickael.guene@st.com> Signed-off-by: Christophe Lyon <christophe.lyon@st.com>
2017-06-21remove editor hints for viWaldemar Brodkorb
2016-02-07frv: resurrect port somehow, totally untestedWaldemar Brodkorb
The FR-V port is really broken, and I have no emulator or hardware for this platform. I tried to get some hardware from RedHat, who made the FR-V port initially. Unfortunately Fujitsi didn't agreed to sent me some of their unused spare hardware lying @RedHat. As I invested some time to get stuff compiled, I decided to add the code and may be anytime later I can gain access to some emulator or hardware. GDB simulator for FR-V doesn't support booting Linux AFAIK.
2012-06-06Clean up DSBT supportMark Salter
The existing DSBT support relies on the kernel to provide DSBT info as part of the load maps passed to user space. The problem with this approach is that the DSBT info is in the dynamic section, so the kernel must access a userspace mapping of the dynamic section (or separately read a copy for the kernel) in order to retrieve the information needed by userspace. This patch reworks the DSBT support to remove the reliance on DSBT info coming from the kernel. Instead, ldso reads the info itself from the dynamic section. One other benefit of this is that it allows the existing kernel FDPIC loader to also load DSBT binaries. Signed-off-by: Mark Salter <msalter@redhat.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-15ldso: remove duplicated assignment with TLS symbolCarmelo Amoroso
The tpnt field is already set, so not needed to assign it again. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-07-27ldso/mips: dlsym() incorrectly matches undefined symbolsKevin Cernekee
check_match() relies on checking for (sym->st_value == 0) to see if the symbol is undefined. This works reasonably well on most architectures, such as ARM or i386: $ readelf -s /lib32/libcap.so.2 | grep -E "\<malloc\>" 17: 00000000 0 FUNC GLOBAL DEFAULT UND malloc@GLIBC_2.0 (2) However, on MIPS, libbfd puts nonzero data in the st_value field to facilitate resetting the symbol's GOT entry if the library that defines the symbol gets unloaded: $ mipsel-linux-readelf -s libfoo.so | grep -E "\<malloc\>" 74: 00003140 0 FUNC GLOBAL DEFAULT UND malloc This can cause check_match to report a false positive when examining the external symbol reference. Consequently dlsym() will return a bad pointer to the caller. Use the special MIPS logic from glibc-ports-2.13 to avoid this situation. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-01-21Merge remote branch 'origin/master' into prelinkCarmelo Amoroso
* origin/master: bump version to 0.9.32-rc2-git release 0.9.32-rc2 nptl: Fix __USER_LABEL_PREFIX__ concatenatio nptl: fix start_thread() for _STACK_GROWS_UP ldso: get rid of _dl_lookup_hash Add protected symbols support for all architectures Revert "ldso/arm: Correct protected symbol resolution" Revert "ldso_sh: add support for protected symbols to SH" Revert "ldso/i386: support protected symbols" cris: Fix build issues syslog: fix 'everyone logs with user facility' __psfs_parse_spec: always use long int for %p buildsys: headers target should not depend on sysnum.h buildsys: fix make release target nptl: get rid of the last preprocessor warning when __ASSUME_TGKILL is not defined remove uClibc_ctype.h if !LOCALE Revert "Makefile.in: Add header to 'all' target" nptl: get rid of preprocessor warning when __ASSUME_TGKILL is not defined Conflicts: ldso/include/dl-hash.h ldso/ldso/arm/elfinterp.c ldso/ldso/avr32/elfinterp.c ldso/ldso/bfin/elfinterp.c ldso/ldso/cris/elfinterp.c ldso/ldso/dl-hash.c ldso/ldso/i386/elfinterp.c ldso/ldso/m68k/elfinterp.c ldso/ldso/mips/elfinterp.c ldso/ldso/powerpc/elfinterp.c ldso/ldso/sh/elfinterp.c ldso/ldso/sh64/elfinterp.c ldso/ldso/sparc/elfinterp.c ldso/ldso/x86_64/elfinterp.c ldso/ldso/xtensa/elfinterp.c ldso/libdl/libdl.c Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-01-20ldso: get rid of _dl_lookup_hashCarmelo Amoroso
Now _dl_find_hash and _dl_lookup_hash are exactly the same, we can get rid of the _dl_lookup_hash, reverting the _dl_find_hash from a wrapper of _dl_lookup_hash to its original role. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2011-01-20Add protected symbols support for all architecturesSalvatore Cro
Protected symbols are global symbols for which interposition is not allowed. We manage them in generic _dl_lookup_hash function. To handle protected symbols we need to get a reference to the module that defines the symbol itself. So we pass a new parameter 'struct symbol_ref' to the __dl_lookup_hash that is defined as below: struct symbol_ref { const ElfW(Sym) *sym; struct elf_resolve *tpnt; }; The tpnt field is used as an ouput parameter and refers to the module which defines the protected symbol. Further it can be used as output parameter for TLS relocations and FDPIC case. The sym field is instead used as an input parameter to detect the visibility of the symbol we are looking-up. In this way we get rid of different signatures for _dl_lookup_hash, allowing to remove the _dl_find_hash wrapper. This new structure is also suitable for prelink integration. Signed-off-by: Salvatore Cro <salvatore.cro@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17ldso: Fix loadaddr and mappaddr when prelink support is enabled.Filippo Arcidiacono
Fixed loadaddr and mappaddr fields to correctly work when prelink support is enabled. - loadaddr is an offset relative to the first loadable segment. - mapaddr is the address where the object has been mapped in memory. Non PIC library detection fixed too. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17ldso: Add runtime prelink supportFilippo Arcidiacono
Added runtime prelink support to be able to run a prelinked application; at process startup only the conflicts will be relocated. This speed up the startup time. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17ldso: Add support for LD_WARN and LD_TRACE_PRELINKINGFilippo Arcidiacono
Added support for the following tracing capabilities: - LD_WARN to warn about undefined symbols during the lookup stage. - LD_TRACE_PRELINKING to trace the needed libraries of the object that we are prelinking. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-09-17ldso: Rework global scope handling and symbol lookup mechanismFilippo Arcidiacono
Global symbol scope is implemented as a linked list of local scope, that dynamically grows and shrinks when dlopen/ dlclose are called. Each local scope is implemented as an array of pointer to struct elf_resolve. This will help to detect conflict when LD_TRACE_PRELINKING option will be implemented. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2009-12-17check if USE_TLS is defined before useHans-Christian Egtvedt
This patch will convert all the #ifdef USE_TLS and #if USE_TLS to #if defined(USE_TLS) && USE_TLS. By checking if the USE_TLS is defined before checking its value will result in correct behavior for architectures not defining this config symbol. Signed-off-by: Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com> Acked-by: Carmelo AMOROSO <carmelo.amoroso@st.com>
2009-10-16ldso: fixup missed variable rename ( tls_tpnt -> tpntp )Austin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-10-15ldso: simplify handling of extra _dl_lookup_hash() argMike Frysinger
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-10-15ldso: clean up breakage in tls mergeMike Frysinger
The TLS merge 534661b91c9849 introduced multiple style problems as well as random breakage: - missing _dl_free - incomplete parametrization of _dl_lookup_hash - restore FDPIC handling in _dl_lookup_hash Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2009-09-26ldso/: tls support for dynamic linkerAustin Foxley
Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-01-10simple optimizations and style fixes in dynamic loadingDenis Vlasenko
text data bss dec hex filename - 16709 240 92 17041 4291 lib/ld-uClibc.so + 16634 236 92 16962 4242 lib/ld-uClibc.so - 4602 344 4 4950 1356 lib/libdl-0.9.30-svn.so + 4571 328 4 4903 1327 lib/libdl-0.9.30-svn.so - 4602 344 4 4950 1356 lib/libdl.so + 4571 328 4 4903 1327 lib/libdl.so
2008-12-22- non-pic support for MIPS (Catherine Moore, clm at codesourcery com)Bernhard Reutner-Fischer
2008-11-18Move _dl_iterate_phdr into libc.so.0 and libc.a (as glibc does).Carmelo Amoroso
Currently we have an implementation in ld.so and libdl.a. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2008-07-23- fix inline keywordBernhard Reutner-Fischer
2008-03-11Move calculation of rem within if (unlikely statementCarmelo Amoroso
Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com> SIgned-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2008-03-09Khem Raj <kraj@mvista.com> writes:Carmelo Amoroso
While compiling trunk on ARM with GCC 4.2 and enabling LDSO_GNU_HASH_SUPPORT I stumbled upon this problem. GCC made a call to libgcc function __aeabi_uidivmod()->__div0()->__raise() and raise is not yet compiled in at the time of compiling ldso so I got well known undefined symbol __raise problem This patch uses the do_rem () macro to do the same operation.
2008-02-08Fix the recent dladdr changes so that they compile on FD-PIC targets.Bernd Schmidt
2008-01-18This patch solves a problem in dladdr caused by the wrong valueCarmelo Amoroso
of elf_resolve's loadaddr field for the main application. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2008-01-09fix broken whitespace in many places; no functional changesMike Frysinger
2007-12-03Fix a few warnings introduced by my previous commits.Bernd Schmidt
2007-12-03Blackfin FD-PIC patch 3/6.Bernd Schmidt
Change _dl_find_hash to _dl_lookup_hash, as on the NPTL branch. _dl_find_hash is now a wrapper function around it; unlike on the NPTL branch, it retains the old interface so that not all callers need to be changed. _dl_lookup_hash can optionally give its caller a pointer to the module where the symbol was found. Introduce ELF_RTYPE_CLASS_DLSYM for lookups from libdl. Spelling fixes in the Blackfin port, since Alex Oliva's original version of these patches used _dl_find_hash_mod as the name of the function rather than _dl_lookup_hash.
2007-11-07Added support for GNU hash style into dynamic linkerCarmelo Amoroso
2007-10-21Handle STT_COMMON symbols too. Following binutils releaseJoakim Tjernlund
will set the type of common symbols to STT_COMMON instead of STT_OBJECTS, so the dynamic linker needs to handle this type os symbols too. Same changes have been added to glibc (See: bugzilla #5104). This patch ensures the uclibc will work with later bintuils. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2007-10-08Do string comparisos as late as possible during symbol lookup.Mike Frysinger
Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2007-09-28Make sure that the DSO has an hash table into its elf, otherwise skipMike Frysinger
the lookup over next DSO. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2007-01-09Joseph S. Myers writes:Joakim Tjernlund
ELF symbol names are arbitrary 0-terminated sequences of bytes, and the ELF hash function is defined in the ELF specification to use unsigned char. Thus uClibc's _dl_elf_hash, using plain char, breaks when char is signed and symbol names contain bytes with the high bit set, as with GCC's ucnid-* tests. This patch fixes this problem.
2006-11-16revert rev 16527 changes to ldso/ldso/dl-hash.cEric Andersen
2006-11-10This change reimplements the ARM _dl_linux_resolve entry point - this isEric Andersen
called to resolve DLL PLT entries. The assembler is changed to be thumb compatible and slightly faster, the C function, _dl_linux_resolver (note the extra r) is changed to take a byte address in place of an 8 byte count (faster in caller and callee, and slightly easier to understand).
2006-07-05patch from Bernd Schmidt to abstract away initializing of relocation addressesMike Frysinger
2006-07-05patch from Bernd Schmidt to abstract away load address typesMike Frysinger
2006-07-05use ElfW(Addr) in more placesMike Frysinger
2006-07-05revert fdpic patch so we can merge it in bit by bitMike Frysinger
2006-06-30Bernd Schmidt writes: abstract away addresses so we can support FDPIC ELFsMike Frysinger
2005-12-14fix signed/unsigned warnings and unused warningsMike Frysinger
2005-09-18Remove unused function.Joakim Tjernlund
2005-08-29some fixes by anemo in Bug 9 to play nicely with 32 or 64 bit hostsMike Frysinger
2005-07-13eat pointless whitespaceMike Frysinger
2005-07-13use Elf32_Word instead of uint32_t since that is what the ELF spec refers toMike Frysinger
2005-07-11force hash buckets to work off of 32bit quantitiesMike Frysinger
2005-06-30create generic ELF_* macros to hide 32/64 bit differencesMike Frysinger
2005-06-30change all Elf32_* usage to ElfW(*) usage since we shouldnt care about the ↵Mike Frysinger
bitsize
2005-06-30The function '_dl_memset' should always be inlined regardless of the"Steven J. Hill"
optimization level chosen. This allows uClibc to be compiled with the latest GCC-4.1.0. While tracking down the specific culprit causing the segmentation fault of the dynamic loader with GCC-4.1.0 I was able to force inlining of other functions such that I shaved 512 bytes off the size of the loader, yay. Also fixed warning in 'dl-hash.c'.