summaryrefslogtreecommitdiff
path: root/linker/linker.cpp
AgeCommit message (Collapse)Author
2014-11-18Fix jump to unmapped memory on atexitDmitriy Ivanov
Split d-tor calls and soinfo_free to 2 separate steps Bug: 18338888 Change-Id: Idbcb7242ade16fa18cba7fe30505ebd8d6023622
2014-11-13Rename soinfo methods and fieldsDmitriy Ivanov
Change-Id: If68fbe287d3ad954238b1688f71013371f3f7fae
2014-11-12Fix mips buildDmitriy Ivanov
Change-Id: I58b01db38ab9a397a8bd77c1296aac12957c21da
2014-11-12Add support for hash-style=gnuDmitriy Ivanov
Change-Id: I171434a587420895feac8a9b1ad2342087197568
2014-11-04check invalid file offset when loading libraryYabin Cui
Bug: 18178121 Bug: 18078224 Change-Id: I5254433d54645db68e9b83d5095dc2bf9d8531bc
2014-11-01Merge "Revert "Use local copy of the library name on dlopen""Dmitriy Ivanov
2014-11-01Revert "Use local copy of the library name on dlopen"Dmitriy Ivanov
This reverts commit da8e591c3996879e41dc5f70b77d1b0fe6f9c225. Change-Id: I3fd6f235b18c232af5cc5ecd481851486d7d68f6
2014-10-31Merge "Fix symbol lookup order during relocation"Dmitriy Ivanov
2014-10-31Use local copy of the library name on dlopenDmitriy Ivanov
Bug: 18052100 Change-Id: Idbc2a3691db3b5525d4e9bca81d78d5f29bc438f
2014-10-31Fix symbol lookup order during relocationDmitriy Ivanov
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 Change-Id: Ia788748be59b739d1c7e62b978e7e255f9e65c7b
2014-10-24Remove unnecessary reinterpret_castDmitriy Ivanov
Change-Id: Id2ddf4e74bc66825206d1287f899d716537a68d0
2014-10-23Fix mips buildDmitriy Ivanov
Change-Id: Ia2dc2e07740bdbb91ee92bfea459230015fcc99b
2014-10-23Remove unnecessary lookups during relocationsDmitriy Ivanov
local_group includes this library and its dependencies. Change-Id: Ib02474b2355bb147de3889f60092cb2f312997ef
2014-10-23Fix relocation to look for symbols in local groupDmitriy Ivanov
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 Change-Id: I9bb013b46d17dbb5cbdfb8fef26f552748385541
2014-10-21Rename library_offset to library_fd_offsetDmitriy Ivanov
replace lseek() and use pread() instead add test for library_fd_offset > file_size case Bug: 17762003 Change-Id: I4555f0be635124efe849c1f226985bcba72ffcbd
2014-10-15Ignore DT_BIND_NOW (0x18)Dmitriy Ivanov
Bug: 17552334 Change-Id: Ibe93fd3d6580f369f9a6ef8d235bf0df00fe7607
2014-10-06Resolve "unused DT entry" warnings for x86_64Dmitriy Ivanov
Change-Id: I3a2c87bf6e6259313cd9203389623f13b7405ef3
2014-10-06Add file_offset parameter to android_extinfoDmitriy Ivanov
Bug: 17762003 Change-Id: I8fb267a3155acef3dba534038cf5d1ef00d7154b
2014-10-02Merge "Add RTLD_NODELETE flag support"Dmitriy Ivanov
2014-10-01Add RTLD_NODELETE flag supportDmitriy Ivanov
Bug: https://code.google.com/p/android/issues/detail?id=64069 Change-Id: Ie5f90482feae86391172be4b32d6cb7d76f446fb
2014-09-30Fix mips buildDmitriy Ivanov
Change-Id: I4454e69a982f239b168678c5a681d1078b4bd4f1
2014-09-30Fix unused DT entry warnings.Dmitriy Ivanov
DT_STRSZ Implement strtab boundary checks DT_FLAGS_1 Warn if flags other than DF_1_NOW|DF_1_GLOBAL are set Bug: 17552334 Change-Id: Iaad29cd52f5b2d7d2f785fb351697906dc1617d9
2014-09-29Return has_DT_SYMBOLIC flag.Dmitriy Ivanov
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) Change-Id: I23f6a5e9b662e40cdbc462b64feff912431e800c
2014-09-26Fix gdb could not get shared library list issueNingsheng Jian
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 Change-Id: I9c679af197b034761fb739d6c980e628ff2ab84c
2014-09-17Temporary disable DL_WARNs for unused DT_*Dmitriy Ivanov
Bug: 17552334 Change-Id: I2f7b5e4b4d1db96e812a7f86adc929e113d4c11a
2014-09-16Fix 64bit buildDmitriy Ivanov
Change-Id: I6ef55b5951270c46ee5e9a11385bd09e33a9f969
2014-09-16Fix some unused DT_ warningsDmitriy Ivanov
* DT_PLTGOT - ignored for non-mips * DT_RELCOUNT/RELACOUNT - ignored * DT_RELENT/RELAENT - sanity checks * DT_SYMENT - sanity check * DT_SONAME - ignore for now. Change-Id: Ied90748d12f733a84f6c38a1250567a2f77608b7
2014-09-16Remove has_DT_SYMBOLIC flagDmitriy Ivanov
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." Change-Id: I4aae0e502ed9fac096fbf076f4d6b2e055d784f6
2014-09-15Fix dlsym() to take into account RTLD_GLOBAL/LOCALDmitriy Ivanov
Symbols from libraries opened with RTLD_LOCAL (default) should not be visible via dlsym(RLTD_DEFAULT/RTLD_NEXT, .) Bug: 17512583 Change-Id: I1758943081a67cf3d49ba5808e061b8251a91964
2014-09-12Merge "Fix unload of recursively linked library"Dmitriy Ivanov
2014-09-12Merge "Reformatting"Dmitriy Ivanov
2014-09-12Merge "Refactoring: C++11 style DISABLE_ bionic marcos"Dmitriy Ivanov
2014-09-12ReformattingDmitriy Ivanov
No functional changes. Change-Id: If71775e5fc207e91ebd31ba3c5f9d2c13dc8dada
2014-09-11Fix unload of recursively linked libraryDmitriy Ivanov
Expanded test for recursive libs. Fixed bug with unnecessary soinfo_free of already loaded library. Change-Id: I2cc19f2650c8b12a35feeac127ef608ebba44d88
2014-09-11Add IFUNC support for arm64 and IRELATIVE relocDmitriy Ivanov
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 Change-Id: I414dd3e82bd47cc03442c5dfc7c279949aec51ed
2014-09-08Refactoring: C++11 style DISABLE_ bionic marcosDmitriy Ivanov
Enable the -std=gnu++11 flag for libstdc++ static and dynamic libs. ScopeGuard uses DISABLE_ macros instead of '= delete'; Change-Id: I07e21b306f95fffd49345f7fa136cfdac61e0225
2014-09-08Load libraries in breadth-first orderDmitriy Ivanov
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 Change-Id: If1ba5c807322409faa914e27ecb675e2c4541f0d Attempt: 2
2014-09-05Revert "Load libraries in breadth-first order"Dmitriy Ivanov
This reverts commit a3ad450a2e3fb6b3fe359683b247eba20896f646. Change-Id: Ia2b838ad2159c643b80c514849582f4b4f4f40e5
2014-09-05Fix order of soinfo links (repairs libcxx tests).Dmitriy Ivanov
Change-Id: Iee9de09657351cd6a7512784ca797e4b84cdd98b
2014-09-03Load libraries in breadth-first orderDmitriy Ivanov
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 Change-Id: I4cf84c70dbaabe99310230dfda12385ae5401859
2014-09-02Encapsulate soinfo_link_image and soinfo_relocateDmitriy Ivanov
Also get rid of needed[] array for these functions Change-Id: I8d12887dbec0724309bb171e6bbd9b9ceb32cc70
2014-09-01Introduce size-based r/w allocatorsDmitriy Ivanov
Change-Id: I75165fc392e5380124039e6db49b0f559c8a518e
2014-09-01Look into ld_preloads before current libraryDmitriy Ivanov
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 (cherry picked from commit 05e190c093ad5b04691ed87100a711ef91f380b0) Change-Id: I5bfb58e18015b1ec5b77842dbb37fb122fa1fd1a
2014-09-01Merge "Erase elements in LinkedList::remove_if"Dmitriy Ivanov
2014-08-29Erase elements in LinkedList::remove_ifDmitriy Ivanov
Change-Id: I5119a78c73ffe780a81c53ab5ff0266d5c82d319
2014-08-29Replace NULL with nullptrDmitriy Ivanov
Change-Id: Iad50be617d318ca98883b843229c960ad5b9afa9
2014-08-27Replace snprintf calls in linker.Christopher Ferris
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 (cherry pick from commit 172955a4e30b88ce8239a7ef426b4e8903e9923c) Change-Id: Idca9d417978403d61debfd0434aaa82fd770f33b
2014-08-26Remove unnecessary calls to LinkedList::clear()Dmitriy Ivanov
Change-Id: I981d2700cb17322c634b751715543fd33ee49b7c
2014-08-26Enable __cxa_atexit && __cxa_finalize for linkerDmitriy Ivanov
This allows adding destructors to classes used for global variables. Change-Id: I5e1cd63fe3bf8f66de88cc4f7437cafb350f49b5
2014-08-22Bump soinfo versionDmitriy Ivanov
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) Change-Id: I1bf5fde4d930914012ce5f3ad5acb48217da9b2d