diff options
author | Scott Lobdell <slobdell@google.com> | 2021-02-05 18:00:54 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2021-02-05 18:00:54 +0000 |
commit | c800319ca06bb624b67d33741336fa42e9dd2667 (patch) | |
tree | cae72caa0322a7ecec0fecf813ae0d7c14ffd980 /linker/linker_main.cpp | |
parent | ea1e0a27d3fb999f3015dfd7b42d9ba699284f10 (diff) | |
parent | 3cfe8f2ca3589184c6329a6fa4fadf7a5ebaa0d4 (diff) |
Merge "Merge SP1A.210122.003 Change-Id: I38a0c2cf0aed3762aafe4b1fa8a69dd03106fa39" into s-keystone-qcom-dev
Diffstat (limited to 'linker/linker_main.cpp')
-rw-r--r-- | linker/linker_main.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/linker/linker_main.cpp b/linker/linker_main.cpp index aad8f6f6f..0b501a7b1 100644 --- a/linker/linker_main.cpp +++ b/linker/linker_main.cpp @@ -66,6 +66,8 @@ static void get_elf_base_from_phdr(const ElfW(Phdr)* phdr_table, size_t phdr_cou static void set_bss_vma_name(soinfo* si); +void __libc_init_mte(const void* phdr_start, size_t phdr_count, uintptr_t load_bias); + // These should be preserved static to avoid emitting // RELATIVE relocations for the part of the code running // before linker links itself. @@ -403,6 +405,8 @@ static ElfW(Addr) linker_main(KernelArgumentBlock& args, const char* exe_to_load strerror(errno)); } } + + __libc_init_mte(somain->phdr, somain->phnum, somain->load_bias); #endif // Register the main executable and the linker upfront to have @@ -721,6 +725,13 @@ __linker_init_post_relocation(KernelArgumentBlock& args, soinfo& tmp_linker_so) // Initialize the linker's own global variables tmp_linker_so.call_constructors(); + // Setting the linker soinfo's soname can allocate heap memory, so delay it until here. + for (const ElfW(Dyn)* d = tmp_linker_so.dynamic; d->d_tag != DT_NULL; ++d) { + if (d->d_tag == DT_SONAME) { + tmp_linker_so.set_soname(tmp_linker_so.get_string(d->d_un.d_val)); + } + } + // When the linker is run directly rather than acting as PT_INTERP, parse // arguments and determine the executable to load. When it's instead acting // as PT_INTERP, AT_ENTRY will refer to the loaded executable rather than the |