Home
last modified time | relevance | path

Searched refs:ElfW (Results 1 – 25 of 35) sorted by relevance

12

/bionic/linker/
Dlinker_phdr.h51 ElfW(Addr) load_start() const { return reinterpret_cast<ElfW(Addr)>(load_start_); } in load_start()
53 ElfW(Addr) gap_start() const { return reinterpret_cast<ElfW(Addr)>(gap_start_); } in gap_start()
55 ElfW(Addr) load_bias() const { return load_bias_; } in load_bias()
56 const ElfW(Phdr)* loaded_phdr() const { return loaded_phdr_; } in ElfW() function
57 const ElfW(Dyn)* dynamic() const { return dynamic_; } in ElfW() function
58 const char* get_string(ElfW(Word) index) const;
60 ElfW(Addr) entry_point() const { return header_.e_entry + load_bias_; } in entry_point()
74 [[nodiscard]] bool CheckPhdr(ElfW(Addr));
75 [[nodiscard]] bool CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment);
84 ElfW(Ehdr) header_;
[all …]
Dlinker_wrapper.cpp44 static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_count, in get_elf_base_from_phdr()
45 ElfW(Addr)* base, ElfW(Addr)* load_bias) { in get_elf_base_from_phdr()
48 *load_bias = reinterpret_cast<ElfW(Addr)>(phdr_table) - phdr_table[i].p_vaddr; in get_elf_base_from_phdr()
49 *base = reinterpret_cast<ElfW(Addr)>(phdr_table) - phdr_table[i].p_offset; in get_elf_base_from_phdr()
59 extern "C" ElfW(Addr) __linker_init(void* raw_args) { in __linker_init()
62 ElfW(Addr) base_addr = 0; in __linker_init()
63 ElfW(Addr) load_bias = 0; in __linker_init()
65 reinterpret_cast<ElfW(Phdr)*>(args.getauxval(AT_PHDR)), args.getauxval(AT_PHNUM), in __linker_init()
68 ElfW(Addr) linker_addr = base_addr + reinterpret_cast<uintptr_t>(&__dlwrap_linker_offset); in __linker_init()
69 ElfW(Addr) linker_entry_offset = reinterpret_cast<ElfW(Ehdr)*>(linker_addr)->e_entry; in __linker_init()
[all …]
Dlinker_phdr.cpp216 const char* ElfReader::get_string(ElfW(Word) index) const { in get_string()
300 if (header_.e_shentsize != sizeof(ElfW(Shdr))) { in VerifyElfHeader()
303 name_.c_str(), header_.e_shentsize, sizeof(ElfW(Shdr))); in VerifyElfHeader()
309 name_.c_str(), header_.e_shentsize, sizeof(ElfW(Shdr))); in VerifyElfHeader()
327 bool ElfReader::CheckFileRange(ElfW(Addr) offset, size_t size, size_t alignment) { in CheckFileRange()
350 if (phdr_num_ < 1 || phdr_num_ > 65536/sizeof(ElfW(Phdr))) { in ReadProgramHeaders()
356 size_t size = phdr_num_ * sizeof(ElfW(Phdr)); in ReadProgramHeaders()
357 if (!CheckFileRange(header_.e_phoff, size, alignof(ElfW(Phdr)))) { in ReadProgramHeaders()
370 phdr_table_ = static_cast<ElfW(Phdr)*>(phdr_fragment_.data()); in ReadProgramHeaders()
382 size_t size = shdr_num_ * sizeof(ElfW(Shdr)); in ReadSectionHeaders()
[all …]
Dlinker_soinfo.h73 ElfW(Addr) call_ifunc_resolver(ElfW(Addr) resolver_addr);
82 ElfW(Addr)* gnu_bloom_filter_ = nullptr;
86 const ElfW(Sym)* symtab_;
87 const ElfW(Versym)* versym_;
165 const ElfW(Phdr)* phdr;
168 ElfW(Addr) unused0; // DO NOT USE, maintained for compatibility.
170 ElfW(Addr) base;
177 ElfW(Dyn)* dynamic;
189 ElfW(Sym)* symtab_;
197 ElfW(Addr)** unused4; // DO NOT USE, maintained for compatibility
[all …]
Dlinker_note_gnu_property.cpp42 GnuPropertySection::GnuPropertySection(const ElfW(Phdr)* phdr, size_t phdr_count, in GnuPropertySection()
43 const ElfW(Addr) load_bias, const char* name) { in GnuPropertySection()
53 const ElfW(NhdrGNUProperty)* GnuPropertySection::FindSegment(const ElfW(Phdr)* phdr, in ElfW() function
55 const ElfW(Addr) load_bias, in ElfW()
68 if (phdr[i].p_memsz < sizeof(ElfW(NhdrGNUProperty))) { in ElfW()
72 name, static_cast<size_t>(phdr[i].p_memsz), sizeof(ElfW(NhdrGNUProperty))); in ElfW()
78 auto note_nhdr = reinterpret_cast<ElfW(NhdrGNUProperty)*>(load_bias + phdr[i].p_vaddr); in ElfW()
81 if ((phdr[i].p_memsz - sizeof(ElfW(NhdrGNUProperty))) < note_nhdr->nhdr.n_descsz) { in ElfW()
97 bool GnuPropertySection::SanityCheck(const ElfW(NhdrGNUProperty)* note_nhdr, in SanityCheck()
121 bool GnuPropertySection::Parse(const ElfW(NhdrGNUProperty)* note_nhdr, const char* name) { in Parse()
[all …]
Dlinker_note_gnu_property_test.cpp67 ElfW(Phdr) phdrs[] = { \
71 .p_vaddr = reinterpret_cast<ElfW(Addr)>(__prop), \
72 .p_memsz = sizeof(ElfW(NhdrGNUProperty)) + (__prop)->nhdr.n_descsz, \
100 note = reinterpret_cast<ElfW(NhdrGNUProperty)*>(&section[0]); in GnuPropertySectionBuilder()
108 bool push(ElfW(Word) pr_type, ElfW(Word) pr_datasz, const T* pr_data) { in push()
110 const uintptr_t addition = align_up(pr_datasz, sizeof(ElfW(Addr))); in push()
115 ElfW(Prop)* prop = reinterpret_cast<ElfW(Prop)*>(&section[offset()]); in push()
119 step(2 * sizeof(ElfW(Word))); in push()
129 ElfW(NhdrGNUProperty)* data() const { return note; } in ElfW() function in GnuPropertySectionBuilder
157 void corrupt_n_descsz(ElfW(Word) n_descsz) { note->nhdr.n_descsz = n_descsz; } in corrupt_n_descsz()
[all …]
Dlinker_main.cpp66 static ElfW(Addr) get_elf_exec_load_bias(const ElfW(Ehdr)* elf);
68 static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_count,
69 ElfW(Addr)* base, ElfW(Addr)* load_bias);
165 ElfW(Ehdr)* ehdr_vdso = reinterpret_cast<ElfW(Ehdr)*>(getauxval(AT_SYSINFO_EHDR)); in add_vdso()
172 si->phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso->e_phoff); in add_vdso()
174 si->base = reinterpret_cast<ElfW(Addr)>(ehdr_vdso); in add_vdso()
203 const ElfW(Phdr)* phdr;
205 ElfW(Addr) entry_point;
230 result.phdr = reinterpret_cast<const ElfW(Phdr)*>(getauxval(AT_PHDR)); in get_executable_info()
306 static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load) { in linker_main()
[all …]
Dlinker_relocate.cpp47 static bool is_tls_reloc(ElfW(Word) type) { in is_tls_reloc()
70 ElfW(Sym)* si_symtab = nullptr;
76 ElfW(Word) cache_sym_val = 0;
78 const ElfW(Sym)* cache_sym = nullptr;
86 const char* get_string(ElfW(Word) index) { in get_string()
98 soinfo** found_in, const ElfW(Sym)** sym) { in lookup_symbol()
110 …const ElfW(Sym)* local_sym = soinfo_do_lookup(sym_name, vi, &local_found_in, relocator.lookup_list… in lookup_symbol() local
170 const ElfW(Sym)* sym = nullptr; in process_relocation_impl() local
172 ElfW(Addr) sym_addr = 0; in process_relocation_impl()
229 auto get_addend_rel = [&]() -> ElfW(Addr) { return reloc.r_addend; }; in process_relocation_impl()
[all …]
Dlinker_note_gnu_property.h79 GnuPropertySection(const ElfW(Phdr)* phdr, size_t phdr_count, const ElfW(Addr) load_bias,
87 const ElfW(NhdrGNUProperty)* FindSegment(const ElfW(Phdr)* phdr, size_t phdr_count,
88 const ElfW(Addr) load_bias, const char* name) const;
89 bool SanityCheck(const ElfW(NhdrGNUProperty)* note_nhdr, const char* name) const;
90 bool Parse(const ElfW(NhdrGNUProperty)* note_nhdr, const char* name);
Dlinker_soinfo.cpp108 static inline bool check_symbol_version(const ElfW(Versym)* ver_table, uint32_t sym_idx, in check_symbol_version()
109 const ElfW(Versym) verneed) { in check_symbol_version()
118 __attribute__((noinline)) static const ElfW(Sym)* in ElfW() function
122 constexpr uint32_t kBloomMaskBits = sizeof(ElfW(Addr)) * 8; in ElfW()
139 if (const ElfW(Sym)* sym = lib->si_->find_symbol_by_name(elf_symbol_name, vi)) { in ElfW() local
152 const ElfW(Addr) bloom_word = lib->gnu_bloom_filter_[word_num]; in ElfW() local
170 ElfW(Versym) verneed = kVersymNotNeeded; in ElfW()
174 const ElfW(Sym)* sym = nullptr; in ElfW() local
207 const ElfW(Sym)* soinfo_do_lookup(const char* name, const version_info* vi, in ElfW() function
259 const ElfW(Versym)* soinfo::get_versym(size_t n) const { in ElfW() function
[all …]
Dlinker.h62 const version_info* get_version_info(ElfW(Versym) source_symver) const;
66 void add_version_info(size_t source_index, ElfW(Word) elf_hash,
180 ElfW(Versym) find_verdef_version_index(const soinfo* si, const version_info* vi);
182 bool relocate_relr(const ElfW(Relr)* begin, const ElfW(Relr)* end, ElfW(Addr) load_bias);
Dlinker.cpp734 static const ElfW(Sym)* dlsym_handle_lookup_impl(android_namespace_t* ns, in ElfW() function
740 const ElfW(Sym)* result = nullptr; in ElfW() local
770 static const ElfW(Sym)* dlsym_linear_lookup(android_namespace_t* ns, in ElfW() function
791 const ElfW(Sym)* s = nullptr; in ElfW() local
830 static const ElfW(Sym)* dlsym_handle_lookup(soinfo* si, in ElfW() function
856 ElfW(Addr) address = reinterpret_cast<ElfW(Addr)>(untag_address(p)); in find_containing_library()
861 ElfW(Addr) vaddr = address - si->load_bias; in find_containing_library()
863 const ElfW(Phdr)* phdr = &si->phdr[i]; in find_containing_library() local
1102 for (const ElfW(Dyn)* d = elf_reader.dynamic(); d->d_tag != DT_NULL; ++d) { in for_each_dt_needed() local
1283 for (const ElfW(Dyn)* d = elf_reader.dynamic(); d->d_tag != DT_NULL; ++d) { in load_library() local
[all …]
Dlinker_relocate.h42 static constexpr ElfW(Versym) kVersymHiddenBit = 0x8000;
60 inline bool is_symbol_global_and_defined(const soinfo* si, const ElfW(Sym)* s) { in is_symbol_global_and_defined()
/bionic/libc/bionic/
Delf_note.cpp34 bool __get_elf_note(unsigned note_type, const char* note_name, const ElfW(Addr) note_addr, in __get_elf_note()
35 const ElfW(Phdr)* phdr_note, const ElfW(Nhdr)** note_hdr, in __get_elf_note()
41 ElfW(Addr) p = note_addr; in __get_elf_note()
42 ElfW(Addr) note_end = p + phdr_note->p_memsz; in __get_elf_note()
44 while (p + sizeof(ElfW(Nhdr)) <= note_end) { in __get_elf_note()
45 const ElfW(Nhdr)* note = reinterpret_cast<const ElfW(Nhdr)*>(p); in __get_elf_note() local
46 p += sizeof(ElfW(Nhdr)); in __get_elf_note()
70 bool __find_elf_note(unsigned int note_type, const char* note_name, const ElfW(Phdr)* phdr_start, in __find_elf_note()
71 size_t phdr_ct, const ElfW(Nhdr)** note_hdr, const char** note_desc, in __find_elf_note()
72 const ElfW(Addr) load_bias) { in __find_elf_note()
[all …]
Dlibc_init_static.cpp92 extern __LIBC_HIDDEN__ __attribute__((weak)) ElfW(Rel) __rel_iplt_start[], __rel_iplt_end[];
95 for (ElfW(Rel)* r = __rel_iplt_start; r != __rel_iplt_end; ++r) { in call_ifunc_resolvers()
96 ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset); in call_ifunc_resolvers()
97 ElfW(Addr) resolver = *offset; in call_ifunc_resolvers()
102 extern __LIBC_HIDDEN__ __attribute__((weak)) ElfW(Rela) __rela_iplt_start[], __rela_iplt_end[];
105 for (ElfW(Rela)* r = __rela_iplt_start; r != __rela_iplt_end; ++r) { in call_ifunc_resolvers()
106 ElfW(Addr)* offset = reinterpret_cast<ElfW(Addr)*>(r->r_offset); in call_ifunc_resolvers()
107 ElfW(Addr) resolver = r->r_addend; in call_ifunc_resolvers()
114 ElfW(Phdr)* phdr_start = reinterpret_cast<ElfW(Phdr)*>(getauxval(AT_PHDR)); in apply_gnu_relro()
117 for (ElfW(Phdr)* phdr = phdr_start; phdr < (phdr_start + phdr_ct); phdr++) { in apply_gnu_relro()
[all …]
Dbionic_call_ifunc_resolver.cpp40 ElfW(Addr) __bionic_call_ifunc_resolver(ElfW(Addr) resolver_addr) { in __bionic_call_ifunc_resolver()
42 typedef ElfW(Addr) (*ifunc_resolver_t)(uint64_t, __ifunc_arg_t*); in __bionic_call_ifunc_resolver()
53 typedef ElfW(Addr) (*ifunc_resolver_t)(unsigned long); in __bionic_call_ifunc_resolver()
60 typedef ElfW(Addr) (*ifunc_resolver_t)(uint64_t, __riscv_hwprobe_t, void*); in __bionic_call_ifunc_resolver()
64 typedef ElfW(Addr) (*ifunc_resolver_t)(void); in __bionic_call_ifunc_resolver()
Dvdso.cpp123 ElfW(Ehdr)* vdso_ehdr = reinterpret_cast<ElfW(Ehdr)*>(vdso_ehdr_addr); in __libc_init_vdso()
130 ElfW(Shdr)* vdso_shdr = reinterpret_cast<ElfW(Shdr)*>(vdso_ehdr_addr + vdso_ehdr->e_shoff); in __libc_init_vdso()
133 symbol_count = vdso_shdr[i].sh_size / sizeof(ElfW(Sym)); in __libc_init_vdso()
142 ElfW(Addr) vdso_addr = 0; in __libc_init_vdso()
143 ElfW(Dyn)* vdso_dyn = nullptr; in __libc_init_vdso()
144 ElfW(Phdr)* vdso_phdr = reinterpret_cast<ElfW(Phdr)*>(vdso_ehdr_addr + vdso_ehdr->e_phoff); in __libc_init_vdso()
147 vdso_dyn = reinterpret_cast<ElfW(Dyn)*>(vdso_ehdr_addr + vdso_phdr[i].p_offset); in __libc_init_vdso()
159 ElfW(Sym)* symtab = nullptr; in __libc_init_vdso()
160 for (ElfW(Dyn)* d = vdso_dyn; d->d_tag != DT_NULL; ++d) { in __libc_init_vdso()
164 symtab = reinterpret_cast<ElfW(Sym)*>(vdso_addr + d->d_un.d_ptr); in __libc_init_vdso()
Ddl_iterate_phdr_static.cpp43 ElfW(Ehdr)* ehdr = reinterpret_cast<ElfW(Ehdr)*>(&__executable_start); in dl_iterate_phdr()
57 …exe_info.dlpi_phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<uintptr_t>(ehdr) + ehdr->e_pho… in dl_iterate_phdr()
82 ElfW(Ehdr)* ehdr_vdso = reinterpret_cast<ElfW(Ehdr)*>(getauxval(AT_SYSINFO_EHDR)); in dl_iterate_phdr()
91 …vdso_info.dlpi_phdr = reinterpret_cast<ElfW(Phdr)*>(reinterpret_cast<char*>(ehdr_vdso) + ehdr_vdso… in dl_iterate_phdr()
99 vdso_info.dlpi_addr = (ElfW(Addr)) ehdr_vdso - vdso_info.dlpi_phdr[i].p_vaddr; in dl_iterate_phdr()
Dlibc_init_dynamic.cpp74 extern "C" __attribute__((weak)) void __hwasan_library_loaded(ElfW(Addr) base,
75 const ElfW(Phdr)* phdr,
76 ElfW(Half) phnum);
77 extern "C" __attribute__((weak)) void __hwasan_library_unloaded(ElfW(Addr) base,
78 const ElfW(Phdr)* phdr,
79 ElfW(Half) phnum);
/bionic/libc/include/
Dlink.h46 #define ElfW(type) Elf64_ ## type macro
49 #define ElfW(type) Elf32_ ## type
57 ElfW(Addr) dlpi_addr;
61 const ElfW(Phdr)* _Nullable dlpi_phdr;
63 ElfW(Half) dlpi_phnum;
120 ElfW(Addr) l_addr;
122 ElfW(Dyn)* _Nullable l_ld;
131 ElfW(Addr) r_brk;
137 ElfW(Addr) r_ldbase;
/bionic/libc/private/
Delf_note.h35 bool __get_elf_note(unsigned note_type, const char* note_name, const ElfW(Addr) note_addr,
36 const ElfW(Phdr)* phdr_note, const ElfW(Nhdr)** note_hdr,
40 bool __find_elf_note(unsigned int note_type, const char* note_name, const ElfW(Phdr)* phdr_start,
41 size_t phdr_ct, const ElfW(Nhdr)** note_hdr, const char** note_desc,
42 const ElfW(Addr) load_bias);
Dbionic_globals.h105 ElfW(auxv_t)* auxv = nullptr;
115 void (*load_hook)(ElfW(Addr) base, const ElfW(Phdr)* phdr, ElfW(Half) phnum) = nullptr;
116 void (*unload_hook)(ElfW(Addr) base, const ElfW(Phdr)* phdr, ElfW(Half) phnum) = nullptr;
DKernelArgumentBlock.h46 auxv = reinterpret_cast<ElfW(auxv_t)*>(p); in KernelArgumentBlock()
52 for (ElfW(auxv_t)* v = auxv; v->a_type != AT_NULL; ++v) { in getauxval()
63 ElfW(auxv_t)* auxv;
Dbionic_call_ifunc_resolver.h34 __LIBC_HIDDEN__ ElfW(Addr) __bionic_call_ifunc_resolver(ElfW(Addr) resolver_addr);
/bionic/tests/
Dlink_test.cpp64 for (ElfW(Half) i = 0; i < info->dlpi_phnum; ++i) { in TEST()
65 const ElfW(Phdr)* phdr = reinterpret_cast<const ElfW(Phdr)*>(&info->dlpi_phdr[i]); in TEST() local
67 const ElfW(Ehdr)* ehdr = reinterpret_cast<const ElfW(Ehdr)*>(info->dlpi_addr + in TEST() local
131 const ElfW(Phdr)* table;
136 static ElfW(Addr) find_exe_load_bias(const ProgHdr& phdr) { in find_exe_load_bias()
139 return reinterpret_cast<ElfW(Addr)>(phdr.table) - phdr.table[i].p_vaddr; in find_exe_load_bias()
146 static ElfW(Dyn)* find_dynamic(const ProgHdr& phdr, ElfW(Addr) load_bias) { in ElfW() function
149 return reinterpret_cast<ElfW(Dyn)*>(phdr.table[i].p_vaddr + load_bias); in ElfW()
156 static r_debug* find_exe_r_debug(ElfW(Dyn)* dynamic) { in find_exe_r_debug()
157 for (ElfW(Dyn)* d = dynamic; d->d_tag != DT_NULL; ++d) { in find_exe_r_debug()
[all …]

12