blob: 04acda4133efb6cd147cb75bdd02c6ef83fbf88b [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#ifndef _LINKER_H_
30#define _LINKER_H_
31
Nick Kralevich9ec0f032012-02-28 10:40:00 -080032#include <elf.h>
Dmitriy Ivanov0d150942014-08-22 12:25:04 -070033#include <inttypes.h>
Pavel Chupinb7beb692012-08-17 12:53:29 +040034#include <link.h>
Elliott Hughes1272dbd2014-01-09 15:45:07 -080035#include <unistd.h>
Torne (Richard Coles)012cb452014-02-06 14:34:21 +000036#include <android/dlext.h>
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -070037#include <sys/stat.h>
Elliott Hughes46882792012-08-03 16:49:39 -070038
Elliott Hughes8f2a5a02013-03-15 15:30:25 -070039#include "private/libc_logging.h"
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -070040#include "linked_list.h"
Elliott Hughes650be4e2013-03-05 18:47:58 -080041
42#define DL_ERR(fmt, x...) \
43 do { \
44 __libc_format_buffer(linker_get_error_buffer(), linker_get_error_buffer_size(), fmt, ##x); \
45 /* If LD_DEBUG is set high enough, log every dlerror(3) message. */ \
46 DEBUG("%s\n", linker_get_error_buffer()); \
Elliott Hughes7e5a8cc2013-06-18 13:15:00 -070047 } while (false)
48
49#define DL_WARN(fmt, x...) \
50 do { \
51 __libc_format_log(ANDROID_LOG_WARN, "linker", fmt, ##x); \
52 __libc_format_fd(2, "WARNING: linker: "); \
53 __libc_format_fd(2, fmt, ##x); \
54 __libc_format_fd(2, "\n"); \
55 } while (false)
56
Elliott Hughes0266ae52014-02-10 17:46:57 -080057#if defined(__LP64__)
58#define ELFW(what) ELF64_ ## what
59#else
60#define ELFW(what) ELF32_ ## what
61#endif
Elliott Hughes650be4e2013-03-05 18:47:58 -080062
Chris Dearman99186652014-02-06 20:36:51 -080063// mips64 interprets Elf64_Rel structures' r_info field differently.
64// bionic (like other C libraries) has macros that assume regular ELF files,
65// but the dynamic linker needs to be able to load mips64 ELF files.
66#if defined(__mips__) && defined(__LP64__)
67#undef ELF64_R_SYM
68#undef ELF64_R_TYPE
69#undef ELF64_R_INFO
70#define ELF64_R_SYM(info) (((info) >> 0) & 0xffffffff)
71#define ELF64_R_SSYM(info) (((info) >> 32) & 0xff)
72#define ELF64_R_TYPE3(info) (((info) >> 40) & 0xff)
73#define ELF64_R_TYPE2(info) (((info) >> 48) & 0xff)
74#define ELF64_R_TYPE(info) (((info) >> 56) & 0xff)
75#endif
76
Elliott Hughes1a696162012-11-01 13:49:32 -070077// Returns the address of the page containing address 'x'.
78#define PAGE_START(x) ((x) & PAGE_MASK)
David 'Digit' Turnerc1bd5592012-06-19 11:21:29 +020079
Elliott Hughes1a696162012-11-01 13:49:32 -070080// Returns the offset of address 'x' in its page.
81#define PAGE_OFFSET(x) ((x) & ~PAGE_MASK)
David 'Digit' Turnerc1bd5592012-06-19 11:21:29 +020082
Elliott Hughes1a696162012-11-01 13:49:32 -070083// Returns the address of the next page after address 'x', unless 'x' is
84// itself at the start of a page.
David 'Digit' Turnerc1bd5592012-06-19 11:21:29 +020085#define PAGE_END(x) PAGE_START((x) + (PAGE_SIZE-1))
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080086
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080087#define FLAG_LINKED 0x00000001
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080088#define FLAG_EXE 0x00000004 // The main executable
Nick Kralevich468319c2011-11-11 15:53:17 -080089#define FLAG_LINKER 0x00000010 // The linker itself
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -080090#define FLAG_GNU_HASH 0x00000040 // uses gnu hash
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -070091#define FLAG_NEW_SOINFO 0x40000000 // new soinfo format
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080092
Dmitriy Ivanovd225a5e2014-08-28 14:12:12 -070093#define SUPPORTED_DT_FLAGS_1 (DF_1_NOW | DF_1_GLOBAL | DF_1_NODELETE)
94
Dmitriy Ivanov618f1a32015-03-17 20:06:36 -070095#define SOINFO_VERSION 2
Dmitriy Ivanov0d150942014-08-22 12:25:04 -070096
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080097#define SOINFO_NAME_LEN 128
98
Elliott Hughesca0c11b2013-03-12 10:40:45 -070099typedef void (*linker_function_t)();
100
Chris Dearman99186652014-02-06 20:36:51 -0800101// Android uses RELA for aarch64 and x86_64. mips64 still uses REL.
102#if defined(__aarch64__) || defined(__x86_64__)
Elliott Hughes4eeb1f12013-10-25 17:38:02 -0700103#define USE_RELA 1
104#endif
105
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700106struct soinfo;
107
108class SoinfoListAllocator {
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800109 public:
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700110 static LinkedListEntry<soinfo>* alloc();
111 static void free(LinkedListEntry<soinfo>* entry);
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800112
113 private:
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700114 // unconstructable
115 DISALLOW_IMPLICIT_CONSTRUCTORS(SoinfoListAllocator);
116};
117
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800118class SymbolName {
119 public:
120 explicit SymbolName(const char* name)
121 : name_(name), has_elf_hash_(false), has_gnu_hash_(false),
122 elf_hash_(0), gnu_hash_(0) { }
123
124 const char* get_name() {
125 return name_;
126 }
127
128 uint32_t elf_hash();
129 uint32_t gnu_hash();
130
131 private:
132 const char* name_;
133 bool has_elf_hash_;
134 bool has_gnu_hash_;
135 uint32_t elf_hash_;
136 uint32_t gnu_hash_;
137
138 DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolName);
139};
140
Elliott Hughes18a206c2012-10-29 17:37:13 -0700141struct soinfo {
Elliott Hughesca0c11b2013-03-12 10:40:45 -0700142 public:
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700143 typedef LinkedList<soinfo, SoinfoListAllocator> soinfo_list_t;
144 public:
Elliott Hughesd23736e2012-11-01 15:16:56 -0700145 char name[SOINFO_NAME_LEN];
Elliott Hughes0266ae52014-02-10 17:46:57 -0800146 const ElfW(Phdr)* phdr;
Elliott Hughesca0c11b2013-03-12 10:40:45 -0700147 size_t phnum;
Elliott Hughes0266ae52014-02-10 17:46:57 -0800148 ElfW(Addr) entry;
149 ElfW(Addr) base;
Weiwu Chen5ceb8892013-12-03 19:47:34 +0800150 size_t size;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800151
Elliott Hughesc6200592013-09-30 18:43:46 -0700152#ifndef __LP64__
Elliott Hughesca0c11b2013-03-12 10:40:45 -0700153 uint32_t unused1; // DO NOT USE, maintained for compatibility.
Elliott Hughesc6200592013-09-30 18:43:46 -0700154#endif
Nick Kralevich38bccb22011-08-29 13:49:22 -0700155
Elliott Hughes0266ae52014-02-10 17:46:57 -0800156 ElfW(Dyn)* dynamic;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800157
Elliott Hughesc6200592013-09-30 18:43:46 -0700158#ifndef __LP64__
Elliott Hughesca0c11b2013-03-12 10:40:45 -0700159 uint32_t unused2; // DO NOT USE, maintained for compatibility
160 uint32_t unused3; // DO NOT USE, maintained for compatibility
Elliott Hughesc6200592013-09-30 18:43:46 -0700161#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800162
Elliott Hughesd23736e2012-11-01 15:16:56 -0700163 soinfo* next;
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700164 private:
Dmitriy Ivanovab972b92014-11-29 13:57:41 -0800165 uint32_t flags_;
166
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800167 const char* strtab_;
168 ElfW(Sym)* symtab_;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800169
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800170 size_t nbucket_;
171 size_t nchain_;
172 uint32_t* bucket_;
173 uint32_t* chain_;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800174
Chris Dearman99186652014-02-06 20:36:51 -0800175#if defined(__mips__) || !defined(__LP64__)
176 // This is only used by mips and mips64, but needs to be here for
Elliott Hughes4eeb1f12013-10-25 17:38:02 -0700177 // all 32-bit architectures to preserve binary compatibility.
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800178 ElfW(Addr)** plt_got_;
Elliott Hughes4eeb1f12013-10-25 17:38:02 -0700179#endif
180
181#if defined(USE_RELA)
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800182 ElfW(Rela)* plt_rela_;
183 size_t plt_rela_count_;
Elliott Hughesc00f2cb2013-10-04 17:01:33 -0700184
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800185 ElfW(Rela)* rela_;
186 size_t rela_count_;
Elliott Hughesc00f2cb2013-10-04 17:01:33 -0700187#else
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800188 ElfW(Rel)* plt_rel_;
189 size_t plt_rel_count_;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800190
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800191 ElfW(Rel)* rel_;
192 size_t rel_count_;
Elliott Hughesc00f2cb2013-10-04 17:01:33 -0700193#endif
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800194
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800195 linker_function_t* preinit_array_;
196 size_t preinit_array_count_;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800197
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800198 linker_function_t* init_array_;
199 size_t init_array_count_;
200 linker_function_t* fini_array_;
201 size_t fini_array_count_;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800202
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800203 linker_function_t init_func_;
204 linker_function_t fini_func_;
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800205
Elliott Hughes4eeb1f12013-10-25 17:38:02 -0700206#if defined(__arm__)
Dmitriy Ivanovab972b92014-11-29 13:57:41 -0800207 public:
Elliott Hughesd23736e2012-11-01 15:16:56 -0700208 // ARM EABI section used for stack unwinding.
Dmitriy Ivanov1b20daf2014-05-19 15:06:58 -0700209 uint32_t* ARM_exidx;
Elliott Hughesca0c11b2013-03-12 10:40:45 -0700210 size_t ARM_exidx_count;
Dmitriy Ivanov88940912014-11-12 18:20:39 -0800211 private:
Dmitriy Ivanovab972b92014-11-29 13:57:41 -0800212#elif defined(__mips__)
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800213 uint32_t mips_symtabno_;
214 uint32_t mips_local_gotno_;
215 uint32_t mips_gotsym_;
Dmitriy Ivanov88940912014-11-12 18:20:39 -0800216 bool mips_relocate_got(const soinfo_list_t& global_group, const soinfo_list_t& local_group);
217
Elliott Hughesd23736e2012-11-01 15:16:56 -0700218#endif
Dmitriy Ivanovab972b92014-11-29 13:57:41 -0800219 size_t ref_count_;
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800220 public:
Elliott Hughes3a9c5d62014-02-10 13:31:13 -0800221 link_map link_map_head;
Evgeniy Stepanove83c56d2011-12-21 13:03:54 +0400222
Elliott Hughesd23736e2012-11-01 15:16:56 -0700223 bool constructors_called;
Nick Kralevich9ec0f032012-02-28 10:40:00 -0800224
Elliott Hughesd23736e2012-11-01 15:16:56 -0700225 // When you read a virtual address from the ELF file, add this
226 // value to get the corresponding address in the process' address space.
Elliott Hughes0266ae52014-02-10 17:46:57 -0800227 ElfW(Addr) load_bias;
Ard Biesheuvel5ae44f32012-08-30 12:48:32 +0200228
Elliott Hughese4d792a2013-10-28 14:19:05 -0700229#if !defined(__LP64__)
Elliott Hughesd23736e2012-11-01 15:16:56 -0700230 bool has_text_relocations;
Elliott Hughese4d792a2013-10-28 14:19:05 -0700231#endif
Dmitriy Ivanov96bc37f2014-09-29 12:10:36 -0700232 bool has_DT_SYMBOLIC;
Dmitriy Ivanov0d150942014-08-22 12:25:04 -0700233
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800234 public:
Dmitriy Ivanov07e5bc12014-10-03 17:52:44 -0700235 soinfo(const char* name, const struct stat* file_stat, off64_t file_offset, int rtld_flags);
Dmitriy Ivanov0d150942014-08-22 12:25:04 -0700236
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800237 void call_constructors();
238 void call_destructors();
239 void call_pre_init_constructors();
240 bool prelink_image();
241 bool link_image(const soinfo_list_t& global_group, const soinfo_list_t& local_group, const android_dlextinfo* extinfo);
Elliott Hughesd23736e2012-11-01 15:16:56 -0700242
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700243 void add_child(soinfo* child);
244 void remove_all_links();
245
Dmitriy Ivanovd225a5e2014-08-28 14:12:12 -0700246 ino_t get_st_ino() const;
247 dev_t get_st_dev() const;
248 off64_t get_file_offset() const;
Brigid Smithc5a13ef2014-07-23 11:22:25 -0700249
Dmitriy Ivanovd225a5e2014-08-28 14:12:12 -0700250 uint32_t get_rtld_flags() const;
251 uint32_t get_dt_flags_1() const;
252 void set_dt_flags_1(uint32_t dt_flags_1);
Dmitriy Ivanove8ba50f2014-09-15 17:00:10 -0700253
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700254 soinfo_list_t& get_children();
Dmitriy Ivanov14669a92014-09-05 16:42:53 -0700255 soinfo_list_t& get_parents();
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700256
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800257 ElfW(Sym)* find_symbol_by_name(SymbolName& symbol_name);
258 ElfW(Sym)* find_symbol_by_address(const void* addr);
Dmitriy Ivanov9aea1642014-09-11 15:16:03 -0700259 ElfW(Addr) resolve_symbol_address(ElfW(Sym)* s);
260
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700261 const char* get_string(ElfW(Word) index) const;
Dmitriy Ivanov1b20daf2014-05-19 15:06:58 -0700262 bool can_unload() const;
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800263 bool is_gnu_hash() const;
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700264
265 bool inline has_min_version(uint32_t min_version) const {
Dmitriy Ivanovab972b92014-11-29 13:57:41 -0800266 return (flags_ & FLAG_NEW_SOINFO) != 0 && version_ >= min_version;
Dmitriy Ivanov0d150942014-08-22 12:25:04 -0700267 }
Dmitriy Ivanov1b20daf2014-05-19 15:06:58 -0700268
Dmitriy Ivanovab972b92014-11-29 13:57:41 -0800269 bool is_linked() const;
270 bool is_main_executable() const;
271
272 void set_linked();
273 void set_linker_flag();
274 void set_main_executable();
275
276 void increment_ref_count();
277 size_t decrement_ref_count();
278
279 soinfo* get_local_group_root() const;
280
Dmitriy Ivanov618f1a32015-03-17 20:06:36 -0700281 const char* get_soname();
282
Elliott Hughesd23736e2012-11-01 15:16:56 -0700283 private:
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800284 ElfW(Sym)* elf_lookup(SymbolName& symbol_name);
285 ElfW(Sym)* elf_addr_lookup(const void* addr);
286 ElfW(Sym)* gnu_lookup(SymbolName& symbol_name);
287 ElfW(Sym)* gnu_addr_lookup(const void* addr);
288
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800289 void call_array(const char* array_name, linker_function_t* functions, size_t count, bool reverse);
290 void call_function(const char* function_name, linker_function_t function);
Dmitriy Ivanovfa26eee2015-02-03 16:06:47 -0800291 template<typename ElfRelIteratorT>
292 bool relocate(ElfRelIteratorT&& rel_iterator, const soinfo_list_t& global_group, const soinfo_list_t& local_group);
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700293
294 private:
295 // This part of the structure is only available
296 // when FLAG_NEW_SOINFO is set in this->flags.
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800297 uint32_t version_;
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700298
Dmitriy Ivanov0d150942014-08-22 12:25:04 -0700299 // version >= 0
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800300 dev_t st_dev_;
301 ino_t st_ino_;
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700302
303 // dependency graph
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800304 soinfo_list_t children_;
305 soinfo_list_t parents_;
Dmitriy Ivanovd59e5002014-05-09 09:10:14 -0700306
Dmitriy Ivanov0d150942014-08-22 12:25:04 -0700307 // version >= 1
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800308 off64_t file_offset_;
309 uint32_t rtld_flags_;
310 uint32_t dt_flags_1_;
311 size_t strtab_size_;
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700312
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800313 // version >= 2
Dmitriy Ivanov3597b802015-03-09 12:02:02 -0700314
315 size_t gnu_nbucket_;
316 uint32_t* gnu_bucket_;
317 uint32_t* gnu_chain_;
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800318 uint32_t gnu_maskwords_;
319 uint32_t gnu_shift2_;
Dmitriy Ivanov047b5932014-11-13 09:39:20 -0800320 ElfW(Addr)* gnu_bloom_filter_;
Dmitriy Ivanovec18ce02014-11-09 19:27:20 -0800321
Dmitriy Ivanovab972b92014-11-29 13:57:41 -0800322 soinfo* local_group_root_;
323
Dmitriy Ivanov18a69562015-02-04 16:05:30 -0800324 uint8_t* android_relocs_;
325 size_t android_relocs_size_;
326
Dmitriy Ivanov618f1a32015-03-17 20:06:36 -0700327 const char* soname_;
328
Dmitriy Ivanov6cdeb522014-09-29 19:14:45 -0700329 friend soinfo* get_libdl_info();
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800330};
331
Dmitriy Ivanov114ff692015-01-14 11:36:38 -0800332ElfW(Sym)* soinfo_do_lookup(soinfo* si_from, const char* name, soinfo** si_found_in,
333 const soinfo::soinfo_list_t& global_group, const soinfo::soinfo_list_t& local_group);
334
335enum RelocationKind {
336 kRelocAbsolute = 0,
337 kRelocRelative,
338 kRelocCopy,
339 kRelocSymbol,
340 kRelocMax
341};
342
343void count_relocation(RelocationKind kind);
344
Dmitriy Ivanov1b20daf2014-05-19 15:06:58 -0700345soinfo* get_libdl_info();
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800346
Elliott Hughesa4aafd12014-01-13 16:37:47 -0800347void do_android_get_LD_LIBRARY_PATH(char*, size_t);
Elliott Hughescade4c32012-12-20 14:42:14 -0800348void do_android_update_LD_LIBRARY_PATH(const char* ld_library_path);
Elliott Hughes1a586292014-06-03 16:23:08 -0700349soinfo* do_dlopen(const char* name, int flags, const android_dlextinfo* extinfo);
Dmitriy Ivanovb648a8a2014-05-19 15:06:58 -0700350void do_dlclose(soinfo* si);
David 'Digit' Turner16084162012-06-12 16:25:37 +0200351
Dmitriy Ivanov02aa7052014-08-18 15:08:51 -0700352ElfW(Sym)* dlsym_linear_lookup(const char* name, soinfo** found, soinfo* start);
Elliott Hughesd23736e2012-11-01 15:16:56 -0700353soinfo* find_containing_library(const void* addr);
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800354
Dmitriy Ivanov02aa7052014-08-18 15:08:51 -0700355ElfW(Sym)* dlsym_handle_lookup(soinfo* si, soinfo** found, const char* name);
Elliott Hughesd23736e2012-11-01 15:16:56 -0700356
Brian Carlstromd4ee82d2013-02-28 15:58:45 -0800357void debuggerd_init();
Elliott Hughes1728b232014-05-14 10:02:03 -0700358extern "C" abort_msg_t* g_abort_message;
Elliott Hughes18a206c2012-10-29 17:37:13 -0700359extern "C" void notify_gdb_of_libraries();
Elliott Hughes46882792012-08-03 16:49:39 -0700360
Elliott Hughes650be4e2013-03-05 18:47:58 -0800361char* linker_get_error_buffer();
362size_t linker_get_error_buffer_size();
363
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800364#endif