summaryrefslogtreecommitdiff
path: root/ldso/ldso/powerpc/elfinterp.c
AgeCommit message (Collapse)Author
2017-01-14ldso: do not resolve relocations for debug, dig them up when debuggingWaldemar Brodkorb
Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
2012-06-15ppc/elfinterp.c: fix comment typosPeter S. Mazinger
Signed-off-by: Peter S. Mazinger <ps.m@gmx.net> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2012-03-25ldso: use ELF_xxx()/ElfW() helpersMike Frysinger
They expand into the same code, but using the ELF_xxx()/ElfW() macros makes it much easier to spot similarities between code bases. Acked-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Acked-by: Carmelo Amoroso <carmelo.amoroso@st.com> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2011-10-14ldso: silence harmless warning for !LDSO_PRELINK_SUPPORTBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.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-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-10-11ldso: Extend prelink support for all other achitecturesFilippo Arcidiacono
Update Arch specific part of the dynamic linker to the latest cahnges required by prelink: - Use _dl_loaded_modules->scope as global symbol scope - Pass the sym argument (or NULL) to the _dl_find_hash - Update _dl_parse, _dl_do_reloc, _dl_do_lazy_reloc and _dl_parse_relocation_information to reflect the change of the scope argument's type - Add the call to _dl_debug_lookup used for trace prelinking. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
2010-05-09powerpc: Add TLS and NPTL supportKhem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-11-15ldso: Add missing newlines to some debug messagesBernhard Reutner-Fischer
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2009-10-14ldso: fixup all the rest of the calls to _dl_find_hashAustin Foxley
With TLS _dl_find_hash grew an extra param. These archs don't have TLS reloc support yet, but they do need to compile without it. Signed-off-by: Austin Foxley <austinf@cetoncorp.com>
2009-01-28Remove check for the relocation type check in the resolver,Carmelo Amoroso
from all archs. Signed-off-by: Jiri Olsa <olsajiri@gmail.com>
2008-07-23- trim any trailing whitespaceBernhard Reutner-Fischer
2008-07-23- fix inline keywordBernhard Reutner-Fischer
2007-06-04Correct return value. Pointed out by psm.Joakim Tjernlund
2007-01-05Support SecurePLTs for PowerPC. You need a toolchain that supportsJoakim Tjernlund
config option --enable-secureplt. The assembler must also supports R_PPC_REL16* relocations. gcc 4.1.1 and binutils 2.17 is known to do this.
2006-06-19eat extraneous ; and insert some whitespace where it belongsMike Frysinger
2005-11-21Partly undo earlier patch on vapier's requestPeter S. Mazinger
2005-11-21Guard debug_sym/debug_reloc, make sure elfinterp.c sees __SUPPORT_LD_DEBUG__Peter S. Mazinger
2005-10-29Hopefully fix the bug Oleg reported in ↵Joakim Tjernlund
http://uclibc.org/lists/uclibc/2005-October/012809.html This will only fix powerpc. Should be easy to fix the other arches.
2005-07-07rip out all the duplicated debug code and move into a shared fileMike Frysinger
2005-03-29Moved the addition of load address from the fast pathJoakim Tjernlund
where possible. This will also make ldso smaller. However the patch touches all archs and I have only tested PPC and x86.
2005-03-14Generalize optimized relative reloc procesing.Joakim Tjernlund
Add elf_machine_dynamic() and elf_machine_load_address() for all archs. elf_machine_dynamic() replaces the #ifdef mess to get at the GOT. elf_machine_load_address() is needed to execute ldso directly, this is not complete yet. I probably broke one or two archs(only tested PPC) so please try and report problems. For a report to be useful you need to enable __SUPPORT_LD_DEBUG_EARLY__ and __SUPPORT_LD_DEBUG__
2005-03-10Use DT_RELCONT_IDX to optimize the relocation of R_PPC_RELATIVEJoakim Tjernlund
relocs. All RELA arches can probably copy this. REL archs will have to delete the "+ rpnt->r_addend" from the loop.
2004-11-10Add RTLD_LOCAL support for dlopened libs. Reported byJoakim Tjernlund
Andrew de Quincey, who has been most helpful getting this sorted out, thanks. Thanks also to Peter Mazinger who did alot of testing. Removed all traces of dl_parse_copy_information() since it is no longer used.
2004-10-07Remove usage of _dl_parse_copy_information() from generic code.Joakim Tjernlund
Remove definition of _dl_parse_copy_information() for powerpc. Remaining archs can do the same. Make debugging output of "relocation processing: xxx" a bit more sane.
2004-09-23Make powerpc look more like the other archs.Joakim Tjernlund
2004-09-17Bugfix: Add r_addend to final address. The r_addend is mostly zeroJoakim Tjernlund
but can be nonzero for JMP relocs as well. All Rela arches need to do this, test and send a patch :) Remove unneeded test in R_PPC_COPY.
2004-09-16Don't allow undefined global symbols to pass(all archs needs fixing).Joakim Tjernlund
If you are using buildroot and soft floating point, you may have to rebuild the libm.so library, copy it to staging_dir/lib and rebuild your application. Cleanups as well.
2004-08-26Stefan Allius writes:Joakim Tjernlund
"I fixed the _dl_parse_copy_information in the same way than for the powerpc and it works fine for me. You may luck at the patch for the powerpc/elfinterp.c, where I change the paramter of a dl_dprintf statement. Now we use the same parameters than for the relocation copy." Arch mantainers, please do the same. When all arches has been fixed, we can remove of _dl_parse_copy_information, it is just a waste of CPU cycles.
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-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-20Whine about R_PPC_REL24 relocations, and tell people to compileEric Andersen
shared libraries with -fPIC
2004-02-14Give gcc branch prediction some hits on obviously unlikely branchesEric Andersen
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-01-31Revert to scope as used by original code for now, just in case.Eric Andersen
I still don't have a good handle on why and when the different scope values should be used.
2004-01-30Joakim Tjernlund writes:Eric Andersen
> Not there yet, but the interfaces are much closer now... > Heading to bed though, since its 5:30am. :-) This works, but I discovered something "funny". For all relocs but COPY you can use scope instead of scope->dyn->symbol_scope and it is much faster to do that. Search for "Funny" in the patch to see what I mean. Probably I probably broke something, please let me know if it works for you too. I think I am done with ldso now. Has been fun and I hope to actually use uClibc/busybox soon in a project. Ohh, there is one thing left, double sized PLT entries, but maybe these aren't needed in uClibc? Sweet dreams Jocke
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-29Joakim Tjernlund writes:Eric Andersen
Here is the cleaned up laze reloc patch. Summary: - Minor cleanup. - disable the "if (finaladdr <= 0x01fffffc || finaladdr >= 0xfe000000)" test since it almost never triggered. - Optimized the lazy relocs handling. Would be great if you could commit ASAP. Jocke
2004-01-29Fixup silly typoEric Andersen
2004-01-24Joakim Tjernlund writes:Eric Andersen
Hi again I have done some serious clenup of powerpc/elfinterp.c - Make it look more like glibc. - Performance modifictions. - Fixed a few bugs in _dl_do_reloc(). These seem not to have affected anything, but this how glibc do it. Jocke
2004-01-20Joakim Tjernlund writes:Eric Andersen
> Is there anything I can do/provide that would assist in the solving of > this problem on PowerPC? I'm still concerned about my lack of flash space... Try this path. It fixes the recent ldso problems for me on my mpc860 board. You should be able to use ldso without the dcbx patch to the kernel now. Please report back. Jocke
2003-12-03Joakim Tjernlund writes:Eric Andersen
This is just a wild guess, but you could try this to see if it fixes Richards problem:
2003-11-13Joakim Tjernlund writes:Eric Andersen
I think I messed up a little in my latest patch to Erik. Can you try this on top of CVS(which I think you have already) Jocke And later writes: Hi Erik I just saw something that might be a problem. The "delta" variable is signed and the "delta" calculations, such as delta = PLT_LONGBRANCH_ENTRY_WORDS*4 - (insn_addr-plt_addr+4), are supposed to be unsigned. Jocke
2003-11-11Joakim Tjernlund writes:Eric Andersen
Comparing glibc with uClibc makes me think that the delta calculations are wrong here. Comparing some more I still think there are a data_words[index] assignments missing. Here is a path that has both the data_words[index] and the above delta calclations. This also fixes a terribly obvious bug, also spotted by Joakim, which Erik introduced when he copied things from the i386 ldso code. With this patch applied, things now seem to be working perfectly!
2003-11-11Another cleanup patch from Joakim Tjernlund:Eric Andersen
Hi again Back at work. Here is a patch that fixes the 2 errors I found yesterday. I have excluded the "data_words[index]" part for now.
2003-11-08Joakim Tjernlund writes:Eric Andersen
> Very interesting. Do you have any suggestions for how > we could fix our powerpc shared library loader Removing those instr. comes with a very big performance penalty. To flush the dcache you will have read up to 8KB dummy data and to invalidate the icache you will have to execute up to 16KB nops. I don't know of any other way from user space. hmm, actually I think it will work reliable to perform a store to the same page(s) as the dcbst/icbi will act on. That way you will make the DTLB Error happen(if any) prior to the dcbst/icbi. The worst thing that can happen then is a regular DTLB Miss and that works for dcbst/icbi. You will have to lookout for if dcbst/icbi crosses a page boundary. Then you will have to perform a store to both pages. Jocke # And again later writes: Hi again I think I know what the problem is. The PPC_DCBST;PPC_SYNC;PPC_ICBI;PPC_ISYNC sequence is executed even if no modification has been done i some cases: _dl_linux_resolver(), the last else has no store for insns[0]. these is a insns[1] = OPCODE_B(delta - 4) that does not have a PPC_DCBST. _dl_do_lazy_reloc(), for R_PPC_NONE there is no store. for R_PPC_JMP_SLOT there is a insns[1] = OPCODE_B(delta)that does not have a PPC_DCBST. _dl_do_reloc(), for R_PPC_COPY there is no store. for R_PPC_JMP_SLOT there is a reloc_addr[1] = OPCODE_B(delta) that does not have a PPC_DCBST. _dl_init_got(), I THINK that the PPC_DCBST(plt); PPC_DCBST(plt+4); PPC_DCBST(plt+8); PPC_SYNC; PPC_ICBI(plt); PPC_ICBI(plt+4); PPC_ICBI(plt+8); PPC_ISYNC; is off a bit. The address range does not match the sum of the plt[] and tramp[] address range. Jocke # And then later added the comment: I think that the tramp[] part should be included in the PPC_DCBST/PPC_ICBI sequence. Then you have to add entries for plt+12 and plt+16. If the tramp[] part should be excluded, then all is well. Jocke
2003-11-06A few debugging cleanupsEric Andersen
2003-11-05Fix a misnamed arrayEric Andersen
2003-11-05Rework the powerpc lib loader to better match the other architecturesEric Andersen