Project import
diff --git a/libdl/Android.bp b/libdl/Android.bp new file mode 100644 index 0000000..273a887 --- /dev/null +++ b/libdl/Android.bp
@@ -0,0 +1,68 @@ +// +// libdl +// +cc_library { + + // NOTE: --exclude-libs=libgcc.a makes sure that any symbols libdl.so pulls from + // libgcc.a are made static to libdl.so. This in turn ensures that libraries that + // a) pull symbols from libgcc.a and b) depend on libdl.so will not rely on libdl.so + // to provide those symbols, but will instead pull them from libgcc.a. Specifically, + // we use this property to make sure libc.so has its own copy of the code from + // libgcc.a it uses. + // + // DO NOT REMOVE --exclude-libs! + + ldflags: ["-Wl,--exclude-libs=libgcc.a"], + + // for x86, exclude libgcc_eh.a for the same reasons as above + arch: { + arm: { + version_script: "libdl.arm.map", + }, + arm64: { + version_script: "libdl.arm64.map", + }, + mips: { + version_script: "libdl.mips.map", + }, + mips64: { + version_script: "libdl.mips64.map", + }, + x86: { + ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], + version_script: "libdl.x86.map", + }, + x86_64: { + ldflags: ["-Wl,--exclude-libs=libgcc_eh.a"], + version_script: "libdl.x86_64.map", + }, + }, + srcs: ["libdl.c"], + cflags: [ + "-Wall", + "-Wextra", + "-Wunused", + "-Werror", + ], + stl: "none", + + name: "libdl", + + // NOTE: libdl needs __aeabi_unwind_cpp_pr0 from libgcc.a but libgcc.a needs a + // few symbols from libc. Using --no-undefined here results in having to link + // against libc creating a circular dependency which is removed and we end up + // with missing symbols. Since this library is just a bunch of stubs, we set + // LOCAL_ALLOW_UNDEFINED_SYMBOLS to remove --no-undefined from the linker flags. + allow_undefined_symbols: true, + system_shared_libs: [], + + sanitize: { + never: true, + }, +} + +ndk_library { + name: "libdl.ndk", + symbol_file: "libdl.map.txt", + first_version: "9", +}
diff --git a/libdl/MODULE_LICENSE_BSD b/libdl/MODULE_LICENSE_BSD new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/libdl/MODULE_LICENSE_BSD
diff --git a/libdl/NOTICE b/libdl/NOTICE new file mode 100644 index 0000000..7940d04 --- /dev/null +++ b/libdl/NOTICE
@@ -0,0 +1,32 @@ +Copyright (C) 2007 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +------------------------------------------------------------------- + +Copyright (C) 2015 The Android Open Source Project + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +------------------------------------------------------------------- +
diff --git a/libdl/libdl.arm.map b/libdl/libdl.arm.map new file mode 100644 index 0000000..1fdc1a7 --- /dev/null +++ b/libdl/libdl.arm.map
@@ -0,0 +1,46 @@ +# Generated by genversion-scripts.py. Do not edit. +# +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LIBC { + global: + android_dlopen_ext; # introduced=21 + dl_iterate_phdr; # introduced-arm=21 + dl_unwind_find_exidx; # arm + dladdr; + dlclose; + dlerror; + dlopen; + dlsym; + local: + *; +}; + +LIBC_N { + global: + dlvsym; # introduced=24 +} LIBC; + +LIBC_PLATFORM { + global: + android_dlwarning; + android_get_application_target_sdk_version; + android_set_application_target_sdk_version; + android_get_LD_LIBRARY_PATH; + android_update_LD_LIBRARY_PATH; + android_init_namespaces; + android_create_namespace; +} LIBC_N;
diff --git a/libdl/libdl.arm64.map b/libdl/libdl.arm64.map new file mode 100644 index 0000000..28d2613 --- /dev/null +++ b/libdl/libdl.arm64.map
@@ -0,0 +1,45 @@ +# Generated by genversion-scripts.py. Do not edit. +# +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LIBC { + global: + android_dlopen_ext; # introduced=21 + dl_iterate_phdr; # introduced-arm=21 + dladdr; + dlclose; + dlerror; + dlopen; + dlsym; + local: + *; +}; + +LIBC_N { + global: + dlvsym; # introduced=24 +} LIBC; + +LIBC_PLATFORM { + global: + android_dlwarning; + android_get_application_target_sdk_version; + android_set_application_target_sdk_version; + android_get_LD_LIBRARY_PATH; + android_update_LD_LIBRARY_PATH; + android_init_namespaces; + android_create_namespace; +} LIBC_N;
diff --git a/libdl/libdl.c b/libdl/libdl.c new file mode 100644 index 0000000..4cc4dea --- /dev/null +++ b/libdl/libdl.c
@@ -0,0 +1,73 @@ +/* + * Copyright (C) 2007 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include <dlfcn.h> +#include <link.h> +#include <stdlib.h> +#include <stdbool.h> +#include <android/dlext.h> + +// These are stubs for functions that are actually defined +// in the dynamic linker and hijacked at runtime. + +void* dlopen(const char* filename __unused, int flag __unused) { return 0; } + +char* dlerror(void) { return 0; } + +void* dlsym(void* handle __unused, const char* symbol __unused) { return 0; } + +void* dlvsym(void* handle __unused, const char* symbol __unused, const char* version __unused) { + return 0; +} + +int dladdr(const void* addr __unused, Dl_info* info __unused) { return 0; } + +int dlclose(void* handle __unused) { return 0; } + +#if defined(__arm__) +_Unwind_Ptr dl_unwind_find_exidx(_Unwind_Ptr pc __unused, int* pcount __unused) { return 0; } +#endif + +int dl_iterate_phdr(int (*cb)(struct dl_phdr_info* info, size_t size, void* data) __unused, + void* data __unused) { + return 0; +} + +void android_get_LD_LIBRARY_PATH(char* buffer __unused, size_t buffer_size __unused) { } +void android_update_LD_LIBRARY_PATH(const char* ld_library_path __unused) { } + +void* android_dlopen_ext(const char* filename __unused, int flag __unused, + const android_dlextinfo* extinfo __unused) { + return 0; +} + +void android_set_application_target_sdk_version(uint32_t target __unused) { } +uint32_t android_get_application_target_sdk_version() { return 0; } + +bool android_init_namespaces(const char* public_ns_sonames __unused, + const char* anon_ns_library_path __unused) { + return false; +} + +struct android_namespace_t* android_create_namespace(const char* name __unused, + const char* ld_library_path __unused, + const char* default_library_path __unused, + uint64_t type __unused, + const char* permitted_when_isolated_path __unused) { + return 0; +} + +void android_dlwarning(void* obj, void (*f)(void*, const char*)) { f(obj, 0); }
diff --git a/libdl/libdl.map.txt b/libdl/libdl.map.txt new file mode 100644 index 0000000..0a82a2e --- /dev/null +++ b/libdl/libdl.map.txt
@@ -0,0 +1,45 @@ +# +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LIBC { + global: + android_dlopen_ext; # introduced=21 + dl_iterate_phdr; # introduced-arm=21 + dl_unwind_find_exidx; # arm + dladdr; + dlclose; + dlerror; + dlopen; + dlsym; + local: + *; +}; + +LIBC_N { + global: + dlvsym; # introduced=24 +} LIBC; + +LIBC_PLATFORM { + global: + android_dlwarning; + android_get_application_target_sdk_version; + android_set_application_target_sdk_version; + android_get_LD_LIBRARY_PATH; + android_update_LD_LIBRARY_PATH; + android_init_namespaces; + android_create_namespace; +} LIBC_N;
diff --git a/libdl/libdl.mips.map b/libdl/libdl.mips.map new file mode 100644 index 0000000..28d2613 --- /dev/null +++ b/libdl/libdl.mips.map
@@ -0,0 +1,45 @@ +# Generated by genversion-scripts.py. Do not edit. +# +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LIBC { + global: + android_dlopen_ext; # introduced=21 + dl_iterate_phdr; # introduced-arm=21 + dladdr; + dlclose; + dlerror; + dlopen; + dlsym; + local: + *; +}; + +LIBC_N { + global: + dlvsym; # introduced=24 +} LIBC; + +LIBC_PLATFORM { + global: + android_dlwarning; + android_get_application_target_sdk_version; + android_set_application_target_sdk_version; + android_get_LD_LIBRARY_PATH; + android_update_LD_LIBRARY_PATH; + android_init_namespaces; + android_create_namespace; +} LIBC_N;
diff --git a/libdl/libdl.mips64.map b/libdl/libdl.mips64.map new file mode 100644 index 0000000..28d2613 --- /dev/null +++ b/libdl/libdl.mips64.map
@@ -0,0 +1,45 @@ +# Generated by genversion-scripts.py. Do not edit. +# +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LIBC { + global: + android_dlopen_ext; # introduced=21 + dl_iterate_phdr; # introduced-arm=21 + dladdr; + dlclose; + dlerror; + dlopen; + dlsym; + local: + *; +}; + +LIBC_N { + global: + dlvsym; # introduced=24 +} LIBC; + +LIBC_PLATFORM { + global: + android_dlwarning; + android_get_application_target_sdk_version; + android_set_application_target_sdk_version; + android_get_LD_LIBRARY_PATH; + android_update_LD_LIBRARY_PATH; + android_init_namespaces; + android_create_namespace; +} LIBC_N;
diff --git a/libdl/libdl.x86.map b/libdl/libdl.x86.map new file mode 100644 index 0000000..28d2613 --- /dev/null +++ b/libdl/libdl.x86.map
@@ -0,0 +1,45 @@ +# Generated by genversion-scripts.py. Do not edit. +# +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LIBC { + global: + android_dlopen_ext; # introduced=21 + dl_iterate_phdr; # introduced-arm=21 + dladdr; + dlclose; + dlerror; + dlopen; + dlsym; + local: + *; +}; + +LIBC_N { + global: + dlvsym; # introduced=24 +} LIBC; + +LIBC_PLATFORM { + global: + android_dlwarning; + android_get_application_target_sdk_version; + android_set_application_target_sdk_version; + android_get_LD_LIBRARY_PATH; + android_update_LD_LIBRARY_PATH; + android_init_namespaces; + android_create_namespace; +} LIBC_N;
diff --git a/libdl/libdl.x86_64.map b/libdl/libdl.x86_64.map new file mode 100644 index 0000000..28d2613 --- /dev/null +++ b/libdl/libdl.x86_64.map
@@ -0,0 +1,45 @@ +# Generated by genversion-scripts.py. Do not edit. +# +# Copyright (C) 2015 The Android Open Source Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +LIBC { + global: + android_dlopen_ext; # introduced=21 + dl_iterate_phdr; # introduced-arm=21 + dladdr; + dlclose; + dlerror; + dlopen; + dlsym; + local: + *; +}; + +LIBC_N { + global: + dlvsym; # introduced=24 +} LIBC; + +LIBC_PLATFORM { + global: + android_dlwarning; + android_get_application_target_sdk_version; + android_set_application_target_sdk_version; + android_get_LD_LIBRARY_PATH; + android_update_LD_LIBRARY_PATH; + android_init_namespaces; + android_create_namespace; +} LIBC_N;