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
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
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
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
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
* Specify "nocrt: true" to avoid calling __cxa_finalize.
* Define a dummy __aeabi_unwind_cpp_pr0 for arm32.
Bug: b/62815515
Bug: b/73873002
Test: boot AOSP hikey960-userdebug
Test: run ndk_cxa_example in special /system/bin/debug namespace
Test: run Bionic unit tests
Change-Id: I59bcb100a2753286b59c51a47d7a183507219a07
This commit allows users to create a link without soname filters between
two linker namespaces.
The motivation is to establish one-way shared library isolation. For
example, assume that there are two linker namespaces `default` and
`vndk`. We would like to limit the shared libraries that can be used by
the `default` namespace. In the meanwhile, we would like to allow the
`vndk` namespace to use shared libs from the `default` namespace if the
soname cannot be find in the search path or loaded sonames of the `vndk`
namespace.
shared_libs = %VNDK_CORE_LIBRARIES%
shared_libs += %VNDK_SAMEPROCESS_LIBRARIES%
vndk <-------------------------------------------- default
\_______________________________________________/^
allow_all_shared_libs = true
android_link_namespaces_all_libs() is added to libdl, but it is
versioned as LIBC_PRIVATE. android_link_namespaces_all_libs() is only
for unit tests.
Bug: 69824336
Test: adb shell /data/nativetest/linker-unit-tests/linker-unit-tests32
Test: adb shell /data/nativetest64/linker-unit-tests/linker-unit-tests64
Test: adb shell /data/nativetest/bionic-unit-tests/bionic-unit-tests
Test: adb shell /data/nativetest64/bionic-unit-tests/bionic-unit-tests
Test: Update /system/etc/ld.config*.txt and check whether the vndk
linker namespace of the vendor process can access the shared libs from
the default linker namespace.
Change-Id: I2879f0c5f5af60c7e56f8f743ebd2872e552286b
This is a squash revert of a4a4854 and 1b0f2b4
Revert "Remove a test for backwards compatibility we no longer support."
This reverts commit a4a485454a.
# This is the commit message #2:
Revert "Remove obsolete workaround."
This reverts commit 1b0f2b49d5.
Bug: 72143978
Bug: 24465209
Test: Tested failing case on sailfish, reverted back all CL's since
Test: 3471433 for b/24465209 and apps open
This will allow us to apply linker's version script to the "fake"
version of ld-android.so.
Test: make
Change-Id: I55645cc0fc90e6c65e2269ba2340a908aeed1eaa
The no-arg function definitions in libdl.c weren't strictly correct,
because they should have taken void. Rename .c to .cpp instead of
fixing them.
Test: mma
Change-Id: I9e3528c836ffc8625a6a4d529034263b19b9fb3a
Also make a static library which can be used to override these symbols
in other implementations of libdl.so
Test: make
Change-Id: Id433bb07ecbfc4955c3fb7591ace971c2cda7862
We can mark a whole version "introduced=" rather than doing every line
separately.
Bug: N/A
Test: builds
Change-Id: I3219edc755a42ce5ff6258efb744fb5e05967a3a
The current code is incorrect when the target address is 18 bit aligned.
Test: stops random (and extremely rare) crashes in media.extractor
Bug: 63400743
Bug: 65590288
Change-Id: I65b45ff0c4b57a7ff08d3f5b3d80f41167d3c0f8
__cfi_shadow_size returns the size of the CFI shadow mapping, or 0 if
CFI is not (yet) used in this process. This can be used to adjust
RLIMIT_AS setting.
Test: device bionic tests
Bug: 64293803
Change-Id: Icd7164f96aa7115b3585c21c0f68529cd2f07c11
When a vendor lib (or vendor-available platform lib) is built with
sanitizer on, __cfi_slowpath_diag is required. However, when building
for those libs, the llndk stub of libdl.so is provided for them and
__cfi_slowpath_diag is not exposed to the stub. In order to make the
sanitizing build successful, expose the symbol.
These symbols are also exposed to NDK clients since we may want to CFI
for unbundled apps.
Bug: 63053790
Bug: 63342219
Test: BOARD_VNDK_VERSION=current m -j libstagefright_foundation.vendor
Change-Id: I081deddb4f66354aaecec4b395d4e17e5566c578
Depending on how ld.config.txt is configured, there can be multiple
built-in namespaces created by the linker from the beginning of a
process. android_get_exported_namespace is a platform only API for
getting a handle (android_namespace_t*) to one of the built-in namespaces
with given name. The returned namespace can then be given to
android_dlopen_ext in order to explicitly specify the target namespace
where the library is searched and loaded from.
Note that this function only returns 'exported' namespaces created via
ld.config.txt file. In order to export a namespace, the visible property
should be set to true:
namespace.<name>.visible = true
Namespaces are hidden by default. Hidden namespaces and namespaces
that are created programmatically, notably 'classloader-namespace',
aren't returned by this function.
Bug: 36851137
Test: confirmed that namespaces created with ld.config.txt is retrieved.
Test: linker-unit-tests passes
Merged-in: I714b510fa24f77e42c3dfc4c827b3befa8bb2951
Change-Id: I0d05fa7e0e116009edf8ea362ab46774bc617cbf
(cherry picked from commit d7c4832e6a)
This needs to be defined as weak because it is also defined in libc.a.
Without this, static executables will have a multiple definition
error.
Test: make checkbuild
Bug: None
Change-Id: If2024ef4191c8ab7cf087d21d76fefdc92b58da1
Soong handles these automatically now.
Bug: 33241851
Test: Android-aosp_arm.mk is the same before/after
Test: build.ninja is the same before/after
Test: build-aosp_arm.ninja is the same before/after
Merged-In: Ibfe4cf5db732d9007b1cc12dbc523c427de1b23d
Change-Id: Ibfe4cf5db732d9007b1cc12dbc523c427de1b23d
The stub libraries are the same as the (equivalent version) NDK, but
they also contain symbols tagged with 'vndk'. Except there are none of
those in Bionic currently.
For headers, the LLNDK/VNDK isn't using a sysroot like the NDK. Nor is
it hardcoding an explicit source path list like the platform. Instead it
runs the bionic/libc/include directory through versioner like the NDK,
then exports those generated headers and the kernel headers from the
stub library like any other exported header. Except it uses -isystem
instead of -I due to export_headers_as_system.
Test: aosp_arm; m -j
Test: Enable BOARD_VNDK_VERSION on aosp_arm; m -j
Test: Inspect out/soong/build.ninja before/after (w/o vndk)
Change-Id: Ief58a73907a83053b408b1d4b62999cba470d61c
This commit updates interface of libdl.c.
1. android_init_namespaces is replaces with android_init_anonymous_namespace
2. added 2 arguments to android_create_namespace to specify linked namespace
and the list of shared libraries sonames.
3. symbol lookup does not get past boundary libraries (added check and test for it).
Bug: http://b/26833548
Bug: http://b/21879602
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Change-Id: I32921da487a02e5bd0d2fc528904d1228394bfb9
This adds CTS test for system libraries to support
workaround for http://b/24465209: some apps require
a subset of system libs to have elf-hash and not to
use packed relocations.
Bug: http://b/32917341
Bug: http://b/24465209
Test: bionic-unit-tests --gtest_filter=Dl*:dl*
Change-Id: Ia0bc28506b1f1f97d4cf902d73b0769e2815fed3
This was introduced by d9e427cf41
where libdl.c android_dlwarning method implementation was
not updated.
This makes it delegate the call to ld-android.so
Bug: http://b/33530622
Test: build, flash and launch test app
Change-Id: I8a379442de94724280638db73e5f7934f2ea394e
Do not hijack libdl.so methods but make libdl proxy calls to
loader instead. This will be replaces by calls to libc.so
once loader functionality is migrated.
Also add a lock to dl_unwind_find_exidx function call.
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Bug: http://b/27106625
Change-Id: Ic33a7109a86f4262798d63a35f4c61d15b0068bb
Do not hijack libdl.so methods but make libdl proxy calls to
loader instead. This will be replaces by calls to libc.so
once loader functionality is migrated.
Also add a lock to dl_unwind_find_exidx function call.
Test: bionic-unit-tests --gtest_filter=dl*:Dl*
Bug: http://b/27106625
Change-Id: I9e666e771e4bbca52151cfa7fc4c8677e1480818
Disables debuggerd integration unless building for android.
Bug: 31559095
Test: Diff out/soong/build.ninja before/after, only change is moving
linker's libdebuggerd_client static lib to the beginning of the
list.
Test: lunch aosp_arm64-eng; mmma -j bionic
Change-Id: I62e725f7a9b98b7fe31637d0a835fd5846b0aff0
Generate a single NOTICE file rather than one per library. All the
headers come from libc these days anyway.
Test: tools/update_notice.sh
Bug: None
Change-Id: I127da185fdabc2815042e19aea74c507ec108f46
This change includes dlwarning implementation and
the compatibility greylist for apps targeting pre-N.
Change-Id: Ibf02a07cc58cbbb1a5aef4ac34558c5d43e4305f
Test: Run bionic-unit-tests --gtest_filter=dl*:Dl*
These directories all have Android.bp files that are always used now,
delete the Android.mk files.
Change-Id: Ib0ba2d28bff88483b505426ba61606da314e03ab
Shared namespaces clone the list of loaded native
libraries from the caller namespace. This allows
classloaders for bundled apps to share already loaded
libraries with default namespace.
Bug: http://b/22548808
Bug: http://b/26165097
Change-Id: I8949d45937fdb38e1f586ff0679003adac0d9dad
(cherry picked from commit e78deef364)
The permitted_when_isolated_path is a way to white-list
directories not present in search-path. It is ignored for
not isolated namespaces.
Bug: http://b/25853516
Bug: http://b/22548808
Change-Id: Ib1538037268eea69323ea49968a34a4a1d1938a5
The anonymous namespace is introduced to
handle cases when linker can not find the
caller. This usually happens when caller
code was not loaded by dynamic linker;
for example mono-generated code.
Bug: http://b/25844435
Bug: http://b/22548808
Change-Id: I9e5b1d23c1c75bc78548d68e79216a6a943a33cf
Add a function "android_dlopen_ext()", defined in <android/dlext.h>.
This is an extended version of dlopen() which takes a struct for passing
additional parameters for Android-specific functionality. This will be
used to support RELRO section sharing between separate processes.
Bug: 13005501
Change-Id: I9c99b2f2a02ee329dedaeba09ef3a1113b17b2d6
We're not going to have init(1) set LD_LIBRARY_PATH globally on 64-bit.
This patch makes it possible for libnativehelper to set LD_LIBRARY_PATH
in each Java VM (to support System.loadLibrary) without also hard-coding
the default search path there.
Change-Id: If13961fae976e06dd80d5ef522f31e8b7eb01154
Use basic .c versions of all functions for x86_64 until they are
manually optimized and .s versions released.
Change-Id: I59bba08931e894822db485c8803c2665c226234a
Signed-off-by: Pavel Chupin <pavel.v.chupin@intel.com>
This should help prevent broken builds next time I'm messing with
assembler/compiler/linker flags...
Change-Id: I30f15a3ce3c3f3c60cad7bc59aaba9f42d792224
Remove the hand-collated ones, and switch to a script that pulls the
copyright headers out of every file and collects the unique ones.
Change-Id: Ied3b98b3f56241df97166c410ff81de4e0157c9d
dladdr() is a GNU extension function, which allows the caller to retrieve
symbol information for a specified memory address. It is useful for things
like generating backtrace information at runtime.
Change-Id: I3a1def1a6c9c666d93e1e97b7d260dfa5b9b79a9