diff --git a/main.cc b/main.cc index f448e6fe..8fa27c02 100644 --- a/main.cc +++ b/main.cc @@ -139,6 +139,8 @@ static ObjectFile *create_internal_file() { out::__bss_start = create("__bss_start"); out::__ehdr_start = create("__ehdr_start"); + out::__rela_iplt_start = create("__rela_iplt_start"); + out::__rela_iplt_end = create("__rela_iplt_end"); obj->elf_syms = *elf_syms; return obj; } @@ -683,6 +685,10 @@ int main(int argc, char **argv) { break; } } + + // __rela_iplt_start and __rela_iplt_end + out::__rela_iplt_start->addr = out::plt->shdr.sh_addr; + out::__rela_iplt_end->addr = out::plt->shdr.sh_addr + out::plt->shdr.sh_size; } // Fix symbol addresses. diff --git a/mold.h b/mold.h index 82a35870..a286a171 100644 --- a/mold.h +++ b/mold.h @@ -493,6 +493,8 @@ extern u64 tls_end; extern Symbol *__bss_start; extern Symbol *__ehdr_start; +extern Symbol *__rela_iplt_start; +extern Symbol *__rela_iplt_end; extern Symbol *end; extern Symbol *_end; extern Symbol *etext; diff --git a/output_chunks.cc b/output_chunks.cc index 07f69029..7f30b40f 100644 --- a/output_chunks.cc +++ b/output_chunks.cc @@ -18,6 +18,8 @@ u64 out::tls_end; Symbol *out::__bss_start; Symbol *out::__ehdr_start; +Symbol *out::__rela_iplt_start; +Symbol *out::__rela_iplt_end; Symbol *out::end; Symbol *out::_end; Symbol *out::etext;