summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf/powerpc
Commit message (Collapse)AuthorAgeFilesLines
* rtld-elf: use NULL instead of zero for pointers.pfg2016-04-191-1/+1
|
* Do not call callbacks for dl_iterate_phdr(3) with the rtld bind andkib2016-01-201-2/+2
| | | | | | | | | | | | | | | | | | phdr locks locked. This allows to call rtld services from the callback, which is only reasonable for dlopen(path, RTLD_NOLOAD) to test existence of the library in the image, and for dlsym(). The later might still be not quite safe, due to the lazy resolution of filters. To allow dropping the locks around iteration in dl_iterate_phdr(3), we insert markers to track current position between relocks. The global objects list is converted to tailq and all iterators skip markers, globallist_next() and globallist_curr() helpers are added. Reported and tested by: davide Reviewed by: kan Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
* Create a generalized exec hook that different architectures can hookimp2016-01-031-0/+2
| | | | | | into if they need to, but default to no action. Differential Review: https://reviews.freebsd.org/D2718
* Apply r246556 to powerpc:jhibbits2015-01-061-5/+5
| | | | | | | | | Avoid use of register variables, which some compilers (e.g. clang) don't like. It makes the code a little clearer as well. This allows a clang 3.5 built powerpc world to run (tested in a jail). MFC after: 1 week
* Fix the following -Werror warning from clang 3.5.0, while buildingdim2014-12-281-1/+1
| | | | | | | | | | | | | | | | | | rtld-elf for powerpc 32 bit: libexec/rtld-elf/powerpc/reloc.c:486:6: error: taking the absolute value of unsigned type 'Elf_Addr' (aka 'unsigned int') has no effect [-Werror,-Wabsolute-value] if (abs(offset) < 32*1024*1024) { /* inside 32MB? */ ^ libexec/rtld-elf/powerpc/reloc.c:486:6: note: remove the call to 'abs' since unsigned values cannot be negative if (abs(offset) < 32*1024*1024) { /* inside 32MB? */ ^~~ 1 error generated. Cast 'offset' to int, since that was intended, and should be safe to do on architectures with 32-bit two's complement ints. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D1387
* IFUNC symbol type shall be processed for non-PLT relocations,kib2014-08-291-0/+4
| | | | | | | | | | | | | | | | | | | e.g. when a global variable is initialized with a pointer to ifunc. Add symbol type check and call resolver for STT_GNU_IFUNC symbol types when processing non-PLT relocations, but only after non-IFUNC relocations are done. The two-phase proceessing is required since resolvers may reference other symbols, which must be ready to use when resolver calls are done. Restructure reloc_non_plt() on x86 to call find_symdef() and handle IFUNC in single place. For non-x86 reloc_non_plt(), check for call for IFUNC relocation and do nothing, to avoid processing relocs twice. PR: 193048 Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Revert r253748,253749avg2013-07-281-0/+1
| | | | | | This WIP should not have been committed yet. Pointyhat to: avg
* remove needless inclusion of machine/cpu.h in userlandavg2013-07-281-1/+0
| | | | MFC after: 21 days
* Add GNU hash support for rtld.kib2012-04-301-1/+1
| | | | | | | Based on dragonflybsd support for GNU hash by John Marino <draco marino st> Reviewed by: kan Tested by: bapt MFC after: 2 weeks
* Fix a missed file in r234580: replace the now-obsolete powerpc_mb() withnwhitehorn2012-04-231-2/+2
| | | | regular mb().
* Fix several problems with our ELF filters implementation.kib2012-03-201-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Do not relocate twice an object which happens to be needed by loaded binary (or dso) and some filtee opened due to symbol resolution when relocating need objects. Record the state of the relocation processing in Obj_Entry and short-circuit relocate_objects() if current object already processed. Do not call constructors for filtees loaded during the early relocation processing before image is initialized enough to run user-provided code. Filtees are loaded using dlopen_object(), which normally performs relocation and initialization. If filtee is lazy-loaded during the relocation of dso needed by the main object, dlopen_object() runs too earlier, when most runtime services are not yet ready. Postpone the constructors call to the time when main binary and depended libraries constructors are run, passing the new flag RTLD_LO_EARLY to dlopen_object(). Symbol lookups callers inform symlook_* functions about early stage of initialization with SYMLOOK_EARLY. Pass flags through all functions participating in object relocation. Use the opportunity and fix flags argument to find_symdef() in arch-specific reloc.c to use proper name SYMLOOK_IN_PLT instead of true, which happen to have the same numeric value. Reported and tested by: theraven Reviewed by: kan MFC after: 2 weeks
* Add support for preinit, init and fini arrays. Some ABIs, inkib2012-03-111-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | particular on ARM, do require working init arrays. Traditional FreeBSD crt1 calls _init and _fini of the binary, instead of allowing runtime linker to arrange the calls. This was probably done to have the same crt code serve both statically and dynamically linked binaries. Since ABI mandates that first is called preinit array functions, then init, and then init array functions, the init have to be called from rtld now. To provide binary compatibility to old FreeBSD crt1, which calls _init itself, rtld only calls intializers and finalizers for main binary if binary has a note indicating that new crt was used for linking. Add parsing of ELF notes to rtld, and cache p_osrel value since we parsed it anyway. The patch is inspired by init_array support for DragonflyBSD, written by John Marino. Reviewed by: kan Tested by: andrew (arm, previous version), flo (sparc64, previous version) MFC after: 3 weeks
* Additional icache paranoia: non-PLT relocations can modify the text segment.nwhitehorn2011-12-171-0/+4
| | | | | | | It is then important to make sure the icache is synchronized again to prevent (rare) random seg faults and illegal instructions. MFC after: 3 days
* Fix RTLD on PowerPC after r228435. Changing the order of init_pltgot()nwhitehorn2011-12-171-4/+11
| | | | | caused the icache to be invalidated at the wrong time, resulting in an icache full of nonsense in the PLT section.
* Add support for STT_GNU_IFUNC and R_MACHINE_IRELATIVE GNU extensions tokib2011-12-121-0/+15
| | | | | | | | | | | | | | | | | rtld on 386 and amd64. This adds runtime bits neccessary for the use of the dispatch functions from the dynamically-linked executables and shared libraries. To allow use of external references from the dispatch function, resolution of the R_MACHINE_IRESOLVE relocations in PLT is postponed until GOT entries for PLT are prepared, and normal resolution of the GOT entries is finished. Similar to how it is done by GNU, IRELATIVE relocations are resolved in advance, instead of normal lazy handling for PLT. Move the init_pltgot() call before the relocations for the object are processed. MFC after: 3 weeks
* When loading dso without PT_GNU_STACK phdr, only callkib2011-01-251-0/+3
| | | | | | | __pthread_map_stacks_exec() on architectures that allow executable stacks. Reported and tested by: marcel (ia64)
* Mark rtld on PowerPC as not requiring executable stack.kib2011-01-141-1/+1
| | | | Reviewed and tested by: nwhitehorn
* Implement support for ELF filters in rtld. Both normal and auxillarykib2010-12-251-17/+20
| | | | | | | | | | | | | | | | | filters are implemented. Filtees are loaded on demand, unless LD_LOADFLTR environment variable is set or -z loadfltr was specified during the linking. This forces rtld to upgrade read-locked rtld_bind_lock to write lock when it encounters an object with filter during symbol lookup. Consolidate common arguments of the symbol lookup functions in the SymLook structure. Track the state of the rtld locks in the RtldLockState structure. Pass local RtldLockState through the rtld symbol lookup calls to allow lock upgrades. Reviewed by: kan Tested by: Mykola Dzham <i levsha me>, nwhitehorn (powerpc)
* Fix two subtle problems in PPC32 RTLD. The first is a concurrency issuenwhitehorn2010-10-041-2/+5
| | | | | | | | | where long PLT calls in multi-threaded environments could end up with incorrect jmptab values. The second is that, after the addition of extended PLT support, I forgot to update the PLT icache synchronization code to cover the extended PLT instead of just the basic PLT. MFC after: 10 days
* Only use the cache after the early stage of loading. This isrdivacky2010-05-181-8/+4
| | | | | | | | | | because calling mmap() etc. may use GOT which is not set up yet. Use calloc() instead of mmap() in cases where this was the case before (sparc64, powerpc, arm). Submitted by: Dimitry Andric (dimitry andric com) Reviewed by: kan Approved by: ed (mentor)
* Support the extended PLT format used when objects have more than 8192nwhitehorn2010-02-223-25/+67
| | | | PLT relocations on PPC32.
* Now that the kernel defines CACHE_LINE_SIZE in machine/param.h, userwatson2009-04-191-2/+0
| | | | | | | | that definition in the custom locking code for the run-time linker rather than local definitions. Pointed out by: tinderbox MFC after: 2 weeks
* Include an extra header to get a function prototype.jb2007-11-191-0/+1
|
* Unbreak the dynamic linker by not creating a cache for rtld-elfmarcel2007-07-151-2/+6
| | | | | | | | | itself. It needs mmap(2), which now needs getosreldate(3) and which in turn uses a global variable to cache the result. This cannot be done before linking is done. See also: ../sparc64/reloc.c:1.15 Approved by: re (kensmith)
* o Fix the static TLS relocation. We were subtracting the size ofmarcel2006-09-011-2/+2
| | | | | | the TCB. o Use NULL for null pointer argument. o Replace magic 8 with TLS_TCB_SIZE.
* Implement ELF symbol versioning using GNU semantics. This code aimskan2005-12-181-1/+3
| | | | | | | | | to be compatible with symbol versioning support as implemented by GNU libc and documented by http://people.redhat.com/~drepper/symbol-versioning and LSB 3.0. Implement dlvsym() function to allow lookups for a specific version of a given symbol.
* Remove these unused files before any other archs include the same bogusjhb2004-11-121-169/+0
| | | | file.
* Implement TLS relocations for powerpc.ssouhlal2004-11-022-3/+73
| | | | Approved by: grehan (mentor)
* Add stubs for powerpc TLS.dfr2004-08-042-0/+41
| | | | Submitted by: ssouhlal
* Allow threading libraries to register their own lockingkan2003-05-293-36/+34
| | | | | | | | | | implementation in case default one provided by rtld is not suitable. Consolidate various identical MD lock implementation into a single file using appropriate machine/atomic.h. Approved by: re (scottl)
* No need to zero fill memory, mmapped anonymously. Kernel willkan2003-03-141-5/+1
| | | | | | return pre-zeroed pages itself. Noticed by: jake
* rtld support for PowerPC. Mostly obtained from NetBSD, with modsgrehan2002-12-045-0/+926
for binutils 2.13 Reviewed by: benno Approved by: re (blanket)
OpenPOWER on IntegriCloud