summaryrefslogtreecommitdiff
path: root/libdl
AgeCommit message (Collapse)Author
2021-04-26Replace llndk_library with llndk clause in cc_libraryColin Cross
Remove the vestigial llndk_library and replace it with properties in the llndk clause of the implementation cc_library. In order to reduce duplication of the arch-specific headers used by the implementation and LLNDK, rename libc_headers_arch to libc_llndk_headers and hoist the "include" directory out of it, since that directory is preproccessed separately for LLNDK libraries. Bug: 170784825 Test: m checkbuild Test: compare out/soong/build.ninja Change-Id: I75f0ff9129d910640da55eee6a6387467e6e4a9d
2021-02-19Add LOCAL_LICENSE_KINDS to bionicBob Badour
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
2021-02-16Fix/update notices.Elliott Hughes
Auto-generate NOTICE files for all the directories, and for each one individually rather than mixing libc and libm together. Test: N/A Change-Id: I7e251194a8805c4ca78fcc5675c3321bcd5abf0a
2021-01-28Fix -Wl,--exclude-libs typo: x86->i686Ryan Prichard
These lines shouldn't actually matter, because the DSOs are using version scripts to allow-list exported symbols. Bug: none Test: bionic unit tests Change-Id: I39d3df8c4f8053624f862b3c6994e30c693e928c
2021-01-19Don't set native_bridge_supported: true for ndk librariesColin Cross
Native bridge modules will never compile against stubs, remove native_bridge_supported: true. Test: m checkbuild Change-Id: I0eb93fe1a2c3f6ca34ce4dab17edda8807132ce8
2020-10-29Merge "Make vendor_ramdisk_available."Yifan Hong
2020-10-27Make vendor_ramdisk_available.Yifan Hong
Test: pass Bug: 156098440 Change-Id: I8fe2deb8fa3b24c227202be02d8af648629cffeb
2020-10-19Make the connection between implementation and llndk_library explicitColin Cross
Instead of assuming a module with the .llndk suffix exists, add an llndk_stubs property to every cc_library module that has a corresponding llndk_library. Also rename the llndk_library to have an explicit .llndk suffix. Bug: 170784825 Test: no changes to build.ninja (excluding comments) or Android-${TARGET_PRODUCT}.mk Change-Id: Ib5453472a09ebc64818ceb69bcbe1184720ce86a
2020-09-29No global ThinLTO for bionicYi Kong
There are multiple build breakages with bionic when we enable ThinLTO globally. Opt bionic out of ThinLTO for now. #global-thinlto-opt-out Test: TreeHugger Bug: 169004486 Change-Id: I546a8074f9c3e0ddbd01d3b7cd730e215e3c0c49
2020-08-13Avoid explicit use of "10000" in build files.Dan Albert
Test: treehugger Bug: None Change-Id: Iab713c5f4b53665f8224b3857beaa6a1d19f8d69
2020-05-06Export libc_headers from libdl_static for libraries that wrap itMartin Stjernholm
without bringing in libc. Required by the native bridge libdl wrapper. Test: m (on cf_x86_phone) Bug: 153590472 Change-Id: Ib9b1b741aaf5b09b24d7dce09a49c2fa7737209f
2020-05-05Make Bionic and kernel system includes explicit in the blueprints.Martin Stjernholm
Before this Soong added hardcoded system include paths to bionic/libc/{include,kernel}, which won't work when Bionic libs are packaged up as prebuilts in an SDK module snapshot. Test: Build and boot Test: Check in out/verbose.log.gz that a C file doesn't get any bionic include path for linux_glibc. Bug: 153590472 Change-Id: I13c8eb3dd7150d6e0fee001b290b53fcebebcfea
2020-03-18Revert "Statically link libdl.a to linker"Jooyung Han
This reverts commit 8dba7fefb0f00f697847bf0209a7289a689e80d2. Reason for revert: This workaround is not necessary with ag/10700799 Merged-In: I2bf469bfe00f3a70e67085abfb3822db6908d522 Change-Id: If351aedfce23d60582f0c5ff965f94356d1900d9 Bug: 150860940
2020-03-11Statically link libdl.a to linkerJiyong Park
When libbase is built for an APEX, it uses dlsym to reflectively access liblog symbols that are added in R. This is because the APEX where libbasse is packaged into might be running in pre-R devices where the symbols don't exist in liblog.so. This however causes a problem for a static executable in an APEX. Since it is in an APEX, the dlsym is used. But libdl.so which provides dlsym is not available to static executable. Currently, the dynamic linker is the only executable in an APEX that all of its dependencies are statically linked. Fixing the issue by providing fake dlsym by statically linking to libdl.a. Exempt-From-Owner-Approval: cherry-pick rvc-dev Bug: 149569129 Test: m Merged-In: I2e9e45d9876c2d6c878e541715389e6d1ef56996 (cherry picked from commit ec829ed4ea3e0b2e1444ee4dfef660c49e392292) Change-Id: I2e9e45d9876c2d6c878e541715389e6d1ef56996
2020-03-10Merge "Delete definitions of __aeabi_unwind_cpp_pr0."Treehugger Robot
2020-02-27Add 29 to stubs.versions of libc/libdl/libmJooyung Han
Stubs of version 29 should be provided to those APEX modules targeting previous SDK release. Bug: 145796956 Test: m Change-Id: I9454fbf81377aba25e75a6fdfc77cbb070eaadde
2020-01-22Make ramdisk_available.Yifan Hong
Test: pass Bug: 147347110 Change-Id: I142311a7558a19d209bcd63207a88e12cf6f130e
2020-01-10Delete definitions of __aeabi_unwind_cpp_pr0.Peter Collingbourne
These are no longer necessary now that LLVM no longer emits references to this symbol on Android. Bug: 144430859 Change-Id: I6c43338f755ce5a79e2df36bd3f2006a748fab27
2019-11-21Reland "Add libdl_android to the Runtime (aka Bionic) APEX".Martin Stjernholm
Before this it ended up in /system. Test: build & boot Test: adb shell find system apex -name libdl_android.so | xargs adb shell ls -l => apex/com.android.runtime/lib/bionic/libdl_android.so apex/com.android.runtime/lib64/bionic/libdl_android.so apex/com.android.runtime@1/lib/bionic/libdl_android.so apex/com.android.runtime@1/lib64/bionic/libdl_android.so system/lib/bootstrap/libdl_android.so system/lib/libdl_android.so -> /apex/com.android.runtime/lib/bionic/libdl_android.so system/lib64/bootstrap/libdl_android.so system/lib64/libdl_android.so -> /apex/com.android.runtime/lib64/bionic/libdl_android.so Test: atest CtsBionicTestCases Test: Repro in b/144343305#comment8 together with ag/9754153 Bug: 135753770 Bug: 144343305 Change-Id: I9ccd10b711223ca474e91741711b7b8efd521b2d
2019-11-07Revert submission of topic 'libdl_android-in-apex'Yuexi Ma
Reason for revert: broke numerous major apps in app compat testing Bug: 144100240 Change-Id: I50b440356bdbde3ac130da5d28d5ef20f8b63582
2019-11-06Add libdl_android to the Runtime APEX.Martin Stjernholm
Before this it ended up in /system. Test: build & boot Test: adb shell find system apex -name libdl_android.so | xargs adb shell ls -l => apex/com.android.runtime/lib/bionic/libdl_android.so apex/com.android.runtime/lib64/bionic/libdl_android.so apex/com.android.runtime@1/lib/bionic/libdl_android.so apex/com.android.runtime@1/lib64/bionic/libdl_android.so system/lib/bootstrap/libdl_android.so system/lib/libdl_android.so -> /apex/com.android.runtime/lib/bionic/libdl_android.so system/lib64/bootstrap/libdl_android.so system/lib64/libdl_android.so -> /apex/com.android.runtime/lib64/bionic/libdl_android.so Bug: 135753770 Change-Id: Ibabb5714e8cc0454c77ae5d42d9650c345ff1b89
2019-10-14Move dl_unwind_find_exidx from libdl.a to libc.aRyan Prichard
arm32 has two special APIs to find exidx exception handling info, dl_unwind_find_exidx and __gnu_Unwind_Find_exdix. The two functions have identical behavior and function prototypes. libgcc's arm32 unwinder calls __gnu_Unwind_Find_exdix, whereas LLVM's libunwind previously called __gnu_Unwind_Find_exdix, but switched to dl_unwind_find_exidx as a result of three patches (D30306, D30681, D39468). In Bionic, for dynamic linking, __gnu_Unwind_Find_exdix in libc.so calls dl_unwind_find_exidx in libdl.so. For static executables, though, __gnu_Unwind_Find_exdix in libc.a used the __exidx_* symbols, while dl_unwind_find_exidx in libdl.a(libdl_static.o) was a return-0 no-op. To fix the LLVM unwinder, replace the no-op dl_unwind_find_exidx in libdl.a with a real function in libc.a(exidx_static.o), and have the GNU function call the dl function for more consistency with dynamic linking. dl_iterate_phdr follows a similar pattern, where the function exists in libc.a and libdl.so (not libc.so or libdl.a). This change makes unwinding work with an updated libunwind_llvm on arm32, and it helps to allow unwinding in static executables without libdl.a. Bug: https://github.com/android/ndk/issues/1094 Bug: http://b/141485154 Test: NDK tests, bionic unit tests Change-Id: Ieeeb9b39a0e28544e21f9afe6fe51ef10d7c828c
2019-10-07Restrict the availability of the bionic libsJiyong Park
The bionic libs are now restricted to be in the runtime APEX and the platform (for bootstrapping). It can still be referenced from other APEXes but can't be included there. Bug: 139870423 Test: m Change-Id: I7f99eef27ccf75844ca5c9a7ea866496841b738f
2019-08-15Fix a few bionic test failures caused by hwasan global instrumentation.Peter Collingbourne
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
2019-07-16Clear pointer tags as required for HWASAN for globals.Peter Collingbourne
A future version of HWASAN will set pointer tags when taking the address of a global. This means that we need to untag pointers in a couple of cases where potential global pointers are passed to an interface that expects untagged pointers: - The WriteProtected class, whose only instances are globals, passes its own address to mprotect. However, our device kernels do not currently untag pointers passed to mprotect (the proposed upstream kernel patches do, however, untag these pointers), so once HWASAN starts tagging global pointers, this will start failing. - The shadow_load function loads from a shadow that corresponds to the address space bounds of loaded binaries. Since these address space bounds are untagged, the pointer needs to be untagged to match. Test: boots Change-Id: I3f11ce6eb7261752e5ff6d039d04dd45516b236f
2019-05-07Merge "Enable native_bridge_support"Dimitry Ivanov
2019-05-06Exclude libgcc_stripped wherever libgcc is excludedYi Kong
Test: manual testing Bug: 130267141 Bug: 29275768 Change-Id: If50420c05d36e6f680a36673e7c26ca7deb93b28
2019-05-06Enable native_bridge_supportdimitry
Enable native bridge support for bionic libraries. Makes it possible to use them in binaries for translated architectures. Bug: http://b/77159578 Test: make Change-Id: Iccd4ad7aecfa5260cc15f09ca975d2e18987278a
2019-04-22libdl.a: make dlerror() always report an error.Elliott Hughes
Seems only logical, given that all the other calls fail. (Only thing that's weird about this is that calling dlerror() usually clears the error until you do something else that causes an error, but that doesn't seem worth the bookkeeping?) Bug: https://github.com/android-ndk/ndk/issues/965 Test: static unit tests still pass Change-Id: I5e5401e148c5857f1dbab9c5a7f4a6fc43d8d626
2019-04-19Move libdl and linker to static NOTICE files.Elliott Hughes
The libstdc++ directory has no copyright headers, so it was a no-op anyway. The interesting part will be switching libc and libm over to genrules... Test: N/A Change-Id: Iec92562af40c451fdcb4a7468984878ec5dba2ce
2019-04-11Load libc_malloc_* libraries from the runtime APEXJiyong Park
/system/lib/libc.so is a symlink to libc.so in the runtime APEX. libc_malloc_* libraries are bundled with libc.so because they share implementation details. However, since libc.so is loaded in the default namespace where the runtime APEX path (/apex/com.android.runtime/lib) is not accessible, libc.so has been using libc_malloc_* from /system/lib. This is wrong because libc.so (from the runtime APEX) and libc_malloc_* (from the platform) may not be in-sync. libc.so now uses android_dlopen_ext to load libc_malloc_* libraries correctly from the "runtime" linker namespace. Bug: 122566199 Test: bionic-unit-tests Merged-In: I46980fbe89e93ea79a7760c9b8eb007af0ada8d8 Change-Id: I46980fbe89e93ea79a7760c9b8eb007af0ada8d8 (cherry picked from commit 4e46ac69c23c8585bce17c2e032986a37bf33aef)
2019-04-01Fix CtsJniTestCasesdimitry
The linker_namespaces test need android_get_LD_LIBRARY_PATH function. Bug: http://b/129479780 Test: atest CtsJniTestCases Change-Id: Iba5f74e1e4b5b1de173150120293102524db2507 (cherry picked from commit 91b0c68009c6d6efbaab8f268a5c9afb141c5ab4)
2019-04-01Fix formattingdimitry
Test: make Change-Id: I92b8893997c2fd75002e84070a3ca91fca4b110e
2019-04-01Move platform-private symbols out of libdl.sodimitry
Symbols not intended to be accessible from apps are moved to libdl_android.so Test: bionic-unit-tests Bug: http://b/129387775 Change-Id: Ib8ba6147a20cf56550c9a008f66570a2d419565a (cherry picked from commit 2d6be9a751685b4c307632bf27e8c100310ad500)
2019-03-14Don't install *.mountpoint targetsJiyong Park
The *.mountpoint targets that installs /bionic/lib/lib*.so and /bionic/bin/linker* are no longer needed. Now, /system/lib/lib*.so and /system/bin/linker* are simply symlinks to the corresponding files in the runtime apex. For example, /system/lib/libc.so -> /apex/com.android.runtime/lib/bionic/libc.so This is made possible because we now activate APEXes even before the data partition is mounted. Before the data partition mounting, the APEXes from the system partition are ativated. After the data partition is mounted, updated APEXes in the partition (if any) are activated. As a result, the symlink always points to the valid path regardless of whether /data is mounted or not. Bug: 125549215 Test: device boots Change-Id: Ie7d83686abe00b3c436f9f9db75d4244200a0fc9
2019-02-15Clarify reason for native_coverage being off for libdlPirama Arumuga Nainar
Bug: http://b/124067925 It's off because it doesn't link with any system_shared_libs. Test: N/A Change-Id: I293fb9ba8df213f8f6bbec85135a974e5966f0cc
2019-02-07Disable native_coverage for libdlPirama Arumuga Nainar
Bug: http://b/116873221 Bug: http://b/124067925 If not, https://android-review.googlesource.com/c/platform/build/soong/+/848621 breaks blueline_coverage-userdebug target in internal branches with the following error: build/make/core/base_rules.mk:290: error: bionic/libdl: MODULE.TARGET.SHARED_LIBRARIES.libdl already defined by bionic/libdl. Test: build blueline_coverage-userdebug in internal branch. Change-Id: I8fff866ae2e17ce6daa4d8c75c72ceb17e2e73de
2019-01-31Add bionic mount points under /bionicJiyong Park
This change adds following files and symlinks: Files: /bionic/lib[64]/lib{c|dl|m}.so /bionic/bin/linker[64] Symlinks: /system/lib[64]/lib{c|dl|m}.so -> /bionic/lib[64]/lib{c|dl|m}.so /system/bin/linker[64] -> /bionic/bin/linker[64] /system/bin/linker_asan[64] -> /bionic/bin/linker[64] The files serve as mount points for either the bootstrap Bionic or the default Bionic from the runtime APEX. init does the bind-mounting during booting. The symlinks are there to not change the ordinary paths to the bionic files; there are many places that the paths are implied or hard-coded, e.g., dlopen("/system/lib/libc.so") or DT_INTERP pointing to /system/bin/linker in the vendor prebuilts. Bug: 120266448 Test: m blueline, cf_x86, aosp_arm The aforementioned files and symlinks are found Change-Id: I97e38c29409ac0610dde285db8df6e94a7930094
2019-01-04Add stubs variants for bionic libsJiyong Park
Bionic libs are part of the runtime APEX (com.android.runtime). In order to be able to update the runtime APEX independetly from the platform, we have to prevent things outside of the APEX from using bionic symbols that are not guaranteed to be stable. Otherwise, platform could break when a symbol is removed from the libs via the APEX update. To achive this goal, this change adds stubs variant to the bionic libs. With this, things outside of the runtime APEX (i.e. other APEXes and the platform) are built with the stubs variants that provide only the symbols that are guaranteed to be stable. The set of symbols are basically the same as the symbols available to NDK clients. However, there are a few additional symbols that are not available for NDK but should be made available for platform components. They are marked with "# apex" tag. Symbols with that tag are not exposed to apps (via NDK stubs) or vendors (via LLNDK stubs). Note that the stubs is a build-time only artifact. It is used just to break the build when private symbols are used outside of the runtime APEX. At runtime, the real library in the APEX is used. Bug: 120266448 Test: m Test: m bionic-unit-tests Change-Id: I7b8d75830c81d7d7d54e2fca21a85b3417531b47
2018-12-17Generate the per-arch .map files at build time.Elliott Hughes
We shouldn't be checking in these generated files... Bug: N/A Test: ran tests Change-Id: Ib67c1ba839eacd7acebd713e1dcd4dd2c25d67f0
2018-12-03Prevent dependency cycle due to system_shared_libs expansionDan Willemsen
It was discovered that we were building some objects inconsistently due to an optimization in cc_library to only build objects once and use them for both the static and shared libraries. But static libraries didn't get system_shared_libs set automatically, and we didn't notice that we would have built the objects differently. So static libraries now get the default system_shared_libs, we allow adjusting that for static vs shared in a cc_library, and we disable the optimization if the linked libraries are configured differently between static and shared in a single cc_library. This triggers dependency cycles for static libraries that libc/libdl use, so fix those cycles here. Test: treehugger Change-Id: I3cf7fda161a05ec32e0c1e871999720d12a4d38e
2018-11-15Make android_get_application_target_sdk_version available to the NDK.Elliott Hughes
Also move this and android_get_device_api_level into <android/api-level.h> so that they're always available. This involves cleaning up <sys/cdefs.h> slightly. Bug: N/A Test: builds Change-Id: I25435c55f3549cd0d827a7581bee75ea8228028b
2018-11-13Move API levels from `uint32_t` to `int`.Elliott Hughes
(cherrypick of a6c71a09670ca636cca5cfea9d74b03a951e2b5e.) Bug: N/A Test: builds Change-Id: I9c414e30e3c4fe2a4e16a2fe4ce18eae85fe4844
2018-10-11Allow host bionic to use libdl_staticDan Willemsen
Bug: 31559095 Test: attempt to build host bionic Change-Id: If057681a3e098efcf79f9d8a74608b10b1ac20da
2018-10-03Exclude libclang_rt.builtins symbolsYi Kong
Similar to libgcc, libclang_rt.builtins symbols need to be excluded. Bug: 29275768 Change-Id: Iaf7381de3b4dbd92997abd03667dea0baaab98e1
2018-05-23Work around b/24465209, do not pack relocation table.Chih-Hung Hsieh
Global flag --pack-dyn-relocs=android is used with clang lld. For b/24465209, we need to override that with --pack-dyn-relocs=none. Bug: 80093890 Bug: 24465209 Test: build with USE_CLANG_LLD=true and run dlext.compat_elf_hash_and_relocation_tables Change-Id: Ic3837446ff0deccf4e66425b39d3b062abcacc5e
2018-05-23Work around b/24465209, do not use clang lldChih-Hung Hsieh
See longer explanation in b/80093890. Clang lld does not generate expected DT_REL and DT_RELA tags with --hash-style=both and --pack-dyn-relocs=android. I am not sure about the extent of b/24465209, so I would rather not to use lld for these .so files for now. Bug: 80093890 Bug: 24465209 Test: build with USE_CLANG_LLD=true and run dlext.compat_elf_hash_and_relocation_tables Change-Id: I94e9fe8d687daeadb0182ae26596ca11d3f8bd9b
2018-05-14Mark as recovery_available: trueJiyong Park
Libraries that are direct or indirect dependencies of modules installed to recovery partition (e.g. toybox) are marked as recovery_available: true. This allows a recovery variant of the lib is created when it is depended by other recovery or recovery_available modules. Bug: 67916654 Bug: 64960723 Bug: 63673171 Bug: 29921292 Test: m -j Change-Id: I59bf859a10a218af6591025a0fe7d1853e328405
2018-04-04Merge "Support getting/setting API level in static binaries."Elliott Hughes
2018-04-03Support getting/setting API level in static binaries.Elliott Hughes
Bug: http://b/27917272 Test: fixes static semaphore.sem_wait_no_EINTR_in_sdk_less_equal_than_23 test Change-Id: Ifeeff20772ff0308aab9417d48671b604a3e9665