blob: 00921799a984f678393a5aa5ebaf4e65d5ae9526 [file] [log] [blame]
Elliott Hughes3b297c42012-10-11 16:08:51 -07001/*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Elliott Hughes5419b942012-10-16 15:54:46 -070017#include "linker.h"
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -070018#include "linker_cfi.h"
Dimitry Ivanov48ec2882016-08-04 11:50:36 -070019#include "linker_globals.h"
Dimitry Ivanov769b33f2016-07-21 11:33:40 -070020#include "linker_dlwarning.h"
Elliott Hughes5419b942012-10-16 15:54:46 -070021
Elliott Hughes3b297c42012-10-11 16:08:51 -070022#include <pthread.h>
23#include <stdio.h>
Elliott Hughes5419b942012-10-16 15:54:46 -070024#include <stdlib.h>
Elliott Hughes05fc1d72015-01-28 18:02:33 -080025#include <string.h>
Dmitriy Ivanov19133522015-06-02 17:36:54 -070026#include <android/api-level.h>
Elliott Hughes3b297c42012-10-11 16:08:51 -070027
Elliott Hughes5419b942012-10-16 15:54:46 -070028#include <bionic/pthread_internal.h>
Elliott Hugheseb847bc2013-10-09 15:50:50 -070029#include "private/bionic_tls.h"
30#include "private/ScopedPthreadMutexLocker.h"
31#include "private/ThreadLocalBuffer.h"
Elliott Hughes3b297c42012-10-11 16:08:51 -070032
33/* This file hijacks the symbols stubbed out in libdl.so. */
34
Elliott Hughes212e0e32014-12-01 16:43:51 -080035static pthread_mutex_t g_dl_mutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
Elliott Hughes3b297c42012-10-11 16:08:51 -070036
Elliott Hughes5e071a12016-08-11 15:02:45 -070037static char* __bionic_set_dlerror(char* new_value) {
Elliott Hughes2a0b8732013-10-08 18:50:24 -070038 char** dlerror_slot = &reinterpret_cast<char**>(__get_tls())[TLS_SLOT_DLERROR];
Elliott Hughes5419b942012-10-16 15:54:46 -070039
Elliott Hughes5e071a12016-08-11 15:02:45 -070040 char* old_value = *dlerror_slot;
Elliott Hughes5419b942012-10-16 15:54:46 -070041 *dlerror_slot = new_value;
42 return old_value;
Elliott Hughes3b297c42012-10-11 16:08:51 -070043}
44
Elliott Hughes5419b942012-10-16 15:54:46 -070045static void __bionic_format_dlerror(const char* msg, const char* detail) {
46 char* buffer = __get_thread()->dlerror_buffer;
47 strlcpy(buffer, msg, __BIONIC_DLERROR_BUFFER_SIZE);
Dmitriy Ivanov851135b2014-08-29 12:02:36 -070048 if (detail != nullptr) {
Elliott Hughes5419b942012-10-16 15:54:46 -070049 strlcat(buffer, ": ", __BIONIC_DLERROR_BUFFER_SIZE);
50 strlcat(buffer, detail, __BIONIC_DLERROR_BUFFER_SIZE);
51 }
52
53 __bionic_set_dlerror(buffer);
54}
55
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -080056char* __dlerror() {
Elliott Hughes5e071a12016-08-11 15:02:45 -070057 char* old_value = __bionic_set_dlerror(nullptr);
Elliott Hughes5419b942012-10-16 15:54:46 -070058 return old_value;
59}
60
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -080061void __android_get_LD_LIBRARY_PATH(char* buffer, size_t buffer_size) {
Elliott Hughes1728b232014-05-14 10:02:03 -070062 ScopedPthreadMutexLocker locker(&g_dl_mutex);
Elliott Hughesa4aafd12014-01-13 16:37:47 -080063 do_android_get_LD_LIBRARY_PATH(buffer, buffer_size);
64}
65
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -080066void __android_update_LD_LIBRARY_PATH(const char* ld_library_path) {
Elliott Hughes1728b232014-05-14 10:02:03 -070067 ScopedPthreadMutexLocker locker(&g_dl_mutex);
Elliott Hughescade4c32012-12-20 14:42:14 -080068 do_android_update_LD_LIBRARY_PATH(ld_library_path);
69}
70
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -080071static void* dlopen_ext(const char* filename,
72 int flags,
73 const android_dlextinfo* extinfo,
74 const void* caller_addr) {
Elliott Hughes1728b232014-05-14 10:02:03 -070075 ScopedPthreadMutexLocker locker(&g_dl_mutex);
Dimitry Ivanovb996d602016-07-11 18:11:39 -070076 g_linker_logger.ResetState();
Dimitry Ivanovd88e1f32016-03-24 15:30:30 -070077 void* result = do_dlopen(filename, flags, extinfo, caller_addr);
Dmitriy Ivanov851135b2014-08-29 12:02:36 -070078 if (result == nullptr) {
Elliott Hughes650be4e2013-03-05 18:47:58 -080079 __bionic_format_dlerror("dlopen failed", linker_get_error_buffer());
Dmitriy Ivanov851135b2014-08-29 12:02:36 -070080 return nullptr;
Elliott Hughes3b297c42012-10-11 16:08:51 -070081 }
Elliott Hughes3b297c42012-10-11 16:08:51 -070082 return result;
83}
84
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -080085void* __android_dlopen_ext(const char* filename,
86 int flags,
87 const android_dlextinfo* extinfo,
88 const void* caller_addr) {
Dmitriy Ivanove5cfafe2015-07-17 10:36:10 -070089 return dlopen_ext(filename, flags, extinfo, caller_addr);
Dmitriy Ivanovb648a8a2014-05-19 15:06:58 -070090}
91
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -080092void* __dlopen(const char* filename, int flags, const void* caller_addr) {
Dmitriy Ivanove5cfafe2015-07-17 10:36:10 -070093 return dlopen_ext(filename, flags, nullptr, caller_addr);
Torne (Richard Coles)012cb452014-02-06 14:34:21 +000094}
95
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -080096void* dlsym_impl(void* handle, const char* symbol, const char* version, const void* caller_addr) {
Dimitry Ivanov4a2c5aa2015-12-10 16:08:14 -080097 ScopedPthreadMutexLocker locker(&g_dl_mutex);
Dimitry Ivanovb996d602016-07-11 18:11:39 -070098 g_linker_logger.ResetState();
Dimitry Ivanov4a2c5aa2015-12-10 16:08:14 -080099 void* result;
Dimitry Ivanov9cf99cb2015-12-11 14:22:24 -0800100 if (!do_dlsym(handle, symbol, version, caller_addr, &result)) {
Dimitry Ivanov4a2c5aa2015-12-10 16:08:14 -0800101 __bionic_format_dlerror(linker_get_error_buffer(), nullptr);
Dmitriy Ivanov851135b2014-08-29 12:02:36 -0700102 return nullptr;
Elliott Hughes3b297c42012-10-11 16:08:51 -0700103 }
Dimitry Ivanov4a2c5aa2015-12-10 16:08:14 -0800104
105 return result;
Elliott Hughes3b297c42012-10-11 16:08:51 -0700106}
107
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800108void* __dlsym(void* handle, const char* symbol, const void* caller_addr) {
Dimitry Ivanov9cf99cb2015-12-11 14:22:24 -0800109 return dlsym_impl(handle, symbol, nullptr, caller_addr);
110}
111
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800112void* __dlvsym(void* handle, const char* symbol, const char* version, const void* caller_addr) {
Dimitry Ivanov9cf99cb2015-12-11 14:22:24 -0800113 return dlsym_impl(handle, symbol, version, caller_addr);
114}
115
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800116int __dladdr(const void* addr, Dl_info* info) {
Elliott Hughes1728b232014-05-14 10:02:03 -0700117 ScopedPthreadMutexLocker locker(&g_dl_mutex);
Dimitry Ivanov4a2c5aa2015-12-10 16:08:14 -0800118 return do_dladdr(addr, info);
Elliott Hughes3b297c42012-10-11 16:08:51 -0700119}
120
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800121int __dlclose(void* handle) {
Elliott Hughes1728b232014-05-14 10:02:03 -0700122 ScopedPthreadMutexLocker locker(&g_dl_mutex);
Dimitry Ivanovd88e1f32016-03-24 15:30:30 -0700123 int result = do_dlclose(handle);
124 if (result != 0) {
125 __bionic_format_dlerror("dlclose failed", linker_get_error_buffer());
126 }
127 return result;
Elliott Hughes3b297c42012-10-11 16:08:51 -0700128}
129
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800130// This function is needed by libgcc.a (this is why there is no prefix for this one)
Andreas Gampedcb846c2016-12-06 02:10:13 +0000131int dl_iterate_phdr(int (*cb)(dl_phdr_info* info, size_t size, void* data), void* data) {
Dmitriy Ivanov7271caf2015-06-29 14:48:25 -0700132 ScopedPthreadMutexLocker locker(&g_dl_mutex);
133 return do_dl_iterate_phdr(cb, data);
134}
135
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800136#if defined(__arm__)
137_Unwind_Ptr __dl_unwind_find_exidx(_Unwind_Ptr pc, int* pcount) {
138 ScopedPthreadMutexLocker locker(&g_dl_mutex);
139 return do_dl_unwind_find_exidx(pc, pcount);
140}
141#endif
142
143void __android_set_application_target_sdk_version(uint32_t target) {
Dmitriy Ivanovd974e882015-05-27 18:29:41 -0700144 // lock to avoid modification in the middle of dlopen.
145 ScopedPthreadMutexLocker locker(&g_dl_mutex);
Dmitriy Ivanov79fd6682015-05-21 17:43:49 -0700146 set_application_target_sdk_version(target);
147}
148
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800149uint32_t __android_get_application_target_sdk_version() {
Dmitriy Ivanov79fd6682015-05-21 17:43:49 -0700150 return get_application_target_sdk_version();
151}
152
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800153void __android_dlwarning(void* obj, void (*f)(void*, const char*)) {
Dimitry Ivanov769b33f2016-07-21 11:33:40 -0700154 ScopedPthreadMutexLocker locker(&g_dl_mutex);
155 get_dlwarning(obj, f);
156}
157
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800158bool __android_init_namespaces(const char* public_ns_sonames,
Dmitriy Ivanov1ffec1c2015-11-23 11:26:35 -0800159 const char* anon_ns_library_path) {
Dmitriy Ivanov42d5fcb2015-10-29 17:01:24 -0700160 ScopedPthreadMutexLocker locker(&g_dl_mutex);
Dmitriy Ivanov1ffec1c2015-11-23 11:26:35 -0800161 bool success = init_namespaces(public_ns_sonames, anon_ns_library_path);
Dmitriy Ivanov42d5fcb2015-10-29 17:01:24 -0700162 if (!success) {
Dmitriy Ivanov1ffec1c2015-11-23 11:26:35 -0800163 __bionic_format_dlerror("android_init_namespaces failed", linker_get_error_buffer());
Dmitriy Ivanov42d5fcb2015-10-29 17:01:24 -0700164 }
165
166 return success;
167}
168
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800169android_namespace_t* __android_create_namespace(const char* name,
170 const char* ld_library_path,
171 const char* default_library_path,
172 uint64_t type,
173 const char* permitted_when_isolated_path,
174 android_namespace_t* parent_namespace,
175 const void* caller_addr) {
Dmitriy Ivanov42d5fcb2015-10-29 17:01:24 -0700176 ScopedPthreadMutexLocker locker(&g_dl_mutex);
177
Dimitry Ivanovfc2da532016-05-12 15:20:21 -0700178 android_namespace_t* result = create_namespace(caller_addr,
179 name,
180 ld_library_path,
181 default_library_path,
182 type,
183 permitted_when_isolated_path,
184 parent_namespace);
Dmitriy Ivanov42d5fcb2015-10-29 17:01:24 -0700185
186 if (result == nullptr) {
187 __bionic_format_dlerror("android_create_namespace failed", linker_get_error_buffer());
188 }
189
190 return result;
191}
192
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700193void __cfi_fail(uint64_t CallSiteTypeId, void* Ptr, void *DiagData, void *CallerPc) {
194 CFIShadowWriter::CfiFail(CallSiteTypeId, Ptr, DiagData, CallerPc);
195}
196
Elliott Hughes3b297c42012-10-11 16:08:51 -0700197// name_offset: starting index of the name in libdl_info.strtab
198#define ELF32_SYM_INITIALIZER(name_offset, value, shndx) \
199 { name_offset, \
Dmitriy Ivanov851135b2014-08-29 12:02:36 -0700200 reinterpret_cast<Elf32_Addr>(value), \
Elliott Hughes3b297c42012-10-11 16:08:51 -0700201 /* st_size */ 0, \
Chih-Hung Hsieh1a5fd9c2016-06-10 11:07:21 -0700202 ((shndx) == 0) ? 0 : (STB_GLOBAL << 4), \
Elliott Hughes3b297c42012-10-11 16:08:51 -0700203 /* st_other */ 0, \
Elliott Hughesc00f2cb2013-10-04 17:01:33 -0700204 shndx, \
205 }
Elliott Hughes3b297c42012-10-11 16:08:51 -0700206
Elliott Hughesc00f2cb2013-10-04 17:01:33 -0700207#define ELF64_SYM_INITIALIZER(name_offset, value, shndx) \
208 { name_offset, \
Chih-Hung Hsieh1a5fd9c2016-06-10 11:07:21 -0700209 ((shndx) == 0) ? 0 : (STB_GLOBAL << 4), \
Elliott Hughesc00f2cb2013-10-04 17:01:33 -0700210 /* st_other */ 0, \
211 shndx, \
Dmitriy Ivanov851135b2014-08-29 12:02:36 -0700212 reinterpret_cast<Elf64_Addr>(value), \
Elliott Hughesc00f2cb2013-10-04 17:01:33 -0700213 /* st_size */ 0, \
214 }
215
Dmitriy Ivanov79fd6682015-05-21 17:43:49 -0700216static const char ANDROID_LIBDL_STRTAB[] =
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800217 // 0000000000111111 11112222222222333 333333344444444 44555555555566666 6666677777777778 8888888889999999999
218 // 0123456789012345 67890123456789012 345678901234567 89012345678901234 5678901234567890 1234567890123456789
219 "__loader_dlopen\0__loader_dlclose\0__loader_dlsym\0__loader_dlerror\0__loader_dladdr\0__loader_android_up"
220 // 1*
221 // 000000000011111111112 2222222223333333333444444444455555555 5566666666667777777777888 88888889999999999
222 // 012345678901234567890 1234567890123456789012345678901234567 8901234567890123456789012 34567890123456789
223 "date_LD_LIBRARY_PATH\0__loader_android_get_LD_LIBRARY_PATH\0__loader_dl_iterate_phdr\0__loader_android_"
224 // 2*
225 // 00000000001 1111111112222222222333333333344444444445555555555666 6666666777777777788888888889999999999
226 // 01234567890 1234567890123456789012345678901234567890123456789012 3456789012345678901234567890123456789
227 "dlopen_ext\0__loader_android_set_application_target_sdk_version\0__loader_android_get_application_targ"
228 // 3*
Dimitry Ivanova6588e52016-12-12 13:11:50 -0800229 // 000000000011111 111112222222222333333333344444444 4455555555556666666666777777777788 8888888899999999 99
230 // 012345678901234 567890123456789012345678901234567 8901234567890123456789012345678901 2345678901234567 89
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800231 "et_sdk_version\0__loader_android_init_namespaces\0__loader_android_create_namespace\0__loader_dlvsym\0__"
232 // 4*
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700233 // 0000000000111111111122222 222223333333333444 4444444555555555566666666667777 77777788888888889999999999
234 // 0123456789012345678901234 567890123456789012 3456789012345678901234567890123 45678901234567890123456789
235 "loader_android_dlwarning\0__loader_cfi_fail\0"
Elliott Hughesa4aafd12014-01-13 16:37:47 -0800236#if defined(__arm__)
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700237 // 443
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800238 "__loader_dl_unwind_find_exidx\0"
Elliott Hughesa4aafd12014-01-13 16:37:47 -0800239#endif
Dmitriy Ivanov79fd6682015-05-21 17:43:49 -0700240 ;
Elliott Hughesa4aafd12014-01-13 16:37:47 -0800241
Elliott Hughes1728b232014-05-14 10:02:03 -0700242static ElfW(Sym) g_libdl_symtab[] = {
Elliott Hughes3b297c42012-10-11 16:08:51 -0700243 // Total length of libdl_info.strtab, including trailing 0.
244 // This is actually the STH_UNDEF entry. Technically, it's
245 // supposed to have st_name == 0, but instead, it points to an index
246 // in the strtab with a \0 to make iterating through the symtab easier.
Dmitriy Ivanov851135b2014-08-29 12:02:36 -0700247 ELFW(SYM_INITIALIZER)(sizeof(ANDROID_LIBDL_STRTAB) - 1, nullptr, 0),
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800248 ELFW(SYM_INITIALIZER)( 0, &__dlopen, 1),
249 ELFW(SYM_INITIALIZER)( 16, &__dlclose, 1),
250 ELFW(SYM_INITIALIZER)( 33, &__dlsym, 1),
251 ELFW(SYM_INITIALIZER)( 48, &__dlerror, 1),
252 ELFW(SYM_INITIALIZER)( 65, &__dladdr, 1),
253 ELFW(SYM_INITIALIZER)( 81, &__android_update_LD_LIBRARY_PATH, 1),
254 ELFW(SYM_INITIALIZER)(121, &__android_get_LD_LIBRARY_PATH, 1),
255 ELFW(SYM_INITIALIZER)(158, &dl_iterate_phdr, 1),
256 ELFW(SYM_INITIALIZER)(183, &__android_dlopen_ext, 1),
257 ELFW(SYM_INITIALIZER)(211, &__android_set_application_target_sdk_version, 1),
258 ELFW(SYM_INITIALIZER)(263, &__android_get_application_target_sdk_version, 1),
259 ELFW(SYM_INITIALIZER)(315, &__android_init_namespaces, 1),
260 ELFW(SYM_INITIALIZER)(348, &__android_create_namespace, 1),
261 ELFW(SYM_INITIALIZER)(382, &__dlvsym, 1),
Dimitry Ivanova6588e52016-12-12 13:11:50 -0800262 ELFW(SYM_INITIALIZER)(398, &__android_dlwarning, 1),
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700263 ELFW(SYM_INITIALIZER)(425, &__cfi_fail, 1),
Elliott Hughes4eeb1f12013-10-25 17:38:02 -0700264#if defined(__arm__)
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700265 ELFW(SYM_INITIALIZER)(443, &__dl_unwind_find_exidx, 1),
Elliott Hughes3b297c42012-10-11 16:08:51 -0700266#endif
267};
268
Elliott Hughes22d62922012-10-12 10:50:21 -0700269// Fake out a hash table with a single bucket.
Elliott Hughes22d62922012-10-12 10:50:21 -0700270//
Elliott Hughes1728b232014-05-14 10:02:03 -0700271// A search of the hash table will look through g_libdl_symtab starting with index 1, then
272// use g_libdl_chains to find the next index to look at. g_libdl_chains should be set up to
273// walk through every element in g_libdl_symtab, and then end with 0 (sentinel value).
Elliott Hughes22d62922012-10-12 10:50:21 -0700274//
Elliott Hughes1728b232014-05-14 10:02:03 -0700275// That is, g_libdl_chains should look like { 0, 2, 3, ... N, 0 } where N is the number
276// of actual symbols, or nelems(g_libdl_symtab)-1 (since the first element of g_libdl_symtab is not
Elliott Hughesa4aafd12014-01-13 16:37:47 -0800277// a real symbol). (See soinfo_elf_lookup().)
Elliott Hughes22d62922012-10-12 10:50:21 -0700278//
Elliott Hughesa4aafd12014-01-13 16:37:47 -0800279// Note that adding any new symbols here requires stubbing them out in libdl.
Elliott Hughes1728b232014-05-14 10:02:03 -0700280static unsigned g_libdl_buckets[1] = { 1 };
Elliott Hughes4eeb1f12013-10-25 17:38:02 -0700281#if defined(__arm__)
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700282static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 0 };
Christopher Ferris24053a42013-08-19 17:45:09 -0700283#else
Evgenii Stepanov0a3637d2016-07-06 13:20:59 -0700284static unsigned g_libdl_chains[] = { 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0 };
Christopher Ferris24053a42013-08-19 17:45:09 -0700285#endif
Elliott Hughes3b297c42012-10-11 16:08:51 -0700286
Dmitriy Ivanovaae859c2015-03-31 11:14:03 -0700287static uint8_t __libdl_info_buf[sizeof(soinfo)] __attribute__((aligned(8)));
288static soinfo* __libdl_info = nullptr;
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700289
Elliott Hughes22d62922012-10-12 10:50:21 -0700290// This is used by the dynamic linker. Every process gets these symbols for free.
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800291soinfo* get_libdl_info(const char* linker_path) {
Dmitriy Ivanovaae859c2015-03-31 11:14:03 -0700292 if (__libdl_info == nullptr) {
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800293 __libdl_info = new (__libdl_info_buf) soinfo(&g_default_namespace, linker_path, nullptr, 0, 0);
Dmitriy Ivanovaae859c2015-03-31 11:14:03 -0700294 __libdl_info->flags_ |= FLAG_LINKED;
295 __libdl_info->strtab_ = ANDROID_LIBDL_STRTAB;
296 __libdl_info->symtab_ = g_libdl_symtab;
297 __libdl_info->nbucket_ = sizeof(g_libdl_buckets)/sizeof(unsigned);
298 __libdl_info->nchain_ = sizeof(g_libdl_chains)/sizeof(unsigned);
299 __libdl_info->bucket_ = g_libdl_buckets;
300 __libdl_info->chain_ = g_libdl_chains;
301 __libdl_info->ref_count_ = 1;
302 __libdl_info->strtab_size_ = sizeof(ANDROID_LIBDL_STRTAB);
303 __libdl_info->local_group_root_ = __libdl_info;
Dimitry Ivanovd9e427c2016-11-22 16:55:25 -0800304 __libdl_info->soname_ = "ld-android.so";
Dmitriy Ivanov19133522015-06-02 17:36:54 -0700305 __libdl_info->target_sdk_version_ = __ANDROID_API__;
Dimitry Ivanovd88e1f32016-03-24 15:30:30 -0700306 __libdl_info->generate_handle();
Mike Frysinger747d30e2015-10-20 14:06:25 -0400307#if defined(__work_around_b_24465209__)
Dmitriy Ivanovaae859c2015-03-31 11:14:03 -0700308 strlcpy(__libdl_info->old_name_, __libdl_info->soname_, sizeof(__libdl_info->old_name_));
309#endif
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700310 }
Elliott Hughes3b297c42012-10-11 16:08:51 -0700311
Dmitriy Ivanovaae859c2015-03-31 11:14:03 -0700312 return __libdl_info;
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700313}