summaryrefslogtreecommitdiffstats
path: root/linker
Commit message (Collapse)AuthorAgeFilesLines
* Print error when prelink fails for main executableDmitriy Ivanov2015-01-071-1/+4
| | | | | Bug: 18931021 Change-Id: Ieefdcf60f1506af522714300030754a4ed61c08e
* Revert "Fix dlsym() to take into account RTLD_GLOBAL/LOCAL"Dmitriy Ivanov2014-11-033-35/+19
| | | | | | | | This reverts commit c85e82dde5c4b2accc50a9e17740b9005dfbae6a. Bug: 18222321 Bug: 18211780 Change-Id: I32f4048bd5ea85dc8a3dfccce8cf141b241ab692
* Revert "Add RTLD_NODELETE flag support"Dmitriy Ivanov2014-11-032-24/+10
| | | | | | | | This reverts commit c87f65d2cd0690d81665f8b241c1d763f72b6f80. Bug: 18222321 Bug: 18211780 Change-Id: I00252e26a28a41ab9f1e2dd3b32f0f80d86297f1
* Revert "Fix relocation to look for symbols in local group"Dmitriy Ivanov2014-11-033-124/+79
| | | | | | | | This reverts commit fd2747bb585fc51b5ad56db09c0e9b66c7091a92. Bug: 18222321 Bug: 18211780 Change-Id: I2d4ebab1e73b7277161af76b99f8249825b22d65
* Revert "Remove unnecessary lookups during relocations"Dmitriy Ivanov2014-11-031-5/+22
| | | | | | | | This reverts commit 6442dbd3bcadbd5e522465743a8d8cf56338ae1c. Bug: 18222321 Bug: 18211780 Change-Id: I87b18a32238a1f75afe56149221b6691f50d9f56
* Revert "Fix mips build"Dmitriy Ivanov2014-11-031-1/+1
| | | | | | | | This reverts commit bf3d5ef5fd240d4c5fbde1b32f9084dbc720840b. Bug: 18222321 Bug: 18211780 Change-Id: I902ed888197b358c77303f1acb6d5ffd7ae6dcd3
* Revert "Fix symbol lookup order during relocation"Dmitriy Ivanov2014-11-033-128/+69
| | | | | | | | This reverts commit 976402cca13a1f4f3aa988fd301575e134ef5f2c. Bug: 18222321 Bug: 18211780 Change-Id: Iafdd3d843db7b1cf288be9a0232022816622c944
* Fix symbol lookup order during relocationDmitriy Ivanov2014-10-313-69/+128
| | | | | | | | | | | | | | | Relocate symbol against DF_1_GLOBAL shared libraries loaded before this shared library. This includes main executable, ld_preloads and other libraries that have DF_1_GLOBAL flag set. Bug: 2643900 Bug: 15432753 Bug: 18186310 (cherry picked from commit d225a5e65223b375a63548c4b780f04d8f3d7b60) Change-Id: I4e889cdf2dfbf8230b0790053d311ee6b0d0ee2d
* Fix mips buildDmitriy Ivanov2014-10-311-1/+1
| | | | | | | | Bug: 18186310 (cherry picked from commit 90b74fb8671db6f5512821a033e12a6248e5c804) Change-Id: I8d4ed254e5c421b65b62c401abdb1ee07e5dc3b2
* Remove unnecessary lookups during relocationsDmitriy Ivanov2014-10-311-22/+5
| | | | | | | | | | local_group includes this library and its dependencies. Bug: 18186310 (cherry picked from commit e47b3f8456fc34ac136e9fddef59a9ae37febcbe) Change-Id: I93c2d873e924df7319569307444bf603d7d27bf0
* Fix relocation to look for symbols in local groupDmitriy Ivanov2014-10-313-79/+124
| | | | | | | | | | | | | | | | The local group is a sequence of libraries in default (breadth-first) order. It allows RTLD_LOCALLY loaded library to correctly relocate symbols within its group (see test-cases). Local group lookup is performed after main executable and ld_preloads. Bug: 2643900 Bug: 15432753 Bug: 18186310 (cherry picked from commit cfa97f172dc1b10d650fefbb6ccffd88ce72a5fb) Change-Id: I5fa8c673f929e4652c738912c7ae078d7ec286d2
* Ignore DT_BIND_NOW (0x18)Dmitriy Ivanov2014-10-311-7/+42
| | | | | | | | | Bug: 18186310 Bug: 17552334 (cherry picked from commit ea6eae182ad64312f80b9adddac511d8938e23e7) Change-Id: I07d6f6fbb462fea329581d0da02f6d88be1c262f
* Resolve "unused DT entry" warnings for x86_64Dmitriy Ivanov2014-10-311-3/+13
| | | | | | | | Bug: 18186310 (cherry picked from commit 513e29e16f16a6ffa1636ba282d599fd6b437aeb) Change-Id: I1e4c5af2cdc09dc978c7a78fcdcf8796c919751e
* Add RTLD_NODELETE flag supportDmitriy Ivanov2014-10-312-10/+24
| | | | | | | | | Bug: 18186310 Bug: https://code.google.com/p/android/issues/detail?id=64069 (cherry picked from commit 1b20dafdbe65e43b9f4c95057e8482380833ea91) Change-Id: Ic02eec22a7c322ece65eb40730a3404f611526b1
* Fix mips buildDmitriy Ivanov2014-10-311-2/+0
| | | | | | | | Bug: 18186310 (cherry picked from commit ecf532fa1cfe91ca946243c11ef154c602870ba6) Change-Id: Ia12f2fa28c8cd3204eb7d6b4c7d872f4e81fb8ef
* Fix unused DT entry warnings.Dmitriy Ivanov2014-10-313-9/+37
| | | | | | | | | | | | DT_STRSZ Implement strtab boundary checks DT_FLAGS_1 Warn if flags other than DF_1_NOW|DF_1_GLOBAL are set Bug: 17552334 Bug: 18186310 (cherry picked from commit 6cdeb5234d7f4523fe9d83974f265d80f10512a6) Change-Id: I7ffc7bc600798308a77ad949a644949b64250ae2
* Return has_DT_SYMBOLIC flag.Dmitriy Ivanov2014-10-312-23/+47
| | | | | | | | | | | | | | | | | This reverts commit 8f61d991831f0ea515fa50a5c38dbbcfbab0dd28 Despite the fact that static linker does all the work while linking -Bsymbolic executables, according to the SCO doc following DT_SYMBOLIC and DF_SYMBOLIC flags is still a requirement for the dynamic linker as well. (see http://www.sco.com/developers/gabi/2012-12-31/ch5.dynamic.html) Bug: 18186310 (cherry picked from commit 96bc37f2e1093416a432135265fd7a4db6c3df17) Change-Id: Ie217be4f3305d877066e4cfe91975ae1c7768330
* Fix a couple more cases of missing CLOEXEC.Elliott Hughes2014-10-311-1/+1
| | | | | | | | | | | The debuggerd case can probably never happen, because you're crashing at this point anyway. The system property one seems possible though. Bug: 18186310 (cherry picked from commit 0dc39f9952c5e3a3121ea77357bb264ef0f8ded7) Change-Id: I3e84488fc246f6c28cbd82e96d0cd4343a12c28a
* Temporary disable DL_WARNs for unused DT_*Dmitriy Ivanov2014-10-311-1/+1
| | | | | | | | | Bug: 17552334 Bug: 18186310 (cherry picked from commit 1b77423eff21e916186fcb208f138e436e9f3052) Change-Id: I8a9d05195a862bc287fff7156913606f0311b8bb
* Fix 64bit buildDmitriy Ivanov2014-10-311-3/+3
| | | | | | | | Bug: 18186310 (cherry picked from commit f240aa8089ea1574a7d799720efb66528f6ceb99) Change-Id: Id46f1f9be90a17a58fb44d3540095c8c685c9726
* Fix some unused DT_ warningsDmitriy Ivanov2014-10-311-4/+35
| | | | | | | | | | | | | | * DT_PLTGOT - ignored for non-mips * DT_RELCOUNT/RELACOUNT - ignored * DT_RELENT/RELAENT - sanity checks * DT_SYMENT - sanity check * DT_SONAME - ignore for now. Bug: 18186310 (cherry picked from commit 4a6e9a835a84aca965f0170f604381dae7f130be) Change-Id: Ib40095f0770d65628fc7abac5a471378de35ebe7
* Remove has_DT_SYMBOLIC flagDmitriy Ivanov2014-10-313-94/+40
| | | | | | | | | | | | | | From the elf-spec: "Symbolically bound shared objects are identified by the .dynamic entry DT_SYMBOLIC. This tag is informational only; the runtime linker processes symbol lookups from these objects in the same manner as any other object." Bug: 18186310 (cherry picked from commit 8f61d991831f0ea515fa50a5c38dbbcfbab0dd28) Change-Id: I37024799ac8d1837993c8ae78780a448bedd6539
* Fix dlsym() to take into account RTLD_GLOBAL/LOCALDmitriy Ivanov2014-10-313-19/+36
| | | | | | | | | | | | Symbols from libraries opened with RTLD_LOCAL (default) should not be visible via dlsym(RLTD_DEFAULT/RTLD_NEXT, .) Bug: 17512583 Bug: 18186310 (cherry picked from commit e8ba50fe0d51fbefee1a8f5bb62bf51d841512c8) Change-Id: Idf6bbe2233fb2bfc0c88677e7d1fc518fb3f7a8b
* ReformattingDmitriy Ivanov2014-10-311-1007/+1003
| | | | | | | | | | No functional changes. Bug: 18186310 (cherry picked from commit 6abf624d122bec8c80cc9fe1b692265bf1b28b1b)] Change-Id: I0acf52d8ee7fe2d4f44bc832cbe9fabe1782f03f
* Rename library_offset to library_fd_offsetDmitriy Ivanov2014-10-222-14/+8
| | | | | | | | | | | replace lseek() and use pread() instead add test for library_fd_offset > file_size case Bug: 17762003 (cherry picked from commit a6c1279098f24a675d0df74ce1946f5d534b425e) Change-Id: Ie117c745081ee33d07db5341115ff6c8e98b0dec
* Add file_offset parameter to android_extinfoDmitriy Ivanov2014-10-215-39/+59
| | | | | | | | Bug: 17762003 (cherry picked from commit 07e5bc152d8a3ad4c50808bb86f3c0f2c5e2f514) Change-Id: I72d527831384ff5dde013a4c8dfe639fbec165f5
* Fix gdb could not get shared library list issueNingsheng Jian2014-10-023-6/+14
| | | | | | | | | | | | | | Get dynamic flags from phdr table's correct entry rather the first entry, so that the following DT_DEBUG entry can be set. Also fix the undefined reference to LoadTask::deleter issue under gcc -O0 option. Bug: 17524778 (cherry picked from commit e93be99da0614ff38cbf8b2bb0624ff1dc79b8d0) Change-Id: I347792dab25c7b19c3fc690e03d20899ce1e26e0
* L-MR1 specific fixesDmitriy Ivanov2014-10-011-1/+1
| | | | | | | | | | Reset soinfo version to 0. Disable ifunc test for arm64 because of old toolchain in lmp-mr1-dev branch Note: this commit should be reverted in -plus-aosp branch. Change-Id: I2d6d996d43bc35d5d4975c745779f43a988b31e6
* Fix unload of recursively linked libraryDmitriy Ivanov2014-10-011-1/+1
| | | | | | | | | Expanded test for recursive libs. Fixed bug with unnecessary soinfo_free of already loaded library. (cherry picked from commit a6ac54a215d6b64f5cc5a59b66c1dbfbb41ea9f5) Change-Id: I6907c723d9fbdf6b2777f3f236b1e29b0843edd6
* Add IFUNC support for arm64 and IRELATIVE relocDmitriy Ivanov2014-10-013-127/+59
| | | | | | | | | | | | | | | | | | There are number of changes in the way IFUNC related relocations are done: 1. IRELATIVE relocations are now supported for x86/x86_64 and arm64. 2. IFUNC relocations are now relying on static linker to generate them in correct order - this removes necessety of additional relocation pass for ifuncs. 3. Related to 2: rela?.dyn relocations are preformed before .plt ones. 4. Ifunc are resolved on symbol lookup this approach allowed to avoid mprotect(PROT_WRITE) call on r-x program segments. Bug: 17399706 Bug: 17177284 (cherry picked from commit 9aea164457c269c475592da36b4655d45f55c7bc) Change-Id: Ie19d900fc203beb93faf8943b0d06d534a6de4ad
* Refactoring: C++11 style DISABLE_ bionic marcosDmitriy Ivanov2014-10-011-1/+1
| | | | | | | | | | | Enable the -std=gnu++11 flag for libstdc++ static and dynamic libs. ScopeGuard uses DISABLE_ macros instead of '= delete'; (cherry picked from commit d9ff7226613014056c9edd79a68dc5af939107a0) Change-Id: If2573d080770e18b36b56106f2369f7bb682cd3c
* Load libraries in breadth-first orderDmitriy Ivanov2014-10-017-198/+289
| | | | | | | | | | | | | This patch fixes the problem with symbol search order for dlsym(RTLD_DEFAULT/RTLD_NEXT, .) by loading libraries and ld_preloads in correct order. Bug: https://code.google.com/p/android/issues/detail?id=74255 Attempt: 2 (cherry picked from commit 14669a939d113214a4a20b9318fca0992d5453f0) Change-Id: Id87540c96a2242220967b6fa5d84ddcd829e2b97
* Revert "Load libraries in breadth-first order"Dmitriy Ivanov2014-10-015-285/+175
| | | | | | | | This reverts commit a3ad450a2e3fb6b3fe359683b247eba20896f646. (cherry picked from commit 498eb18b82a425f9f30132e4832f327b2ee0e545) Change-Id: Iec7eab83d0c0ed1604e1e8ea3f9e9d0ce1d29680
* Fix order of soinfo links (repairs libcxx tests).Dmitriy Ivanov2014-10-011-2/+2
| | | | | | (cherry picked from commit b2a30ee8d209154efc367db11b4167a5d6db605f) Change-Id: I59c5333bc050cbbea14051cea9220be2f64ee383
* Load libraries in breadth-first orderDmitriy Ivanov2014-10-015-175/+285
| | | | | | | | | | | | This patch fixes the problem with symbol search order for dlsym(RTLD_DEFAULT/RTLD_NEXT, .) by loading libraries and ld_preloads in correct order. Bug: https://code.google.com/p/android/issues/detail?id=74255 (cherry picked from commit a3ad450a2e3fb6b3fe359683b247eba20896f646) Change-Id: I1125de10272c84e4f075cbc72859c1f6b3e89943
* Enable clang compilation with libc but not linker.Chih-Hung Hsieh2014-10-011-0/+2
| | | | | | | | | | | | | Clang is still disabled for x86 and x86_64 long double code, for x86_64 special assembly instruction, and the linker module. BUG: 17163651 BUG: 17302991 BUG: 17403674 (cherry picked from commit b58db8b083ce41798a5310616e4f20885cec611f) Change-Id: I916c05056d37a9c287b0a5ae3b1a209d98c8f70e
* Encapsulate soinfo_link_image and soinfo_relocateDmitriy Ivanov2014-10-012-154/+149
| | | | | | | | Also get rid of needed[] array for these functions (cherry picked from commit 29bbc9dd4c606de9187e46d8899a2a744715c967) Change-Id: Id208621f66afa2e02a6b3facacee7d874466d81b
* Implement LinkedList::visit()Dmitriy Ivanov2014-10-012-9/+56
| | | | | | (cherry picked from commit a4926058496c1c24c00ac07e42d45048dac7c487) Change-Id: I59554be45c910bfe33494016595a5ade9daad230
* Introduce size-based r/w allocatorsDmitriy Ivanov2014-10-011-4/+37
| | | | | | (cherry picked from commit 0cd83ebb0e9784827d9ec0a8028a710e73a28b2b) Change-Id: Ib037bd5313c9a78b6051482f14e789aa820b4dd1
* Erase elements in LinkedList::remove_ifDmitriy Ivanov2014-10-013-19/+121
| | | | | | (cherry picked from commit 4bea498544bb1377f610520d7f58856382a6e5fc) Change-Id: I1ffe248bc2b7572f38fbd987e9c6db5ecbd4559d
* Replace NULL with nullptrDmitriy Ivanov2014-10-017-168/+168
| | | | | | (cherry picked from commit 851135bf9941b3813adb9b4f43d76e040c4ba157) Change-Id: Ic4997907680db7472ef38ffb0f0ca66fff37b797
* Remove unnecessary calls to LinkedList::clear()Dmitriy Ivanov2014-10-011-4/+0
| | | | | | (cherry picked from commit 608217e1674d8fd8b334fe18c753b6c4638ed783) Change-Id: I031359d79b2e77977ace197ef410e41539dc0ce6
* Enable __cxa_atexit && __cxa_finalize for linkerDmitriy Ivanov2014-10-014-11/+23
| | | | | | | | | This allows adding destructors to classes used for global variables. (cherry picked from commit 14241402de0faa4b244b1bd6b1f0799ce169b880) Change-Id: I1d8776130d1e01a8c53d23a2949f5010f4c96b16
* Bump soinfo versionDmitriy Ivanov2014-10-013-70/+69
| | | | | | | | | | | This includes: 1. Placing has_ifunc after fields with version = 0 2. Switch to has_min_version(v) function. 3. Minor soinfo initialization refactoring (placement new + ctor) (cherry picked from commit 0d15094287fe0f288d9c258953143fc1998b6b5a) Change-Id: Idf135fdd3d4826b5653f32add2adc6db5d4a4f95
* Run constructors before resolving ifunc functionsDmitriy Ivanov2014-10-012-11/+13
| | | | | | | | Bug: 17177284 (cherry picked from commit 9598b8c415e2fa9f240508185fe8c964b83f538d) Change-Id: I2c9631ee1cd77f8cf95ec0216a35b605c8786454
* Added test for ifunc support in dynamic linker.Brigid Smith2014-10-013-2/+119
| | | | | | | | | | ifuncs now work in i386 and x86_64 when called in the same library as well as in a different library. Bug:6657325 (cherry picked from commit c5a13efa9bc4264be0a9a9e37c00633af01584ed) Change-Id: I321d780bc2f9bd1baa749e1acacd2683aefe827b
* Look into ld_preloads before current libraryDmitriy Ivanov2014-08-291-9/+27
| | | | | | | | | | | | Change lookup order during relocation so that ld_preloads always precede caller (unless caller is main executable). Asan needs this change in order to intercept libc->libc calls. Bug: 15432753 Change-Id: If69aa16efe59aa35bb30e96feb83d08f1efbec86
* Replace snprintf calls in linker.Christopher Ferris2014-08-272-3/+17
| | | | | | | | | | | | | | | | When enabling debug malloc, the snprintf calls in the linker fails to update the buffer. The problem is that snprintf makes a call to pthread_getspecific that returns a valid pointer, but the data it points to is zero. This should never happen and causes the snprintf to stop and do nothing. Temporarily replace snprintf with a different implementation to work around this issue. Bug: 16874447 Bug: 17302493 Change-Id: I7a500f28adf153150cf2812fae745ff41f1c48d3
* Revert "Add support for protected local symbol lookup."Dmitriy Ivanov2014-08-183-36/+31
| | | | | | | This reverts commit d97e9f546ea195686a78e539315b273393609b9e. Bug: 17107521 Change-Id: I2b81ce2b5a4a2d166133a2626e49d81b6aef3672
* Keep symbols for linkerDmitriy Ivanov2014-08-151-0/+4
| | | | | | | | Bug: 17011146 (cherry picked from commit ad5e8b50737144833233d47fe04deb3fa0284df2) Change-Id: Ib1d3f8d6d38af98586658e01ed1ec79d2c5b4d42