diff options
Diffstat (limited to 'bfd/elfnn-riscv.c')
-rw-r--r-- | bfd/elfnn-riscv.c | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/bfd/elfnn-riscv.c b/bfd/elfnn-riscv.c index af08f7d..09cf707 100644 --- a/bfd/elfnn-riscv.c +++ b/bfd/elfnn-riscv.c @@ -1711,7 +1711,7 @@ riscv_elf_late_size_sections (bfd *output_bfd, struct bfd_link_info *info) /* Set the contents of the .interp section to the interpreter. */ if (bfd_link_executable (info) && !info->nointerp) { - s = bfd_get_linker_section (dynobj, ".interp"); + s = elf_hash_table (info)->interp; BFD_ASSERT (s != NULL); s->size = strlen (ELFNN_DYNAMIC_INTERPRETER) + 1; s->contents = (unsigned char *) ELFNN_DYNAMIC_INTERPRETER; @@ -2880,7 +2880,8 @@ riscv_elf_relocate_section (bfd *output_bfd, if (h->dynindx == -1 && !h->forced_local && h->root.type != bfd_link_hash_undefweak - && bfd_link_pic (info)) + && bfd_link_pic (info) + && !bfd_is_abs_section(h->root.u.def.section)) relative_got = true; bfd_put_NN (output_bfd, relocation, @@ -3605,19 +3606,13 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd, else { /* Generate R_RISCV_NN. */ - BFD_ASSERT ((h->got.offset & 1) == 0); - BFD_ASSERT (h->dynindx != -1); - rela.r_info = ELFNN_R_INFO (h->dynindx, R_RISCV_NN); - rela.r_addend = 0; + goto do_reloc_nn; } } else if (bfd_link_pic (info)) { /* Generate R_RISCV_NN. */ - BFD_ASSERT ((h->got.offset & 1) == 0); - BFD_ASSERT (h->dynindx != -1); - rela.r_info = ELFNN_R_INFO (h->dynindx, R_RISCV_NN); - rela.r_addend = 0; + goto do_reloc_nn; } else { @@ -3655,15 +3650,15 @@ riscv_elf_finish_dynamic_symbol (bfd *output_bfd, } else { + do_reloc_nn: BFD_ASSERT ((h->got.offset & 1) == 0); BFD_ASSERT (h->dynindx != -1); rela.r_info = ELFNN_R_INFO (h->dynindx, R_RISCV_NN); rela.r_addend = 0; + bfd_put_NN (output_bfd, 0, + sgot->contents + (h->got.offset & ~(bfd_vma) 1)); } - bfd_put_NN (output_bfd, 0, - sgot->contents + (h->got.offset & ~(bfd_vma) 1)); - if (use_elf_append_rela) riscv_elf_append_rela (output_bfd, srela, &rela); else |