2016-08-04 20:50:36 +02:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2016 The Android Open Source Project
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* * Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* * Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in
|
|
|
|
* the documentation and/or other materials provided with the
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
|
|
|
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
|
|
|
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
|
|
|
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
|
|
|
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
|
|
|
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
|
|
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
|
|
|
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
|
|
* SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2018-02-13 23:26:29 +01:00
|
|
|
#pragma once
|
2016-08-04 20:50:36 +02:00
|
|
|
|
|
|
|
#include <link.h>
|
|
|
|
|
2019-01-02 03:53:48 +01:00
|
|
|
#include <memory>
|
2016-08-04 20:50:36 +02:00
|
|
|
#include <string>
|
Implement arm64 TLSDESC
Each TLSDESC relocation relocates a 2-word descriptor in the GOT that
contains:
- the address of a TLS resolver function
- an argument to pass (indirectly) to the resolver function
(Specifically, the address of the 2-word descriptor is passed to the
resolver.)
The loader resolves R_GENERIC_TLSDESC relocations using one of three
resolver functions that it defines:
- tlsdesc_resolver_static
- tlsdesc_resolver_dynamic
- tlsdesc_resolver_unresolved_weak
The resolver functions are written in assembly because they have a
restrictive calling convention. They're only allowed to modify x0 and
(apparently) the condition codes.
For a relocation to memory in static TLS (i.e. the executable or an solib
loaded initially), the loader uses a simple resolver function,
tlsdesc_resolver_static, that returns the static offset it receives from
the loader.
For relocations to dynamic TLS memory (i.e. memory in a dlopen'ed solib),
the loader uses tlsdesc_resolver_dynamic, which allocates TLS memory on
demand. It inlines the fast path of __tls_get_addr, then falls back to
__tls_get_addr when it needs to allocate memory. The loader handles these
dynamic TLS relocations in two passes:
- In the first pass, it allocates a table of TlsDynamicResolverArg
objects, one per dynamic TLSDESC relocation.
- In the second pass, once the table is finalized, it writes the
addresses of the TlsDynamicResolverArg objects into the TLSDESC
relocations.
tlsdesc_resolver_unresolved_weak returns a negated thread pointer so that
taking the address of an unresolved weak TLS symbols produces NULL.
The loader handles R_GENERIC_TLSDESC in a target-independent way, but
only for arm64, because Bionic has only implemented the resolver functions
for arm64.
Bug: http://b/78026329
Test: bionic unit tests
Test: check that backtrace works inside a resolver function and inside
__tls_get_addr called from a resolver
(gdbclient.py, b __tls_get_addr, bt)
Merged-In: I752e59ff986292449892c449dad2546e6f0ff7b6
Change-Id: I752e59ff986292449892c449dad2546e6f0ff7b6
2019-01-24 02:47:10 +01:00
|
|
|
#include <vector>
|
2016-08-04 20:50:36 +02:00
|
|
|
|
2019-01-02 03:53:48 +01:00
|
|
|
#include "private/bionic_elf_tls.h"
|
2016-08-04 20:50:36 +02:00
|
|
|
#include "linker_namespaces.h"
|
2019-01-18 10:00:59 +01:00
|
|
|
#include "linker_tls.h"
|
2016-08-04 20:50:36 +02:00
|
|
|
|
|
|
|
#define FLAG_LINKED 0x00000001
|
|
|
|
#define FLAG_EXE 0x00000004 // The main executable
|
|
|
|
#define FLAG_LINKER 0x00000010 // The linker itself
|
|
|
|
#define FLAG_GNU_HASH 0x00000040 // uses gnu hash
|
|
|
|
#define FLAG_MAPPED_BY_CALLER 0x00000080 // the map is reserved by the caller
|
|
|
|
// and should not be unmapped
|
2017-11-28 16:03:07 +01:00
|
|
|
#define FLAG_IMAGE_LINKED 0x00000100 // Is image linked - this is a guard on link_image.
|
|
|
|
// The difference between this flag and
|
|
|
|
// FLAG_LINKED is that FLAG_LINKED
|
|
|
|
// means is set when load_group is
|
|
|
|
// successfully loaded whereas this
|
|
|
|
// flag is set to avoid linking image
|
|
|
|
// when link_image called for the
|
|
|
|
// second time. This situation happens
|
|
|
|
// when load group is crossing
|
|
|
|
// namespace boundary twice and second
|
|
|
|
// local group depends on the same libraries.
|
2018-05-25 14:17:37 +02:00
|
|
|
#define FLAG_RESERVED 0x00000200 // This flag was set when there is at least one
|
2018-01-05 11:39:28 +01:00
|
|
|
// outstanding thread_local dtor
|
|
|
|
// registered with this soinfo. In such
|
|
|
|
// a case the actual unload is
|
|
|
|
// postponed until the last thread_local
|
|
|
|
// destructor associated with this
|
|
|
|
// soinfo is executed and this flag is
|
|
|
|
// unset.
|
2016-08-04 20:50:36 +02:00
|
|
|
#define FLAG_NEW_SOINFO 0x40000000 // new soinfo format
|
|
|
|
|
2019-01-02 03:53:48 +01:00
|
|
|
#define SOINFO_VERSION 5
|
2016-08-04 20:50:36 +02:00
|
|
|
|
|
|
|
typedef void (*linker_dtor_function_t)();
|
|
|
|
typedef void (*linker_ctor_function_t)(int, char**, char**);
|
|
|
|
|
|
|
|
class SymbolName {
|
|
|
|
public:
|
|
|
|
explicit SymbolName(const char* name)
|
|
|
|
: name_(name), has_elf_hash_(false), has_gnu_hash_(false),
|
|
|
|
elf_hash_(0), gnu_hash_(0) { }
|
|
|
|
|
|
|
|
const char* get_name() {
|
|
|
|
return name_;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t elf_hash();
|
|
|
|
uint32_t gnu_hash();
|
|
|
|
|
|
|
|
private:
|
|
|
|
const char* name_;
|
|
|
|
bool has_elf_hash_;
|
|
|
|
bool has_gnu_hash_;
|
|
|
|
uint32_t elf_hash_;
|
|
|
|
uint32_t gnu_hash_;
|
|
|
|
|
|
|
|
DISALLOW_IMPLICIT_CONSTRUCTORS(SymbolName);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct version_info {
|
|
|
|
constexpr version_info() : elf_hash(0), name(nullptr), target_si(nullptr) {}
|
|
|
|
|
|
|
|
uint32_t elf_hash;
|
|
|
|
const char* name;
|
|
|
|
const soinfo* target_si;
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO(dimitry): remove reference from soinfo member functions to this class.
|
|
|
|
class VersionTracker;
|
|
|
|
|
2019-01-02 03:53:48 +01:00
|
|
|
struct soinfo_tls {
|
|
|
|
TlsSegment segment;
|
2019-01-18 10:00:59 +01:00
|
|
|
size_t module_id = kTlsUninitializedModuleId;
|
2019-01-02 03:53:48 +01:00
|
|
|
};
|
|
|
|
|
2016-08-04 20:50:36 +02:00
|
|
|
#if defined(__work_around_b_24465209__)
|
|
|
|
#define SOINFO_NAME_LEN 128
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct soinfo {
|
|
|
|
#if defined(__work_around_b_24465209__)
|
|
|
|
private:
|
|
|
|
char old_name_[SOINFO_NAME_LEN];
|
|
|
|
#endif
|
|
|
|
public:
|
|
|
|
const ElfW(Phdr)* phdr;
|
|
|
|
size_t phnum;
|
|
|
|
#if defined(__work_around_b_24465209__)
|
|
|
|
ElfW(Addr) unused0; // DO NOT USE, maintained for compatibility.
|
|
|
|
#endif
|
|
|
|
ElfW(Addr) base;
|
|
|
|
size_t size;
|
|
|
|
|
|
|
|
#if defined(__work_around_b_24465209__)
|
|
|
|
uint32_t unused1; // DO NOT USE, maintained for compatibility.
|
|
|
|
#endif
|
|
|
|
|
|
|
|
ElfW(Dyn)* dynamic;
|
|
|
|
|
|
|
|
#if defined(__work_around_b_24465209__)
|
|
|
|
uint32_t unused2; // DO NOT USE, maintained for compatibility
|
|
|
|
uint32_t unused3; // DO NOT USE, maintained for compatibility
|
|
|
|
#endif
|
|
|
|
|
|
|
|
soinfo* next;
|
|
|
|
private:
|
|
|
|
uint32_t flags_;
|
|
|
|
|
|
|
|
const char* strtab_;
|
|
|
|
ElfW(Sym)* symtab_;
|
|
|
|
|
|
|
|
size_t nbucket_;
|
|
|
|
size_t nchain_;
|
|
|
|
uint32_t* bucket_;
|
|
|
|
uint32_t* chain_;
|
|
|
|
|
|
|
|
#if defined(__mips__) || !defined(__LP64__)
|
|
|
|
// This is only used by mips and mips64, but needs to be here for
|
|
|
|
// all 32-bit architectures to preserve binary compatibility.
|
|
|
|
ElfW(Addr)** plt_got_;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(USE_RELA)
|
|
|
|
ElfW(Rela)* plt_rela_;
|
|
|
|
size_t plt_rela_count_;
|
|
|
|
|
|
|
|
ElfW(Rela)* rela_;
|
|
|
|
size_t rela_count_;
|
|
|
|
#else
|
|
|
|
ElfW(Rel)* plt_rel_;
|
|
|
|
size_t plt_rel_count_;
|
|
|
|
|
|
|
|
ElfW(Rel)* rel_;
|
|
|
|
size_t rel_count_;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
linker_ctor_function_t* preinit_array_;
|
|
|
|
size_t preinit_array_count_;
|
|
|
|
|
|
|
|
linker_ctor_function_t* init_array_;
|
|
|
|
size_t init_array_count_;
|
|
|
|
linker_dtor_function_t* fini_array_;
|
|
|
|
size_t fini_array_count_;
|
|
|
|
|
|
|
|
linker_ctor_function_t init_func_;
|
|
|
|
linker_dtor_function_t fini_func_;
|
|
|
|
|
|
|
|
#if defined(__arm__)
|
|
|
|
public:
|
|
|
|
// ARM EABI section used for stack unwinding.
|
|
|
|
uint32_t* ARM_exidx;
|
|
|
|
size_t ARM_exidx_count;
|
|
|
|
private:
|
|
|
|
#elif defined(__mips__)
|
|
|
|
uint32_t mips_symtabno_;
|
|
|
|
uint32_t mips_local_gotno_;
|
|
|
|
uint32_t mips_gotsym_;
|
|
|
|
bool mips_relocate_got(const VersionTracker& version_tracker,
|
|
|
|
const soinfo_list_t& global_group,
|
|
|
|
const soinfo_list_t& local_group);
|
|
|
|
#if !defined(__LP64__)
|
|
|
|
bool mips_check_and_adjust_fp_modes();
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
size_t ref_count_;
|
|
|
|
public:
|
|
|
|
link_map link_map_head;
|
|
|
|
|
|
|
|
bool constructors_called;
|
|
|
|
|
|
|
|
// When you read a virtual address from the ELF file, add this
|
|
|
|
// value to get the corresponding address in the process' address space.
|
|
|
|
ElfW(Addr) load_bias;
|
|
|
|
|
|
|
|
#if !defined(__LP64__)
|
|
|
|
bool has_text_relocations;
|
|
|
|
#endif
|
|
|
|
bool has_DT_SYMBOLIC;
|
|
|
|
|
|
|
|
public:
|
|
|
|
soinfo(android_namespace_t* ns, const char* name, const struct stat* file_stat,
|
|
|
|
off64_t file_offset, int rtld_flags);
|
|
|
|
~soinfo();
|
|
|
|
|
|
|
|
void call_constructors();
|
|
|
|
void call_destructors();
|
|
|
|
void call_pre_init_constructors();
|
|
|
|
bool prelink_image();
|
|
|
|
bool link_image(const soinfo_list_t& global_group, const soinfo_list_t& local_group,
|
2018-10-17 21:59:38 +02:00
|
|
|
const android_dlextinfo* extinfo, size_t* relro_fd_offset);
|
2016-08-04 20:50:36 +02:00
|
|
|
bool protect_relro();
|
|
|
|
|
|
|
|
void add_child(soinfo* child);
|
|
|
|
void remove_all_links();
|
|
|
|
|
|
|
|
ino_t get_st_ino() const;
|
|
|
|
dev_t get_st_dev() const;
|
|
|
|
off64_t get_file_offset() const;
|
|
|
|
|
|
|
|
uint32_t get_rtld_flags() const;
|
|
|
|
uint32_t get_dt_flags_1() const;
|
|
|
|
void set_dt_flags_1(uint32_t dt_flags_1);
|
|
|
|
|
|
|
|
soinfo_list_t& get_children();
|
|
|
|
const soinfo_list_t& get_children() const;
|
|
|
|
|
|
|
|
soinfo_list_t& get_parents();
|
|
|
|
|
|
|
|
bool find_symbol_by_name(SymbolName& symbol_name,
|
|
|
|
const version_info* vi,
|
|
|
|
const ElfW(Sym)** symbol) const;
|
|
|
|
|
|
|
|
ElfW(Sym)* find_symbol_by_address(const void* addr);
|
|
|
|
ElfW(Addr) resolve_symbol_address(const ElfW(Sym)* s) const;
|
|
|
|
|
|
|
|
const char* get_string(ElfW(Word) index) const;
|
|
|
|
bool can_unload() const;
|
|
|
|
bool is_gnu_hash() const;
|
|
|
|
|
|
|
|
bool inline has_min_version(uint32_t min_version __unused) const {
|
|
|
|
#if defined(__work_around_b_24465209__)
|
|
|
|
return (flags_ & FLAG_NEW_SOINFO) != 0 && version_ >= min_version;
|
|
|
|
#else
|
|
|
|
return true;
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
bool is_linked() const;
|
|
|
|
bool is_linker() const;
|
|
|
|
bool is_main_executable() const;
|
|
|
|
|
|
|
|
void set_linked();
|
|
|
|
void set_linker_flag();
|
|
|
|
void set_main_executable();
|
|
|
|
void set_nodelete();
|
|
|
|
|
2017-11-28 16:03:07 +01:00
|
|
|
size_t increment_ref_count();
|
2016-08-04 20:50:36 +02:00
|
|
|
size_t decrement_ref_count();
|
2018-01-05 11:39:28 +01:00
|
|
|
size_t get_ref_count() const;
|
2016-08-04 20:50:36 +02:00
|
|
|
|
|
|
|
soinfo* get_local_group_root() const;
|
|
|
|
|
|
|
|
void set_soname(const char* soname);
|
|
|
|
const char* get_soname() const;
|
|
|
|
const char* get_realpath() const;
|
|
|
|
const ElfW(Versym)* get_versym(size_t n) const;
|
|
|
|
ElfW(Addr) get_verneed_ptr() const;
|
|
|
|
size_t get_verneed_cnt() const;
|
|
|
|
ElfW(Addr) get_verdef_ptr() const;
|
|
|
|
size_t get_verdef_cnt() const;
|
|
|
|
|
2018-11-13 01:01:37 +01:00
|
|
|
int get_target_sdk_version() const;
|
2016-08-04 20:50:36 +02:00
|
|
|
|
|
|
|
void set_dt_runpath(const char *);
|
|
|
|
const std::vector<std::string>& get_dt_runpath() const;
|
|
|
|
android_namespace_t* get_primary_namespace();
|
|
|
|
void add_secondary_namespace(android_namespace_t* secondary_ns);
|
2017-02-03 23:07:34 +01:00
|
|
|
android_namespace_list_t& get_secondary_namespaces();
|
2016-08-04 20:50:36 +02:00
|
|
|
|
2019-01-02 03:53:48 +01:00
|
|
|
soinfo_tls* get_tls() const;
|
|
|
|
|
2016-08-04 20:50:36 +02:00
|
|
|
void set_mapped_by_caller(bool reserved_map);
|
|
|
|
bool is_mapped_by_caller() const;
|
|
|
|
|
|
|
|
uintptr_t get_handle() const;
|
|
|
|
void generate_handle();
|
|
|
|
void* to_handle();
|
|
|
|
|
|
|
|
private:
|
2017-11-28 16:03:07 +01:00
|
|
|
bool is_image_linked() const;
|
|
|
|
void set_image_linked();
|
|
|
|
|
2016-08-04 20:50:36 +02:00
|
|
|
bool elf_lookup(SymbolName& symbol_name, const version_info* vi, uint32_t* symbol_index) const;
|
|
|
|
ElfW(Sym)* elf_addr_lookup(const void* addr);
|
|
|
|
bool gnu_lookup(SymbolName& symbol_name, const version_info* vi, uint32_t* symbol_index) const;
|
|
|
|
ElfW(Sym)* gnu_addr_lookup(const void* addr);
|
|
|
|
|
|
|
|
bool lookup_version_info(const VersionTracker& version_tracker, ElfW(Word) sym,
|
|
|
|
const char* sym_name, const version_info** vi);
|
|
|
|
|
|
|
|
template<typename ElfRelIteratorT>
|
|
|
|
bool relocate(const VersionTracker& version_tracker, ElfRelIteratorT&& rel_iterator,
|
|
|
|
const soinfo_list_t& global_group, const soinfo_list_t& local_group);
|
2017-12-20 00:25:23 +01:00
|
|
|
bool relocate_relr();
|
2018-01-26 00:34:15 +01:00
|
|
|
void apply_relr_reloc(ElfW(Addr) offset);
|
2016-08-04 20:50:36 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
// This part of the structure is only available
|
|
|
|
// when FLAG_NEW_SOINFO is set in this->flags.
|
|
|
|
uint32_t version_;
|
|
|
|
|
|
|
|
// version >= 0
|
|
|
|
dev_t st_dev_;
|
|
|
|
ino_t st_ino_;
|
|
|
|
|
|
|
|
// dependency graph
|
|
|
|
soinfo_list_t children_;
|
|
|
|
soinfo_list_t parents_;
|
|
|
|
|
|
|
|
// version >= 1
|
|
|
|
off64_t file_offset_;
|
|
|
|
uint32_t rtld_flags_;
|
|
|
|
uint32_t dt_flags_1_;
|
|
|
|
size_t strtab_size_;
|
|
|
|
|
|
|
|
// version >= 2
|
|
|
|
|
|
|
|
size_t gnu_nbucket_;
|
|
|
|
uint32_t* gnu_bucket_;
|
|
|
|
uint32_t* gnu_chain_;
|
|
|
|
uint32_t gnu_maskwords_;
|
|
|
|
uint32_t gnu_shift2_;
|
|
|
|
ElfW(Addr)* gnu_bloom_filter_;
|
|
|
|
|
|
|
|
soinfo* local_group_root_;
|
|
|
|
|
|
|
|
uint8_t* android_relocs_;
|
|
|
|
size_t android_relocs_size_;
|
|
|
|
|
|
|
|
const char* soname_;
|
|
|
|
std::string realpath_;
|
|
|
|
|
|
|
|
const ElfW(Versym)* versym_;
|
|
|
|
|
|
|
|
ElfW(Addr) verdef_ptr_;
|
|
|
|
size_t verdef_cnt_;
|
|
|
|
|
|
|
|
ElfW(Addr) verneed_ptr_;
|
|
|
|
size_t verneed_cnt_;
|
|
|
|
|
2018-11-13 01:01:37 +01:00
|
|
|
int target_sdk_version_;
|
2016-08-04 20:50:36 +02:00
|
|
|
|
|
|
|
// version >= 3
|
|
|
|
std::vector<std::string> dt_runpath_;
|
|
|
|
android_namespace_t* primary_namespace_;
|
|
|
|
android_namespace_list_t secondary_namespaces_;
|
|
|
|
uintptr_t handle_;
|
|
|
|
|
2018-08-21 02:44:42 +02:00
|
|
|
friend soinfo* get_libdl_info(const char* linker_path, const soinfo& linker_si);
|
2017-12-20 00:25:23 +01:00
|
|
|
|
|
|
|
// version >= 4
|
|
|
|
ElfW(Relr)* relr_;
|
|
|
|
size_t relr_count_;
|
2019-01-02 03:53:48 +01:00
|
|
|
|
|
|
|
// version >= 5
|
|
|
|
std::unique_ptr<soinfo_tls> tls_;
|
Implement arm64 TLSDESC
Each TLSDESC relocation relocates a 2-word descriptor in the GOT that
contains:
- the address of a TLS resolver function
- an argument to pass (indirectly) to the resolver function
(Specifically, the address of the 2-word descriptor is passed to the
resolver.)
The loader resolves R_GENERIC_TLSDESC relocations using one of three
resolver functions that it defines:
- tlsdesc_resolver_static
- tlsdesc_resolver_dynamic
- tlsdesc_resolver_unresolved_weak
The resolver functions are written in assembly because they have a
restrictive calling convention. They're only allowed to modify x0 and
(apparently) the condition codes.
For a relocation to memory in static TLS (i.e. the executable or an solib
loaded initially), the loader uses a simple resolver function,
tlsdesc_resolver_static, that returns the static offset it receives from
the loader.
For relocations to dynamic TLS memory (i.e. memory in a dlopen'ed solib),
the loader uses tlsdesc_resolver_dynamic, which allocates TLS memory on
demand. It inlines the fast path of __tls_get_addr, then falls back to
__tls_get_addr when it needs to allocate memory. The loader handles these
dynamic TLS relocations in two passes:
- In the first pass, it allocates a table of TlsDynamicResolverArg
objects, one per dynamic TLSDESC relocation.
- In the second pass, once the table is finalized, it writes the
addresses of the TlsDynamicResolverArg objects into the TLSDESC
relocations.
tlsdesc_resolver_unresolved_weak returns a negated thread pointer so that
taking the address of an unresolved weak TLS symbols produces NULL.
The loader handles R_GENERIC_TLSDESC in a target-independent way, but
only for arm64, because Bionic has only implemented the resolver functions
for arm64.
Bug: http://b/78026329
Test: bionic unit tests
Test: check that backtrace works inside a resolver function and inside
__tls_get_addr called from a resolver
(gdbclient.py, b __tls_get_addr, bt)
Merged-In: I752e59ff986292449892c449dad2546e6f0ff7b6
Change-Id: I752e59ff986292449892c449dad2546e6f0ff7b6
2019-01-24 02:47:10 +01:00
|
|
|
std::vector<TlsDynamicResolverArg> tlsdesc_args_;
|
2016-08-04 20:50:36 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// This function is used by dlvsym() to calculate hash of sym_ver
|
|
|
|
uint32_t calculate_elf_hash(const char* name);
|
|
|
|
|
2016-09-09 19:00:39 +02:00
|
|
|
const char* fix_dt_needed(const char* dt_needed, const char* sopath);
|
|
|
|
|
|
|
|
template<typename F>
|
|
|
|
void for_each_dt_needed(const soinfo* si, F action) {
|
|
|
|
for (const ElfW(Dyn)* d = si->dynamic; d->d_tag != DT_NULL; ++d) {
|
|
|
|
if (d->d_tag == DT_NEEDED) {
|
|
|
|
action(fix_dt_needed(si->get_string(d->d_un.d_val), si->get_realpath()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|