aboutsummaryrefslogtreecommitdiff
path: root/tests/libs
Commit message (Collapse)AuthorAgeFilesLines
* Fix mte tests to allow auto-upgrade.Evgenii Stepanov2022-03-101-0/+38
| | | | | | | | | | | | | | | | The kernel MTE mode auto-upgrade feature (see mte_tcf_preferred) allows silent auto-upgrade of Async MTE mode to Asymm or Sync depending on the OS settings. Relax the tests to allow either Sync or Async faults when requesting Async mode, and only Sync faults when requesting Sync. Also tighten the MTENote test to check that both system allocator and prctl are off when MTE is disabled. Bug: 214622342 Test: bionic-unit-tests on fvp with all variations of /sys/devices/system/cpu/cpu*/mte_tcf_preferred=(async|asymm|sync) Change-Id: I77a92789d6b330742d00b08c9f0fecc3a6c8fca6
* Cast ifunc resolver's return typePirama Arumuga Nainar2022-02-171-5/+7
| | | | | | | | | | Bug: http://b/218788252 Even though a resolver can return any pointer, LLVM IR verifier now checks that the resolver returns a pointer to the ifunc's function type. Test: m GLOBAL_THINLTO=true libtest_ifunc_variable_impl.so Change-Id: I7d87ffcf50bab1d61b01328907e036c51feb6a0f
* Remove outdated ld.bfd usage.Stephen Hines2021-11-101-16/+0
| | | | | | | | LLD supports `-z global`, unlike ld.gold, which this was previously a workaround for. Test: mm in test dir Change-Id: I1f621c329accfb31912a19544e34447aff0dfa28
* Convert bionic dlext test zips to Android.bpColin Cross2021-09-303-130/+68
| | | | | | | | | | | | | | | | | | | Use cc_genrules to create the dlext test zips needed by the bionic tests. The genrules aren't visible to Make, and so don't work with the `required` property. Move all of the dependencies to `data_bins`, `data_libs` or `data` for helper binaries, shared libraries or genrule zip files respectively. The `data*` properties copy the files into the same directory as a test, respecting the `bionic-loader-test-libs` relative path specified by each, but does not put each helper binary in its own subdirectory, so update the paths in each of the tests. Bug: 200872604 Test: atest CtsBionicTestCases Test: atest bionic-unit-tests Test: cts-tradefed run commandAndExit cts -m CtsBionicTestCases Test: adb push $OUT/data/nativetest/bionic-unit-tests /data/nativetest/ && adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests Change-Id: Ic4257cb4104ff558326df2363730acd20464b051
* Add LOCAL_LICENSE_KINDS to bionicBob Badour2021-02-192-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added SPDX-license-identifier-Apache-2.0 to: apex/Android.bp libdl/Android.bp tools/Android.bp tools/versioner/Android.bp tools/versioner/src/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: benchmarks/Android.bp benchmarks/linker_relocation/gen/Android.bp libc/malloc_debug/Android.bp libc/system_properties/Android.bp tests/Android.bp tests/libs/Android.bp tests/libs/Android.build.dlext_testzip.mk tests/make_fortify_compile_test.mk Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-ISC SPDX-license-identifier-MIT legacy_notice legacy_unencumbered to: libc/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT legacy_unencumbered to: libm/Android.bp Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered to: libc/tools/Android.bp Added SPDX-license-identifier-BSD to: benchmarks/linker_relocation/Android.bp benchmarks/spawn/Android.bp libc/async_safe/Android.bp libc/malloc_hooks/Android.bp libfdtrack/Android.bp linker/Android.bp tests/headers/Android.bp tests/headers/posix/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: Ib05bcaa276b3aa71a7654ccbe8e67e1f16aec9f3
* Revert "[LSC] Add LOCAL_LICENSE_KINDS to bionic"Elliott Hughes2021-02-162-14/+1
| | | | | | | | This reverts commit 48d43034d7b5a419ba56f052856696d53a7bd979. Reason for revert: bionic is multiple projects, not just one. Change-Id: Ib31e1bb8888cc85c6e7736c4e2a1d4652fd23935
* [LSC] Add LOCAL_LICENSE_KINDS to bionicBob Badour2021-02-122-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added SPDX-license-identifier-Apache-2.0 to: libdl/Android.bp tools/versioner/src/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD to: benchmarks/Android.bp libc/malloc_debug/Android.bp libc/system_properties/Android.bp linker/Android.bp tests/Android.bp tests/libs/Android.bp tests/libs/Android.build.dlext_testzip.mk tests/make_fortify_compile_test.mk Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-ISC SPDX-license-identifier-MIT legacy_notice legacy_unencumbered to: Android.bp libc/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-ISC SPDX-license-identifier-MIT legacy_unencumbered to: tools/Android.bp tools/versioner/Android.bp Added SPDX-license-identifier-Apache-2.0 SPDX-license-identifier-BSD SPDX-license-identifier-MIT legacy_unencumbered to: libm/Android.bp Added SPDX-license-identifier-Apache-2.0 legacy_unencumbered to: libc/tools/Android.bp Added SPDX-license-identifier-BSD to: benchmarks/linker_relocation/Android.bp benchmarks/spawn/Android.bp libc/async_safe/Android.bp libc/malloc_hooks/Android.bp libfdtrack/Android.bp tests/headers/Android.bp tests/headers/posix/Android.bp Added legacy_notice to: apex/Android.bp benchmarks/linker_relocation/gen/Android.bp Bug: 68860345 Bug: 151177513 Bug: 151953481 Test: m all Exempt-From-Owner-Approval: janitorial work Change-Id: I76cad00578b9b99180ee5dd1e04b4646d5c5fedf
* Ensure same order of global group members in all NS'sRyan Prichard2021-01-225-9/+59
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | During "step 1" of find_libraries, the linker finds the transitive closure of dependencies, in BFS order. As it finds each library, it adds the library to its primary namespace (so that, if some other library also depends on it, find_loaded_library_by_soname can find the library in the process of being loaded). LD_PRELOAD libraries are automatically marked DF_1_GLOBAL, and any DF_1_GLOBAL library is added to every linker namespace. Previously, this secondary namespace registration happened after step 1. The result is that across different namespaces, the order of libraries could vary. In general, a namespace's primary members will all appear before secondary members. This is undesirable for libsigchain.so, which we want to have appear before any other non-preloaded library. Instead, when an soinfo is added to its primary namespace, immediately add it to all the other namespaces, too. This ensures that the order of soinfo objects is the same across namespaces. Expand the dl.exec_with_ld_config_file_with_ld_preload and dl.exec_with_ld_config_file tests to cover the new behavior. Mark lib1.so DF_1_GLOBAL and use a "foo" symbol to mimic the behavior of a signal API interposed by (e.g.) libsigchain.so and a ASAN preload. Test: bionic unit tests Bug: http://b/143219447 Change-Id: I9fd90f6f0d14caf1aca6d414b3e9aab77deca3ff
* Tests for memory tagging ELF notes.Evgenii Stepanov2021-01-132-0/+134
| | | | | | | Bug: b/135772972 Test: bionic-unit-tests Change-Id: I9b151291d86ef10731eb97db6e68534d5372e06c
* Fix bug in finding another thread's TCB.Vy Nguyen2020-10-152-6/+51
| | | | Change-Id: I06c86ca0c077b464fc6c9fbdf5b89889a26da5fb
* Updated __libc_get_static_tls_bounds test to be more meaningfulVy Nguyen2020-08-261-2/+10
| | | | Change-Id: I20b8716affd35f940f607d92f761736fba0a66fd
* Add a thread-properties APIVy Nguyen2020-08-113-0/+157
| | | | | | | | | | (Based on proposal at https://sourceware.org/glibc/wiki/ThreadPropertiesAPI) This includes API to: - locate static and dynamic TLS - register thread-exit and dynamic TLS creation/destruction callbacks Change-Id: Icd9d29a5b2f47495395645e19d3b2c96826f19c8
* Enable coverage for libc.Pirama Arumuga Nainar2020-08-051-0/+1
| | | | | | | | | | | | | | | | Bug: http://b/157081822 - Disable coverage for libtest_check_rtld_next_from_library to make dlfcn.rtld_next_from_library to pass. - The coverage runtime sets an environment variable to prevent clobbering of the coverage data on disk. Include that variable as well when checking `printenv` output. This is done at runtime by checking for LLVM_PROFILE_FILE environment variable. - dl.preinit_system_calls still fails after this change. Test: bionic tests with libc coverage turned on. Change-Id: I3ea2b0800886d8c0984969a4ee8bfb0da03c33b0
* Merge "Specify sections to merge in segment_gap_outer.lds more precisely"Stephen Hines2020-07-242-13/+13
|\
| * Specify sections to merge in segment_gap_outer.lds more preciselyStephen Hines2020-07-242-13/+13
| | | | | | | | | | | | | | | | | | | | | | https://reviews.llvm.org/D75225 changed the way that orphan sections are retained, breaking this test. The test relied on these sections being merged in an implementation-defined order that no longer holds true. We can use custom sections to place the symbols we want more precisely. Bug: http://b/161943302 Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests --gtest_filter=dlfcn.segment_gap --no_isolate Change-Id: I65656080e39be16833191cb92d3d4c41e409b216
* | Changes for #inclusivefixit.Elliott Hughes2020-07-212-6/+5
|/ | | | | Test: treehugger Change-Id: I7ff0496c5c2792a41781e74634247f55b0548213
* Use PROT_NONE on the unused parts of CFI shadow.Evgenii Stepanov2020-06-121-6/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This replaces a single 2Gb readable memory region with a bunch of tiny regions, and leaves the bulk of 2Gb mapped but unaccessible. This makes it harder to defeat ASLR by probing for the CFI shadow region. Sample CFI shadow mapping with this change: 7165151000-716541f000 ---p 00000000 00:00 0 [anon:cfi shadow] 716541f000-7165420000 r--p 00000000 00:00 0 [anon:cfi shadow] 7165420000-71654db000 ---p 00000000 00:00 0 [anon:cfi shadow] 71654db000-71654dc000 r--p 00000000 00:00 0 [anon:cfi shadow] 71654dc000-71654dd000 r--p 00000000 00:00 0 [anon:cfi shadow] 71654dd000-71654f0000 ---p 00000000 00:00 0 [anon:cfi shadow] 71654f0000-71654f1000 r--p 00000000 00:00 0 [anon:cfi shadow] 71654f1000-71e5151000 ---p 00000000 00:00 0 [anon:cfi shadow] This change degrades CFI diagnostics for wild jumps and casts (i.e. when the target of a CFI check is outside of any known library bounds). This is acceptable, because CFI does not have much to tell about those cases anyway. Such bugs will show up as SEGV_ACCERR crashes inside __cfi_slowpath in libdl.so from now on. Bug: 158113540 Test: bionic-unit-tests/cfi_test.* Test: adb shell cat /proc/$PID/maps | grep cfi Change-Id: I57cbd0d3f87eb1610ad99b48d98ffd497ba214b4 Merged-In: I57cbd0d3f87eb1610ad99b48d98ffd497ba214b4
* Remove unnecessary jni.hOrion Hodson2020-04-071-1/+0
| | | | | | | | Discovered after removing implicit jni.h include path. Bug: 152482542 Test: lunch aosp_x86_64 && m checkbuild Change-Id: I5fcb33b110c8f5ee9db3c910eaaa3e6018979a45
* Merge "Remove XOM properties."Ivan Lozano2020-02-141-4/+0
|\
| * Remove XOM properties.Ivan Lozano2020-02-131-4/+0
| | | | | | | | | | | | | | | | | | | | XOM is no longer supported by the build system, so remove these properties. Bug: 123034666 Bug: 147300048 Test: Build succeeds. Change-Id: I77efc98241f45b1a78b1cca5560f64eef5ef22f4
* | Remove mips test workarounds.Elliott Hughes2020-02-131-35/+0
|/ | | | | | | | The mips/mips64 targets were never able to pass these tests, and the supported architectures don't need any of these workarounds. Test: treehugger Change-Id: I640a8b7a98ae13d9d9cdb09b0fbef61d31d4c79a
* Ignore symbols of imported libs' dependenciesRyan Prichard2020-02-036-0/+267
| | | | | | | | | | | | When a library is present in a namespace via the secondary_namespaces list (i.e. the executable, LD_PRELOAD, DF_1_GLOBAL, or android_create_namespace inheritance), then we want to search that library's symbols, but not the symbols of its dependencies. Otherwise, we want to search the dependencies to handle cross-NS dependency. Bug: http://b/148569846 Test: bionic unit tests Change-Id: If798d69de28ed5c0f1a155e4ff85c7e08934e531
* Test all four supported relocation encodings.Elliott Hughes2020-01-282-9/+37
| | | | | | | | | | | Test (a) that we can load the library, but also (b) that readelf thinks it contains the relocation encoding we were expecting. Do this for all four of RELR, ANDROID_RELR, relocation packer, and the original ELF relocation encoding. Bug: http://b/147452927 Test: treehugger Change-Id: I5fab72f99d46991c1b206a1c15c76e185b7148b3
* Modernize SHT_RELR support.Elliott Hughes2020-01-242-0/+57
| | | | | | | | | | | | | | | | Until now we've only supported RELR with our own OS-private-use constants. Add support for the official numbers (while maintaining support for the historical numbers). Add tests to ensure we continue to support both indefinitely. We can't yet flip the build system over to using the official constants because the old GNU binutils objcopy we still use in most cases (for the mini-debug section) only supports the historical constants. Bug: http://b/147452927 Test: treehugger Change-Id: If214fce7fade4316115947e90b78ab40864b61f2
* Convert more bionic tests to Android.bpDan Willemsen2020-01-1614-927/+580
| | | | | | | | | | | | Bug: 122332847 Bug: 130734182 Test: mmm bionic/tests; same files installed before & after Test: m cts; same files in cts before & after Test: `objdump -x <files> | grep NEEDED` is identical Test: `objdump -x <files> | grep RUNPATH` difference make sense (additional lib64 entries from soong, minimal reorder) Test: treehugger Change-Id: I6eea4c3f9c0040efeba64e2b47c7b573767cd386
* Merge changes from topic "clang-r365631-switch-over"Yi Kong2019-08-221-4/+3
|\ | | | | | | | | | | | | * changes: Fix segment gap test stdatomic_test: always use bits/stdatomic.h Adapt tests due to the new Clang fortify-source warning
| * Fix segment gap testYi Kong2019-08-171-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | The test starts failing in the upcoming lld update. The root cause is that no relro section is specified by the linker script, and the orphan placement algorithm decides to place them after .text which is a misaligned place. Test: bionic-unit-tests Bug: 139089152 Bug: 131328001 Change-Id: I2140d8a9fd7c712f1d31a541a3b4a10788385e98
* | Fix a few bionic test failures caused by hwasan global instrumentation.Peter Collingbourne2019-08-151-1/+1
|/ | | | | | | | | | | | | | | | | The call to the load hook needs to be moved before the call to link_image() because the latter calls ifunc resolvers which might access global variables. This fixes a bunch of ifunc tests. The dlfcn.segment_gap test is currently failing. One problem is that the name of the .bss.end_of_gap section changes as a result of global instrumentation. Add some wildcards in so that we match both names. The other problem seems to be the same as b/139089152. It turns out that we need to untag pointers in a few more places. Since we have quite a few of these now it seems worth creating a function for it. Test: bionic-unit-tests Change-Id: I44e2b0904faacdda7cc0c5e844ffc09de01dea2d
* Change SANITIZE_TARGET refs from 'coverage' to 'fuzzer'.Mitch Phillips2019-05-301-1/+1
| | | | | | | | | | | | | | Cleanup of references to 'coverage' in build files. Part of a larger cleanup to make fuzzing work again in the Android build tree. Also fixed a test issue with emulated TLS with the new changes, and removed libc.so fuzzer support until a linked bug is fixed (b/132640749). Bug: 121042685 Test: With all patches in the bug merged: mmma bionic Change-Id: I592352fe9210ff811a2660a88cbbfe48d70a1e57 Merged-In: I592352fe9210ff811a2660a88cbbfe48d70a1e57
* Move off the Next ZipString overload.Elliott Hughes2019-05-221-6/+4
| | | | | | Bug: http://b/129068177 Test: treehugger Change-Id: I83840c2ffd6cdede8cb34b4ec168427a43e1daf7
* bionic_tests_zipalign: don't explicitly specify no prefix/suffix.Elliott Hughes2019-05-101-1/+1
| | | | | | Bug: http://b/129068177 Test: treehugger Change-Id: If061ba04a0b3396898b6150d8fb1a8c27abb03f8
* Fix dlsym and dladdr for TLS symbolsRyan Prichard2019-04-031-0/+18
| | | | | | | | | | * dlsym: call __tls_get_addr for TLS symbols * dladdr: skip TLS symbols Bug: b/123772574 Test: bionic unit tests Change-Id: I59a8bc4a7d455e1018b0d577b027b6417c8487cd
* linker: Handle libraries with disjoint mappings correctly.Peter Collingbourne2019-03-084-0/+68
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's possible and sometimes beneficial for a library to have disjoint mappings and for other libraries to be mapped into the gap between the mappings using ANDROID_DLEXT_RESERVED_ADDRESS. See for example the proposal for partitioning in lld [1]. Because the find_containing_library and do_dl_unwind_find_exidx functions use a simple bounds check to figure out whether a pointer belongs to a library they will, given a pointer into a library mapped into the gap of a library with disjoint mappings, return a pointer to the soinfo for the outer library instead of the inner one, because the outer library will appear before the inner one in the solist. From a user perspective this means that we won't be able to unwind the inner library's frames on 32-bit ARM with libgcc, dladdr() will return information for the outer library given a pointer to the inner one and dlopen() et al will use the linker namespace of the outer library when called from the inner one (although they will usually be the same). To make this work correctly, make it so that once find_containing_library sees a match for the bounds check, it examines the library's PT_LOADs to make sure that there is a mapping for the given address. This is similar to how libgcc and libunwind_llvm already handle finding the PT_GNU_EH_FRAME on non-ARM32 platforms [2,3]. do_dl_unwind_find_exidx is reimplemented in terms of find_containing_library. [1] http://lists.llvm.org/pipermail/llvm-dev/2019-February/130583.html [2] https://github.com/llvm/llvm-project/blob/e739ac0e255597d818c907223034ddf3bc18a593/libunwind/src/AddressSpace.hpp#L523 [3] https://android.googlesource.com/toolchain/gcc/+/master/gcc-4.9/libgcc/unwind-dw2-fde-dip.c#294 Test: /data/nativetest{,64}/bionic-unit-tests/bionic-unit-tests on walleye-userdebug Change-Id: I368fe6ad3c470b3dff80f7d9b04253566d63a7d2
* linker: allow using reserved space for multiple libraries.Torne (Richard Coles)2019-02-202-0/+60
| | | | | | | | | | | | | | | | | Introduce a new flag ANDROID_DLEXT_RESERVED_ADDRESS_RECURSIVE which instructs the linker to use the reserved address space to load all of the newly-loaded libraries required by a dlopen() call instead of only the main library. They will be loaded consecutively into that region if they fit. The RELRO sections of all the loaded libraries will also be considered for reading/writing shared RELRO data. This will allow the WebView implementation to potentially consist of more than one .so file while still benefiting from the RELRO sharing optimisation, which would otherwise only apply to the "root" .so file. Test: bionic-unit-tests (existing and newly added) Bug: 110790153 Change-Id: I61da775c29fd5017d9a1e2b6b3757c3d20a355b3
* dlfcn.dt_runpath* tests are amended to handle LIBJiyong Park2019-01-302-8/+55
| | | | | | | | | | LIB is now expanded to either lib or lib64. Add a new lib libtest_dt_runpath_y which is under lib or lib64 directory to the tests. Test: run bionic-unit-tests Merged-In: Ib051d8cae4d50b452759d594c87126b45bc9e959 Change-Id: Ib051d8cae4d50b452759d594c87126b45bc9e959
* Add tests for dynamic ELF TLSRyan Prichard2019-01-294-27/+117
| | | | | | | Bug: http://b/78026329 Test: bionic unit tests Merged-In: I508fa38b331eeec7dae53039b4b1ec6cedea3034 Change-Id: I508fa38b331eeec7dae53039b4b1ec6cedea3034
* Add tests for static ELF TLSRyan Prichard2019-01-185-1/+193
| | | | | | | Bug: http://b/78026329 Test: bionic unit tests Merged-In: I806f2bd193998dfe352372476104876edb27aebf Change-Id: I806f2bd193998dfe352372476104876edb27aebf
* Turn off XOM on libnstest_root.soRyan Prichard2019-01-181-0/+4
| | | | | | | | | | The dlext.ns_anonymous test copies the loaded segments of this shared object into a new mapping, so every segment must be readable. Turn off eXecute-Only-Memory. Bug: http://b/123034666 Test: bionic-unit-tests --gtest_filter=dlext.ns_anonymous Change-Id: I2d427feb81d353e0403c7ef251a55afb4d8729b4
* Fix/suppress bionic google-explicit-constructor warningsChih-Hung Hsieh2019-01-022-2/+2
| | | | | | | | * Add explicit to conversion constructors/operators Bug: 28341362 Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,google-explicit-constructor Change-Id: Id1ad0327c1b8c6f094bcbb3ae599bc1f716b3f2f
* Use shared globals to init __progname + environRyan Prichard2018-11-281-1/+3
| | | | | | | | | | | | | | | | | Initialize the __progname and environ global variables using libc_shared_globals rather than KernelArgumentBlock. Also: suppose the linker is invoked on an executable: linker prog [args...] The first argument passed to main() and constructor functions is "prog" rather than "linker". For consistency, this CL changes the BSD __progname global from "linker" to "prog". Bug: none Test: bionic unit tests Change-Id: I376d76953c9436706dbc53911ef6585c1acc1c31
* Merge "Revert "Do not use clang lld with -z,global""Treehugger Robot2018-11-071-4/+0
|\
| * Revert "Do not use clang lld with -z,global"Chih-hung Hsieh2018-11-071-4/+0
| | | | | | | | | | | | | | | | | | This reverts commit 8e462d411a73899c08b163b02c3c59355b475ab8. Reason for revert: this lld bug has been fixed upstream and in AOSP prebuilts Bug: 80109858 Change-Id: Ied600324201e1a014a1d4e6742767e2ddd94999a
* | Disable a few bionic tests under HWASan.Evgenii Stepanov2018-11-061-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * HWASan report invalid use of the allocator api (like alignment not being power of two, or allocation size too large) in a way tests do not expect. * Code in .preinit_array runs before HWASan shadow is initialized and needs to be excluded from instrumentation. * It looks that mm system calls (mmap/mprotect/etc) will not allow tagged pointers. In fact, the use of mprotect on malloc()ed memory is doubtful - one can imagine some kind of speculative load from such memory, as compiler knows that it is addressable. Bug: 114279110 Test: bionic-unit-tests with hwasan Change-Id: I6ba4b46a0d554de77c923ad134cf156ce4ddba1b
* | Allow invoking the linker on an executable.Ryan Prichard2018-10-104-1/+96
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The executable can be inside a zip file using the same syntax used for shared objects: path.zip!/libentry.so. The linker currently requires an absolute path. This restriction could be loosened, but it didn't seem important? If it allowed non-absolute paths, we'd need to decide how to handle: - foo/bar (relative to CWD?) - foo (search PATH / LD_LIBRARY_PATH, or also relative to CWD?) - foo.zip!/bar (normalize_path() requires an absolute path) The linker adjusts the argc/argv passed to main() and to constructor functions to hide the initial linker argument, but doesn't adjust the auxv vector or files like /proc/self/{exe,cmdline,auxv,stat}. Those files will report that the kernel loaded the linker as an executable. I think the linker_logger.cpp change guarding against (g_argv == NULL) isn't actually necessary, but it seemed like a good idea given that I'm delaying initialization of g_argv until after C++ constructors have run. Bug: http://b/112050209 Test: bionic unit tests Change-Id: I846faf98b16fd34218946f6167e8b451897debe5
* | Modernize codebase by replacing NULL with nullptrYi Kong2018-08-022-2/+2
| | | | | | | | | | | | | | | | Fixes -Wzero-as-null-pointer-constant warning. Test: m Bug: 68236239 Change-Id: I5b4123bc6709641315120a191e36cc57541349b2
* | Add secondary counter in place of tls_nodelete flagdimitry2018-05-302-1/+66
|/ | | | | | | | | | | | | | | | The tls_nodelete state should apply to load_group not isolated soinfo. This actually also means that multiple soinfos may have tls_counter on their dso_handles. This change replaces TLS_NODELETE flag with secondary counter. Note that access to the secondary counter (located inside soinfo) is pretty expensive because it requires soinfo lookup by dso_handle whereas dso_handle counter is much faster. This is why it is updated only when dso_handle counter starts or hits 0. Bug: http://b/80278285 Test: bionic-unit-tests --gtest_filter=dl* Change-Id: I535583f6714e45fa2a7eaf7bb3126da20ee7cba9
* Do not use clang lld with -z,globalChih-Hung Hsieh2018-05-211-0/+4
| | | | | | Bug: 80109858 Test: bionic unit test dlfcn.dlsym_df_1_global Change-Id: Icc754385e54a5cd70312c60c635c094a27249442
* vdso should be available in all namespacesdimitry2018-05-121-0/+24
| | | | | | | | | | | | | | vdso should be available in all namespaces when present. This bug went undetected because the way libc currently uses vdso (it does all the lookups itself). This makes it available for the programs that want to take advantage by dlopening it. Bug: http://b/73105445 Bug: http://b/79561555 Test: adb shell /data/nativetest/arm/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl.exec_with_ld_config_file Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests --gtest_filter=dl* Change-Id: I8eae0c9848f256190d1c9ec85d10dc6ce383a8bc (cherry picked from commit 69c68c46ac18a440bf1c0447d8343a6dbad595f1)
* allow_undefined_symbols to link libelf-tls-libraryChih-Hung Hsieh2018-04-161-0/+1
| | | | | | | | | | | | * Since Android does not have __tls_get_addr yet, -fno-emulated-tls is only a test of compiler. Lld is correct to reject this at link time. But if the purpose of this test is to check at run-time, allow_undefined-symbols is the trick to get the linked library. Bug: http://b/74361956 Test: build and compare linked file Change-Id: Ibcdc8b50aeeaec9d7d308b66df2a6997ce3c1a4f
* Fix build failure with dlext_testzip Bionic testsRyan Prichard2018-03-301-11/+13
| | | | | | | | | | | | | | Other build rules create and use a test config file in the intermediate directory containing $(LOCAL_BUILT_MODULE). Currently, this makefile deletes $(dir $(LOCAL_BUILT_MODULE)) (aka $(dir $@)), so it can delete the config file after it's created and before it's used. Avoid this issue by using $(dir $@)/zipdir as the working directory for constructing a zip file. Bug: b/74524170 Test: mmma bionic Test: run Bionic unit tests Change-Id: Icee4d7bc72ba1c136385a0cb2c28491649598e7c